qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Piotr Sarna <sarna@skytechnology.pl>
To: Fam Zheng <famz@redhat.com>
Cc: qemu-devel@nongnu.org, kwolf@redhat.com, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH] block: unify blocksize types
Date: Fri, 9 Feb 2018 10:44:39 +0100	[thread overview]
Message-ID: <2a381250-2cf9-c70c-4805-fc5f0ec4823c@skytechnology.pl> (raw)
In-Reply-To: <20180209021950.GK24289@lemon.usersys.redhat.com>

On 09.02.2018 03:19, Fam Zheng wrote:
> On Thu, 02/08 14:28, Piotr Sarna wrote:
>> BlockSizes structure used in block size probing has uint32_t types
>> for logical and physical sizes. These fields are wrongfully assigned
>> to uint16_t in BlockConf, which results, among other errors,
>> in assigning 0 instead of 65536 (which will be the case in at least
>> future LizardFS block device driver among other things).
>>> This commit makes BlockConf's physical_block_size and logical_block_size > fields uint32_t to avoid inconsistencies.
>> Signed-off-by: Piotr Sarna <sarna@skytechnology.pl>
>> ---
>>   include/hw/block/block.h     | 4 ++--
>>   include/hw/qdev-properties.h | 2 +-
>>   2 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/hw/block/block.h b/include/hw/block/block.h
>> index 64b9298..c9e6e27 100644
>> --- a/include/hw/block/block.h
>> +++ b/include/hw/block/block.h
>> @@ -17,8 +17,8 @@
>>   
>>   typedef struct BlockConf {
>>       BlockBackend *blk;
>> -    uint16_t physical_block_size;
>> -    uint16_t logical_block_size;
>> +    uint32_t physical_block_size;
>> +    uint32_t logical_block_size;
>>       uint16_t min_io_size;
>>       uint32_t opt_io_size;
>>       int32_t bootindex;
>> diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
>> index 1d61a35..c68d7bf 100644
>> --- a/include/hw/qdev-properties.h
>> +++ b/include/hw/qdev-properties.h
>> @@ -210,7 +210,7 @@ extern const PropertyInfo qdev_prop_off_auto_pcibar;
>>   #define DEFINE_PROP_BIOS_CHS_TRANS(_n, _s, _f, _d) \
>>       DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_bios_chs_trans, int)
>>   #define DEFINE_PROP_BLOCKSIZE(_n, _s, _f) \
>> -    DEFINE_PROP_UNSIGNED(_n, _s, _f, 0, qdev_prop_blocksize, uint16_t)
>> +    DEFINE_PROP_UNSIGNED(_n, _s, _f, 0, qdev_prop_blocksize, uint32_t)
>>   #define DEFINE_PROP_PCI_HOST_DEVADDR(_n, _s, _f) \
>>       DEFINE_PROP(_n, _s, _f, qdev_prop_pci_host_devaddr, PCIHostDeviceAddress)
>>   #define DEFINE_PROP_MEMORY_REGION(_n, _s, _f)             \
> Do you need to update qdev_prop_blocksize and set_blocksize as well?
>
>      const PropertyInfo qdev_prop_blocksize = {
>          .name  = "uint16",
>          .description = "A power of two between 512 and 32768",
>          .get   = get_uint16,
>          .set   = set_blocksize,
>          .set_default_value = set_default_value_uint,
>      };
>
> Fam
Yes, I do, thanks - I'll prepare patch v2 today. Also, I haven't found 
any hidden dependencies on blocksize being <= 32768, so I assume 
changing the new max value to 2^31 is safe. Could somebody more familiar 
with qemu code confirm(or invalidate) my assumption?

  reply	other threads:[~2018-02-09  9:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-08 13:28 [Qemu-devel] [PATCH] block: unify blocksize types Piotr Sarna
2018-02-08 18:12 ` John Snow
2018-02-09  2:19 ` Fam Zheng
2018-02-09  9:44   ` Piotr Sarna [this message]
2018-02-09 15:11     ` Kevin Wolf
2018-02-09 20:38       ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2a381250-2cf9-c70c-4805-fc5f0ec4823c@skytechnology.pl \
    --to=sarna@skytechnology.pl \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).