blk_co_preadv() and blk_co_preadv_part() share identical bodies except that blk_co_preadv() always passes qiov_offset=0. blk_co_pwritev() already uses this pattern and simply calls blk_co_pwritev_part() with qiov_offset=0. Apply the same simplification to the read side so that both pairs are consistent and the shared logic lives in a single place.
Before this change blk_co_preadv() duplicated the blk_inc_in_flight / blk_co_do_preadv_part / blk_dec_in_flight sequence. After this change it is a one-liner wrapper, matching the write side. Signed-off-by: Bin Guo <[email protected]> --- block/block-backend.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index 9944657120..490b149bf8 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1376,14 +1376,8 @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags) { - int ret; IO_OR_GS_CODE(); - - blk_inc_in_flight(blk); - ret = blk_co_do_preadv_part(blk, offset, bytes, qiov, 0, flags); - blk_dec_in_flight(blk); - - return ret; + return blk_co_preadv_part(blk, offset, bytes, qiov, 0, flags); } int coroutine_fn blk_co_preadv_part(BlockBackend *blk, int64_t offset, -- 2.50.1 (Apple Git-155)
