qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 14/23] hw: Convert from BlockDriverState to B


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v3 14/23] hw: Convert from BlockDriverState to BlockBackend, mostly
Date: Mon, 22 Sep 2014 09:42:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Max Reitz <address@hidden> writes:

> On 16.09.2014 20:12, Markus Armbruster wrote:
>> Just four uses of BlockDriverState are left:
>>
>> * The Xen paravirtual block device backend (xen_disk.c) opens images
>>    itself when set up via xenbus, bypassing blockdev.c.  I figure it
>>    should go through qmp_blockdev_add() instead.
>>
>> * Device model "usb-storage" prompts for keys.  No other device model
>>    does, and this one probably shouldn't do it, either.
>>
>> * ide_issue_trim_cb() uses bdrv_aio_discard() instead of
>>    blk_aio_discard() because it fishes its backend out of a BlockAIOCB,
>>    which has only the BlockDriverState.
>>
>> * PC87312State has an unused BlockDriverState[] member.
>>
>> The next two commits take care of the latter two.
>>
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>>   block/block-backend.c                    | 257 
>> +++++++++++++++++++++++++++++++
>>   blockdev.c                               |  19 +--
>>   dma-helpers.c                            |  61 ++++----
>>   hw/arm/collie.c                          |   5 +-
>>   hw/arm/gumstix.c                         |   5 +-
>>   hw/arm/highbank.c                        |   2 +-
>>   hw/arm/mainstone.c                       |   2 +-
>>   hw/arm/musicpal.c                        |  10 +-
>>   hw/arm/nseries.c                         |   3 +-
>>   hw/arm/omap1.c                           |   2 +-
>>   hw/arm/omap2.c                           |   2 +-
>>   hw/arm/omap_sx1.c                        |   5 +-
>>   hw/arm/pxa2xx.c                          |   4 +-
>>   hw/arm/realview.c                        |   2 +-
>>   hw/arm/spitz.c                           |   4 +-
>>   hw/arm/tosa.c                            |   3 +-
>>   hw/arm/versatilepb.c                     |   3 +-
>>   hw/arm/vexpress.c                        |   3 +-
>>   hw/arm/xilinx_zynq.c                     |   3 +-
>>   hw/arm/z2.c                              |   3 +-
>>   hw/block/block.c                         |   7 +-
>>   hw/block/dataplane/virtio-blk.c          |  24 +--
>>   hw/block/fdc.c                           |  78 +++++-----
>>   hw/block/hd-geometry.c                   |  24 +--
>>   hw/block/m25p80.c                        |  28 ++--
>>   hw/block/nand.c                          |  50 +++---
>>   hw/block/nvme.c                          |  19 +--
>>   hw/block/onenand.c                       |  67 ++++----
>>   hw/block/pflash_cfi01.c                  |  24 +--
>>   hw/block/pflash_cfi02.c                  |  24 +--
>>   hw/block/virtio-blk.c                    |  95 ++++++------
>>   hw/block/xen_disk.c                      |  83 +++++-----
>>   hw/core/qdev-properties-system.c         |  26 ++--
>>   hw/core/qdev-properties.c                |   2 +-
>>   hw/cris/axis_dev88.c                     |   3 +-
>>   hw/display/tc6393xb.c                    |   2 +-
>>   hw/i386/pc.c                             |   2 +-
>>   hw/i386/pc_piix.c                        |   2 +-
>>   hw/i386/pc_sysfw.c                       |   9 +-
>>   hw/i386/xen/xen_platform.c               |   5 +-
>>   hw/ide/ahci.c                            |  31 ++--
>>   hw/ide/atapi.c                           |  33 ++--
>>   hw/ide/cmd646.c                          |   2 +-
>>   hw/ide/core.c                            | 186 +++++++++++-----------
>>   hw/ide/ich.c                             |   2 +-
>>   hw/ide/internal.h                        |   6 +-
>>   hw/ide/isa.c                             |   2 +-
>>   hw/ide/macio.c                           |  50 +++---
>>   hw/ide/microdrive.c                      |   4 +-
>>   hw/ide/mmio.c                            |   2 +-
>>   hw/ide/pci.c                             |   4 +-
>>   hw/ide/piix.c                            |   9 +-
>>   hw/ide/qdev.c                            |  11 +-
>>   hw/ide/via.c                             |   2 +-
>>   hw/isa/pc87312.c                         |   4 +-
>>   hw/lm32/lm32_boards.c                    |   5 +-
>>   hw/lm32/milkymist.c                      |   3 +-
>>   hw/microblaze/petalogix_ml605_mmu.c      |   3 +-
>>   hw/microblaze/petalogix_s3adsp1800_mmu.c |   3 +-
>>   hw/mips/mips_fulong2e.c                  |   2 +-
>>   hw/mips/mips_jazz.c                      |   2 +-
>>   hw/mips/mips_malta.c                     |   6 +-
>>   hw/mips/mips_r4k.c                       |   3 +-
>>   hw/nvram/spapr_nvram.c                   |  17 +-
>>   hw/pci/pci-hotplug-old.c                 |   5 +-
>>   hw/ppc/mac_newworld.c                    |   2 +-
>>   hw/ppc/mac_oldworld.c                    |   2 +-
>>   hw/ppc/ppc405_boards.c                   |  26 ++--
>>   hw/ppc/prep.c                            |   2 +-
>>   hw/ppc/spapr.c                           |   4 +-
>>   hw/ppc/virtex_ml507.c                    |   3 +-
>>   hw/s390x/s390-virtio-bus.c               |   2 +-
>>   hw/s390x/s390-virtio.c                   |   2 +-
>>   hw/s390x/virtio-ccw.c                    |   2 +-
>>   hw/scsi/megasas.c                        |  15 +-
>>   hw/scsi/scsi-bus.c                       |   8 +-
>>   hw/scsi/scsi-disk.c                      | 186 +++++++++++-----------
>>   hw/scsi/scsi-generic.c                   |  39 ++---
>>   hw/sd/milkymist-memcard.c                |   8 +-
>>   hw/sd/omap_mmc.c                         |   8 +-
>>   hw/sd/pl181.c                            |   2 +-
>>   hw/sd/pxa2xx_mmci.c                      |   4 +-
>>   hw/sd/sd.c                               |  60 ++++----
>>   hw/sd/sdhci.c                            |   2 +-
>>   hw/sd/ssi-sd.c                           |   2 +-
>>   hw/sh4/r2d.c                             |   3 +-
>>   hw/sparc/sun4m.c                         |   2 +-
>>   hw/sparc64/sun4u.c                       |   2 +-
>>   hw/tpm/tpm_tis.c                         |   2 +-
>>   hw/tricore/tricore_testboard.c           |   2 +-
>>   hw/usb/dev-storage.c                     |  17 +-
>>   hw/virtio/virtio-pci.c                   |   2 +-
>>   hw/xen/xen_devconfig.c                   |   1 +
>>   hw/xenpv/xen_machine_pv.c                |   2 +-
>>   hw/xtensa/xtfpga.c                       |   3 +-
>>   include/hw/arm/omap.h                    |   4 +-
>>   include/hw/arm/pxa.h                     |   2 +-
>>   include/hw/block/block.h                 |   6 +-
>>   include/hw/block/flash.h                 |   6 +-
>>   include/hw/qdev-properties.h             |   8 +-
>>   include/hw/scsi/scsi.h                   |   4 +-
>>   include/hw/sd.h                          |   2 +-
>>   include/hw/virtio/virtio-blk.h           |   7 +-
>>   include/qemu/typedefs.h                  |   1 +
>>   include/sysemu/block-backend.h           |  75 +++++++++
>>   include/sysemu/blockdev.h                |   5 +-
>>   include/sysemu/dma.h                     |  24 +--
>>   trace-events                             |   8 +-
>>   108 files changed, 1126 insertions(+), 810 deletions(-)
>
> [snip]
>
>> diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
>> index bcff53a..15f997b 100644
>> --- a/include/sysemu/dma.h
>> +++ b/include/sysemu/dma.h
>> @@ -197,24 +197,24 @@ void qemu_sglist_add(QEMUSGList *qsg,
>> dma_addr_t base, dma_addr_t len);
>>   void qemu_sglist_destroy(QEMUSGList *qsg);
>>   #endif
>>   -typedef BlockAIOCB *DMAIOFunc(BlockDriverState *bs, int64_t
>> sector_num,
>> -                              QEMUIOVector *iov, int nb_sectors,
>> -                              BlockCompletionFunc *cb, void *opaque);
>> +typedef BlockAIOCB *DMAIOFunc(BlockBackend *blk, int64_t sector_num,
>> +                                 QEMUIOVector *iov, int nb_sectors,
>> +                                 BlockCompletionFunc *cb, void *opaque);
>
> This breaks the alignment.

Will fix.

> There are a couple files touched by this patch where the only change
> is to replace '#include "sysemu/blockdev.h"' and '#include
> "block/block.h"' by '#include "sysemu/block-backend.h"' (in
> xen_devconfig.c you actually just add the latter and don't remove the
> former). Although I don't understand the purpose of this and it seems
> a mechanical artifact to me, it certainly won't be hurt anyone. I
> suppose it's because including block-backend.h is more correct than
> the other two (as I can read from your TODO in block-backend.h).

We want hw to use the block layer only through the BlockBackend API.
That means including block-backend-h, not blockdev.h or block.h, let
alone block_int.h.  This patch moves us a bit closer to this goal.

I'll explain in the commit message.

> Anyway, with the alignment not broken:
>
> Reviewed-by: Max Reitz <address@hidden>

Thanks!



reply via email to

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