qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v5 5/5] BlockConf: Call backend functions to det


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v5 5/5] BlockConf: Call backend functions to detect geometry and blocksizes
Date: Fri, 2 Jan 2015 12:46:17 +0000
User-agent: Mutt/1.5.23 (2014-03-12)

On Thu, Dec 18, 2014 at 12:18:04PM +0100, Ekaterina Tumanova wrote:
> +void blkconf_blocksizes(BlockConf *conf)
> +{
> +    BlockBackend *blk = conf->blk;
> +    BlockSizes blocksizes;
> +
> +    blk_probe_blocksizes(blk, &blocksizes);
> +    /* fill in detected values if they are not defined via qemu command line 
> */
> +    if (!conf->physical_block_size) {
> +        conf->physical_block_size = blocksizes.phys;
> +    }
> +    if (!conf->logical_block_size) {
> +        conf->logical_block_size = blocksizes.log;
> +    }
> +}

Please put the 512-byte default value in this function instead of in
blk_probe_blocksizes().  That way the .bdrv_probe_blocksizes() error
return is not discarded.

It also makes .bdrv_probe_blocksizes() and .bdrv_probe_geometry() APIs
consistent with each other.  Probing geometry doesn't set default
geometry either when then block driver does not support probing.

> diff --git a/include/hw/block/block.h b/include/hw/block/block.h
> index 0d0ce9a..3e502a8 100644
> --- a/include/hw/block/block.h
> +++ b/include/hw/block/block.h
> @@ -44,9 +44,9 @@ static inline unsigned int get_physical_block_exp(BlockConf 
> *conf)
>  #define DEFINE_BLOCK_PROPERTIES(_state, _conf)                          \
>      DEFINE_PROP_DRIVE("drive", _state, _conf.blk),                      \
>      DEFINE_PROP_BLOCKSIZE("logical_block_size", _state,                 \
> -                          _conf.logical_block_size, 512),               \
> +                          _conf.logical_block_size, 0),               \
>      DEFINE_PROP_BLOCKSIZE("physical_block_size", _state,                \
> -                          _conf.physical_block_size, 512),              \
> +                          _conf.physical_block_size, 0),              \

Please drop the default parameter from the DEFINE_PROP_BLOCKSIZE() macro
since it must always be 0 now.

Attachment: pgpKzkO0C9GdM.pgp
Description: PGP signature


reply via email to

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