On Sun, Dec 27, 2020 at 11:42 AM Peter Lieven <p...@kamp.de> wrote: > > Signed-off-by: Peter Lieven <p...@kamp.de> > --- > block/rbd.c | 10 +--------- > 1 file changed, 1 insertion(+), 9 deletions(-) > > diff --git a/block/rbd.c b/block/rbd.c > index bc8cf8af9b..a2da70e37f 100644 > --- a/block/rbd.c > +++ b/block/rbd.c > @@ -956,15 +956,7 @@ static int qemu_rbd_getinfo(BlockDriverState *bs, > BlockDriverInfo *bdi) > static int64_t qemu_rbd_getlength(BlockDriverState *bs) > { > BDRVRBDState *s = bs->opaque; > - rbd_image_info_t info; > - int r; > - > - r = rbd_stat(s->image, &info, sizeof(info)); > - if (r < 0) { > - return r; > - } > - > - return info.size; > + return s->image_size; > } > > static int coroutine_fn qemu_rbd_co_truncate(BlockDriverState *bs, > -- > 2.17.1
An RBD image can technically change size dynamically while in-use. The original code would provide the most up-to-date length but this version will always return the size of the image when it was opened. -- Jason