qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [Qemu-block] [PATCH] qcow2: Use BDRV_SECTOR_BITS instea


From: Alberto Garcia
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] qcow2: Use BDRV_SECTOR_BITS instead of its literal value
Date: Mon, 09 Oct 2017 17:24:50 +0200
User-agent: Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu)

On Mon 09 Oct 2017 05:07:56 PM CEST, Max Reitz wrote:
> On 2017-10-09 16:48, Alberto Garcia wrote:
>> BDRV_SECTOR_BITS is defined to be 9 in block.h (and BDRV_SECTOR_SIZE
>> is calculated from that), but there are still a few placed where we
>> are using the literal value instead of the macro.
>> 
>> Signed-off-by: Alberto Garcia <address@hidden>
>> ---
>>  block/qcow2-cluster.c | 6 +++---
>>  block/qcow2.c         | 4 ++--
>>  2 files changed, 5 insertions(+), 5 deletions(-)
>> 
>> diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
>> index 0e5aec81cb..0a63604af6 100644
>> --- a/block/qcow2-cluster.c
>> +++ b/block/qcow2-cluster.c
>> @@ -748,8 +748,8 @@ uint64_t 
>> qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs,
>>          return 0;
>>      }
>>  
>> -    nb_csectors = ((cluster_offset + compressed_size - 1) >> 9) -
>> -                  (cluster_offset >> 9);
>> +    nb_csectors = ((cluster_offset + compressed_size - 1) >> 
>> BDRV_SECTOR_BITS) -
>> +                  (cluster_offset >> BDRV_SECTOR_BITS);
>
> I'm not sure about this one, because technically this is not the block
> layer's sector size but actually 512 bytes ("Compressed size of the
> images in sectors of 512 bytes" as per the spec).

You're right, I'll resend the patch leaving this part out for now.

Berto



reply via email to

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