block-backend: Make blk_inc/dec_in_flight public

For some users of BlockBackends, just increasing the in_flight counter
is easier than implementing separate handlers in BlockDevOps. Make the
helper functions for this public.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Kevin Wolf 2019-02-14 18:42:44 +01:00
parent 334c43e2c3
commit c90e2a9cfd
2 changed files with 4 additions and 2 deletions

View File

@ -1262,12 +1262,12 @@ int blk_make_zero(BlockBackend *blk, BdrvRequestFlags flags)
return bdrv_make_zero(blk->root, flags); return bdrv_make_zero(blk->root, flags);
} }
static void blk_inc_in_flight(BlockBackend *blk) void blk_inc_in_flight(BlockBackend *blk)
{ {
atomic_inc(&blk->in_flight); atomic_inc(&blk->in_flight);
} }
static void blk_dec_in_flight(BlockBackend *blk) void blk_dec_in_flight(BlockBackend *blk)
{ {
atomic_dec(&blk->in_flight); atomic_dec(&blk->in_flight);
aio_wait_kick(); aio_wait_kick();

View File

@ -156,6 +156,8 @@ int blk_co_pdiscard(BlockBackend *blk, int64_t offset, int bytes);
int blk_co_flush(BlockBackend *blk); int blk_co_flush(BlockBackend *blk);
int blk_flush(BlockBackend *blk); int blk_flush(BlockBackend *blk);
int blk_commit_all(void); int blk_commit_all(void);
void blk_inc_in_flight(BlockBackend *blk);
void blk_dec_in_flight(BlockBackend *blk);
void blk_drain(BlockBackend *blk); void blk_drain(BlockBackend *blk);
void blk_drain_all(void); void blk_drain_all(void);
void blk_set_on_error(BlockBackend *blk, BlockdevOnError on_read_error, void blk_set_on_error(BlockBackend *blk, BlockdevOnError on_read_error,