From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>,
Public KVM Mailing List <qemu-devel@nongnu.org>
Cc: kwolf@redhat.com, thuth@linux.vnet.ibm.com, armbru@redhat.com,
mihajlov@linux.vnet.ibm.com, dahi@linux.vnet.ibm.com,
stefanha@redhat.com, cornelia.huck@de.ibm.com,
pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v6 5/5] BlockConf: Call backend functions to detect geometry and blocksizes
Date: Fri, 13 Feb 2015 13:23:55 +0100 [thread overview]
Message-ID: <54DDECDB.5000507@de.ibm.com> (raw)
In-Reply-To: <1421678101-44779-6-git-send-email-tumanova@linux.vnet.ibm.com>
Am 19.01.2015 um 15:35 schrieb Ekaterina Tumanova:
> geometry: hd_geometry_guess function autodetects the drive geometry.
> This patch adds a block backend call, that probes the backing device
> geometry. If the inner driver method is implemented and succeeds
> (currently only for DASDs), the blkconf_geometry will pass-through
> the backing device geometry. Otherwise will fallback to old logic.
>
> blocksize: This patch initializes blocksize properties to 0.
> In order to set the properly a blkconf_blocksizes was introduced.
> If user didn't set physical or logical blocksize, it will
> retrieve its value from a driver (which will return a default 512 for
> any backend but DASD).
>
> The blkconf_blocksizes call was added to all users of BlkConf.
>
> Signed-off-by: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
> ---
> hw/block/block.c | 20 ++++++++++++++++++++
> hw/block/hd-geometry.c | 10 +++++++++-
> hw/block/nvme.c | 1 +
> hw/block/virtio-blk.c | 1 +
> hw/core/qdev-properties.c | 3 ++-
> hw/ide/qdev.c | 1 +
> hw/scsi/scsi-disk.c | 1 +
> hw/usb/dev-storage.c | 1 +
> include/hw/block/block.h | 5 +++--
> include/hw/qdev-properties.h | 4 ++--
> 10 files changed, 41 insertions(+), 6 deletions(-)
>
> diff --git a/hw/block/block.c b/hw/block/block.c
> index a625773..09dd5f1 100644
> --- a/hw/block/block.c
> +++ b/hw/block/block.c
> @@ -25,6 +25,26 @@ void blkconf_serial(BlockConf *conf, char **serial)
> }
> }
>
> +void blkconf_blocksizes(BlockConf *conf)
> +{
> + BlockBackend *blk = conf->blk;
> + BlockSizes blocksizes;
> + int backend_ret;
> +
> + backend_ret = blk_probe_blocksizes(blk, &blocksizes);
> + /* fill in detected values if they are not defined via qemu command line */
> + if (!conf->physical_block_size && !backend_ret) {
> + conf->physical_block_size = blocksizes.phys;
> + } else {
> + conf->physical_block_size = BDRV_SECTOR_SIZE;
> + }
> + if (!conf->logical_block_size && !backend_ret) {
> + conf->logical_block_size = blocksizes.log;
> + } else {
> + conf->logical_block_size = BDRV_SECTOR_SIZE;
> + }
When we are going to fix this, I found another bug:
This code will fail when logical_block_size and physical_block_size are given at the command line AND detection (backend_ret != 0) did not work. It will use BDRV_SECTOR_SIZE instead of the command line value.
With something like
--- a/hw/block/block.c
+++ b/hw/block/block.c
@@ -33,15 +33,19 @@ void blkconf_blocksizes(BlockConf *conf)
backend_ret = blk_probe_blocksizes(blk, &blocksizes);
/* fill in detected values if they are not defined via qemu command line */
- if (!conf->physical_block_size && !backend_ret) {
- conf->physical_block_size = blocksizes.phys;
- } else {
- conf->physical_block_size = BDRV_SECTOR_SIZE;
+ if (!conf->physical_block_size) {
+ if (!backend_ret) {
+ conf->physical_block_size = blocksizes.phys;
+ } else {
+ conf->physical_block_size = BDRV_SECTOR_SIZE;
+ }
}
- if (!conf->logical_block_size && !backend_ret) {
- conf->logical_block_size = blocksizes.log;
- } else {
- conf->logical_block_size = BDRV_SECTOR_SIZE;
+ if (!conf->logical_block_size) {
+ if (!backend_ret) {
+ conf->logical_block_size = blocksizes.log;
+ } else {
+ conf->logical_block_size = BDRV_SECTOR_SIZE;
+ }
}
}
No?
next prev parent reply other threads:[~2015-02-13 12:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-19 14:34 [Qemu-devel] [PATCH v6 0/5] Geometry and blocksize detection for backing devices Ekaterina Tumanova
2015-01-19 14:34 ` [Qemu-devel] [PATCH v6 1/5] block: add bdrv functions for geometry and blocksize Ekaterina Tumanova
2015-01-19 14:34 ` [Qemu-devel] [PATCH v6 2/5] raw-posix: Factor block size detection out of raw_probe_alignment() Ekaterina Tumanova
2015-01-19 14:34 ` [Qemu-devel] [PATCH v6 3/5] block: Add driver methods to probe blocksizes and geometry Ekaterina Tumanova
2015-01-19 14:35 ` [Qemu-devel] [PATCH v6 4/5] block-backend: Add wrappers for blocksizes and geometry probing Ekaterina Tumanova
2015-01-19 14:35 ` [Qemu-devel] [PATCH v6 5/5] BlockConf: Call backend functions to detect geometry and blocksizes Ekaterina Tumanova
2015-02-13 12:23 ` Christian Borntraeger [this message]
2015-02-13 12:28 ` Ekaterina Tumanova
2015-01-22 14:36 ` [Qemu-devel] [PATCH v6 0/5] Geometry and blocksize detection for backing devices Christian Borntraeger
2015-02-04 13:13 ` Ekaterina Tumanova
2015-02-05 14:48 ` Stefan Hajnoczi
2015-02-12 15:46 ` Stefan Hajnoczi
2015-02-12 16:42 ` Christian Borntraeger
2015-02-12 17:33 ` Christian Borntraeger
2015-02-13 7:50 ` Kevin Wolf
2015-02-13 8:05 ` Christian Borntraeger
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=54DDECDB.5000507@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=armbru@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=dahi@linux.vnet.ibm.com \
--cc=kwolf@redhat.com \
--cc=mihajlov@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=thuth@linux.vnet.ibm.com \
--cc=tumanova@linux.vnet.ibm.com \
/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).