Am 19.04.2010 16:26, schrieb Stefan Hajnoczi:
> On Mon, Apr 19, 2010 at 3:10 PM, Kevin Wolf <kw...@redhat.com> wrote:
>>> @@ -416,9 +417,7 @@ static int bdrv_open_common(BlockDriverState *bs, const 
>>> char *filename,
>>>      }
>>>
>>>      bs->keep_read_only = bs->read_only = !(open_flags & BDRV_O_RDWR);
>>> -    if (drv->bdrv_getlength) {
>>> -        bs->total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
>>> -    }
>>> +    bs->total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
>>
>> Does this hunk make a difference? If drv->bdrv_getlength == NULL, we'll
>> just get back the current value.
> 
> The if statement could be left as is.  I removed it to reduce the
> number of places where if (drv->bdrv_getlength) is explicitly checked.
>  If callers don't know the internals of bdrv_getlength() then it is
> easier to extend it without auditing and changing callers.

Makes sense, I'm not opposed to it.

> Having said that, I did add an if (drv->bdrv_getlength) check into
> bdrv_truncate...

Well, you probably can't do much about it there.

Kevin


Reply via email to