qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/7] block/rbd: use stored image_size in qemu_rbd_getlength


From: Peter Lieven
Subject: Re: [PATCH 3/7] block/rbd: use stored image_size in qemu_rbd_getlength
Date: Thu, 14 Jan 2021 20:32:41 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Am 14.01.21 um 20:18 schrieb Jason Dillaman:
> On Sun, Dec 27, 2020 at 11:42 AM Peter Lieven <pl@kamp.de> wrote:
>> Signed-off-by: Peter Lieven <pl@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.


Agreed, but Qemu won't propagate this info to the guest unless Qemu truncate is 
called with length 0.

Anyway, if we want support this we should adjust s->image_size if the size has 
changed.


Peter






reply via email to

[Prev in Thread] Current Thread [Next in Thread]