[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 07/10] block: Use bdrv_nb_sectors() where sec
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v3 07/10] block: Use bdrv_nb_sectors() where sectors, not bytes are wanted |
Date: |
Mon, 02 Jun 2014 18:45:14 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Benoît Canet <address@hidden> writes:
> The Friday 30 May 2014 à 20:13:48 (+0200), Markus Armbruster wrote :
>> Instead of bdrv_getlength().
>>
>> Aside: a few of these callers don't handle errors. I didn't
>> investigate whether they should.
>>
>> Signed-off-by: Markus Armbruster <address@hidden>
>> Reviewed-by: Eric Blake <address@hidden>
[...]
>> diff --git a/block.c b/block.c
>> index cfeb497..8ebfb79 100644
>> --- a/block.c
>> +++ b/block.c
>> @@ -5258,13 +5258,12 @@ BdrvDirtyBitmap
>> *bdrv_create_dirty_bitmap(BlockDriverState *bs, int granularity,
>>
>> granularity >>= BDRV_SECTOR_BITS;
>> assert(granularity);
>> - bitmap_size = bdrv_getlength(bs);
>> + bitmap_size = bdrv_nb_sectors(bs);
>
> The name bitmap_size seems to imply the unit is byte.
I didn't examine how the bitmap is used. My patch doesn't change the
value put into bitmap_size.
>> if (bitmap_size < 0) {
>> error_setg_errno(errp, -bitmap_size, "could not get length of
>> device");
>> errno = -bitmap_size;
>> return NULL;
>> }
>> - bitmap_size >>= BDRV_SECTOR_BITS;
>> bitmap = g_malloc0(sizeof(BdrvDirtyBitmap));
>> bitmap->bitmap = hbitmap_alloc(bitmap_size, ffs(granularity) - 1);
>> QLIST_INSERT_HEAD(&bs->dirty_bitmaps, bitmap, list);
[...]