qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] increase BlockConf.min_io_size type from uint16


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH] increase BlockConf.min_io_size type from uint16_t to uint32_t
Date: Wed, 02 May 2012 11:57:06 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

Am 30.04.2012 17:52, schrieb Michael Tokarev:
> This value is used currently for virtio-blk only.  It was defined
> as uint16_t before, which is the same as in kernel<=>user interface
> (in virtio_blk.h, struct virtio_blk_config).  But the problem is
> that in kernel<=>user interface the units are sectors (which is
> usually 512 bytes or more), while in qemu it is in bytes.  However,
> for, say, md raid5 arrays, it is typical to have actual min_io_size
> of a host device to be large.  For example, for raid5 device of
> 3 drives with 64Kb chunk size, that value will be 128Kb, which does
> not fit in a uint16_t anymore.
> 
> Increase the value size from 16bits to 32bits for now.
> 
> But apparently, the kernel<=>user interface needs to be fixed too
> (while it is much more difficult due to compatibility issues),
> because even with 512byte units, the 16bit value there will overflow
> too with quite normal MD RAID configuration.
> 
> Signed-off-by: Michael Tokarev <address@hidden>
> ---
>  block.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/block.h b/block.h
> index f163e54..cd5ae79 100644
> --- a/block.h
> +++ b/block.h
> @@ -425,7 +425,7 @@ typedef struct BlockConf {
>      BlockDriverState *bs;
>      uint16_t physical_block_size;
>      uint16_t logical_block_size;
> -    uint16_t min_io_size;
> +    uint32_t min_io_size;
>      uint32_t opt_io_size;
>      int32_t bootindex;
>      uint32_t discard_granularity;
> @@ -450,7 +450,7 @@ static inline unsigned int 
> get_physical_block_exp(BlockConf *conf)
>                            _conf.logical_block_size, 512),               \
>      DEFINE_PROP_BLOCKSIZE("physical_block_size", _state,                \
>                            _conf.physical_block_size, 512),              \
> -    DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0),  \
> +    DEFINE_PROP_UINT32("min_io_size", _state, _conf.min_io_size, 0),  \
>      DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0),    \
>      DEFINE_PROP_INT32("bootindex", _state, _conf.bootindex, -1),        \
>      DEFINE_PROP_UINT32("discard_granularity", _state, \

Don't you need an additional check in virtio-blk now so that you don't
overflow the 16 bit field in the virtio protocol? And I guess the same
for SCSI, where INQUIRY reports only a 16 bits sector count as well.

Kevin



reply via email to

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