[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 5/5] BlockConf: Call backend functions to det
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v3 5/5] BlockConf: Call backend functions to detect geometry and blocksizes |
Date: |
Mon, 15 Dec 2014 16:48:32 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Ekaterina Tumanova <address@hidden> writes:
> On 12/15/2014 04:50 PM, Markus Armbruster wrote:
>> Ekaterina Tumanova <address@hidden> writes:
>>
>>> 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 it's 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 <address@hidden>
>>> ---
>>> hw/block/block.c | 18 ++++++++++++++++++
>>> hw/block/hd-geometry.c | 12 ++++++++++++
>>> 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 +++--
>>> 9 files changed, 40 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/hw/block/block.c b/hw/block/block.c
>>> index a625773..9c07516 100644
>>> --- a/hw/block/block.c
>>> +++ b/hw/block/block.c
>>> @@ -25,6 +25,24 @@ void blkconf_serial(BlockConf *conf, char **serial)
>>> }
>>> }
>>>
>>> +void blkconf_blocksizes(BlockConf *conf)
>>> +{
>>> + BlockBackend *blk = conf->blk;
>>> + BlockSizes blocksizes;
>>> +
>>> + if (conf->physical_block_size && conf->logical_block_size) {
>>> + return;
>>> + }
>>
>> This conditional isn't necessary for correctness. Feel free to drop it.
>>
>
> But this allows to avoid the ioctl call when user has specified both
> values. Remove anyway?
It's device model setup, i.e. not a fast path. I'd favor simplicity and
compactness over speed there.
>>> + blk_probe_blocksizes(blk, &blocksizes);
>>> +
>>> + if (!conf->physical_block_size) {
>>> + conf->physical_block_size = blocksizes.phys;
>>> + }
>>> + if (!conf->logical_block_size) {
>>> + conf->logical_block_size = blocksizes.log;
>>> + }
>>
>
> I'll add a comment to make it apparent.
>
>> This works because you change the default block size to 0 (second to
>> last hunk).
>>
>>> +}
>>> +
>>> void blkconf_geometry(BlockConf *conf, int *ptrans,
>>> unsigned cyls_max, unsigned heads_max, unsigned
>>> secs_max,
>>> Error **errp)
[...]
[Qemu-devel] [PATCH v3 2/5] raw-posix: Factor block size detection out of raw_probe_alignment(), Ekaterina Tumanova, 2014/12/05
Re: [Qemu-devel] [PATCH v3 0/5] Geometry and blocksize detection for backing devices., Ekaterina Tumanova, 2014/12/12
Re: [Qemu-devel] [PATCH v3 0/5] Geometry and blocksize detection for backing devices., Markus Armbruster, 2014/12/15