Am 23.11.2022 um 12:42 hat Emanuele Giuseppe Esposito geschrieben: > Avoid mixing bdrv_* functions with blk_*, so create blk_* counterparts > for bdrv_block_status_above and bdrv_is_allocated_above. > > Note that since bdrv_block_status_above only calls the g_c_w function > bdrv_common_block_status_above and is marked as coroutine_fn, call > directly bdrv_co_common_block_status_above() to avoid using a g_c_w.
This sentence is a bit confusing, because it talks about the blk_* side of things, but doesn't mention it at all. The same argument is true for is_allocated. > Signed-off-by: Emanuele Giuseppe Esposito <eespo...@redhat.com> > Reviewed-by: Paolo Bonzini <pbonz...@redhat.com> > --- > block/block-backend.c | 21 ++++++++++++++++++++ > block/commit.c | 4 ++-- > include/sysemu/block-backend-io.h | 9 +++++++++ > nbd/server.c | 32 +++++++++++++++---------------- > 4 files changed, 48 insertions(+), 18 deletions(-) > > diff --git a/block/block-backend.c b/block/block-backend.c > index 742efa7955..03bed68e4f 100644 > --- a/block/block-backend.c > +++ b/block/block-backend.c > @@ -1424,6 +1424,27 @@ int coroutine_fn blk_co_pwritev(BlockBackend *blk, > int64_t offset, > return blk_co_pwritev_part(blk, offset, bytes, qiov, 0, flags); > } > > +int coroutine_fn blk_co_block_status_above(BlockBackend *blk, > + BlockDriverState *base, > + int64_t offset, int64_t bytes, > + int64_t *pnum, int64_t *map, > + BlockDriverState **file) > +{ > + IO_CODE(); > + return bdrv_co_block_status_above(blk_bs(blk), base, offset, bytes, pnum, > + map, file); > +} > + > +int coroutine_fn blk_is_allocated_above(BlockBackend *blk, Any reason why you renamed only blk_co_block_status_above(), but not this one into blk_co_is_allocated_above()? > + BlockDriverState *base, > + bool include_base, int64_t offset, > + int64_t bytes, int64_t *pnum) > +{ > + IO_CODE(); > + return bdrv_co_is_allocated_above(blk_bs(blk), base, include_base, > offset, > + bytes, pnum); > +} Kevin