Block patches
The following changes since commit 10601bef566461efbea81ee344ed3355ce71954a:
Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-signed' into staging (2014-09-09 15:08:05 +0100)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to 0e4271b711a8ea766d29824c844e268b91ac3ae5:
qcow2: Add falloc and full preallocation option (2014-09-12 15:43:06 +0200)
----------------------------------------------------------------
Block patches
----------------------------------------------------------------
Benoît Canet (4):
block: Extract the BlockAcctStats structure
block: Extract the block accounting code
block: rename BlockAcctType members to start with BLOCK_ instead of BDRV_
block: Make the block accounting functions operate on BlockAcctStats
Chrysostomos Nanakos (2):
block/archipelago: Implement bdrv_truncate()
qemu-iotests: Run 025 for Archipelago block driver
Hu Tao (5):
block: round up file size to nearest sector
block: don't convert file size to sector size
qapi: introduce PreallocMode and new PreallocModes full and falloc.
raw-posix: Add falloc and full preallocation option
qcow2: Add falloc and full preallocation option
Luiz Capitulino (2):
block: extend BLOCK_IO_ERROR event with nospace indicator
block: extend BLOCK_IO_ERROR with reason string
Markus Armbruster (5):
qemu-io: Clean up openfile() after commit 2e40134
xen_disk: Plug memory leak on error path
xen: Drop redundant bdrv_close() from pci_piix3_xen_ide_unplug()
thread-pool: Drop unnecessary includes
blockdev: Refuse to drive_del something added with blockdev-add
Stefan Hajnoczi (1):
dataplane: fix virtio_blk_data_plane_create() op blocker error path
Stratos Psomadakis (1):
iotests: Send the correct fd in socket_scm_helper
Valentin Manea (1):
IDE: MMIO IDE device control should be little endian
Xiaodong Gong (1):
Fix improper usage of cpu_to_be32 in vpc
block.c | 60 +++++++++---------- block/Makefile.objs | 1 + block/accounting.c | 54 +++++++++++++++++ block/archipelago.c | 66 ++++++++++++++++++++- block/cow.c | 3 +- block/gluster.c | 9 ++- block/iscsi.c | 4 +- block/nfs.c | 3 +- block/qapi.c | 19 +++--- block/qcow.c | 7 ++- block/qcow2.c | 82 +++++++++++++++++++++----- block/qed.c | 3 +- block/raw-posix.c | 102 +++++++++++++++++++++++++-------- block/raw-win32.c | 6 +- block/rbd.c | 3 +- block/sheepdog.c | 3 +- block/ssh.c | 3 +- block/vdi.c | 3 +- block/vhdx.c | 3 +- block/vmdk.c | 3 +- block/vpc.c | 11 ++-- blockdev.c | 10 +++- dma-helpers.c | 2 +- hw/block/dataplane/virtio-blk.c | 4 +- hw/block/nvme.c | 4 +- hw/block/virtio-blk.c | 15 +++-- hw/block/xen_disk.c | 39 ++++++------- hw/ide/ahci.c | 7 ++- hw/ide/atapi.c | 18 +++--- hw/ide/core.c | 24 ++++---- hw/ide/macio.c | 19 +++--- hw/ide/mmio.c | 4 +- hw/ide/piix.c | 1 - hw/scsi/scsi-disk.c | 45 +++++++++------ include/block/accounting.h | 57 ++++++++++++++++++ include/block/block.h | 20 +------ include/block/block_int.h | 6 +- include/block/thread-pool.h | 6 +- include/hw/virtio/virtio-blk.h | 1 + include/sysemu/dma.h | 1 + qapi/block-core.json | 30 +++++++++- qemu-doc.texi | 17 +++++- qemu-img.texi | 17 +++++- qemu-io.c | 36 +++++------- tests/qemu-iotests/025 | 2 +- tests/qemu-iotests/049.out | 2 +- tests/qemu-iotests/082.out | 54 ++++++++--------- tests/qemu-iotests/104 | 57 ++++++++++++++++++ tests/qemu-iotests/104.out | 12 ++++ tests/qemu-iotests/common.filter | 21 +++++++ tests/qemu-iotests/group | 1 + tests/qemu-iotests/socket_scm_helper.c | 2 +- thread-pool.c | 1 - 53 files changed, 704 insertions(+), 279 deletions(-) create mode 100644 block/accounting.c create mode 100644 include/block/accounting.h create mode 100755 tests/qemu-iotests/104 create mode 100644 tests/qemu-iotests/104.out
[Qemu-devel] [PULL 02/22] Fix improper usage of cpu_to_be32 in vpc
From: Xiaodong Gong <[email protected]>
cpu_to_be32() is wrong since vhd_type is an enum constant (just a regular CPU-endian integer).
--- block/vpc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
block/vpc.c +4 -4
@@ -489,7 +489,7 @@ static int vpc_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)BDRVVPCState *s = (BDRVVPCState *)bs->opaque;VHDFooter *footer = (VHDFooter *) s->footer_buf; -if (cpu_to_be32 (footer->type) !=VHD_FIXED ) { +if (be32_to_cpu (footer->type) !=VHD_FIXED ) { bdi->cluster_size = s->block_size; }
@@ -506,7 +506,7 @@ static int vpc_read(BlockDriverState *bs, int64_t sector_num,int64_t sectors, sectors_per_block;VHDFooter *footer = (VHDFooter *) s->footer_buf; -if (cpu_to_be32 (footer->type) ==VHD_FIXED ) { +if (be32_to_cpu (footer->type) ==VHD_FIXED ) {return bdrv_read (bs->file, sector_num, buf, nb_sectors); }while (nb_sectors >0 ) {
@@ -555,7 +555,7 @@ static int vpc_write(BlockDriverState *bs, int64_t sector_num,int ret;VHDFooter *footer = (VHDFooter *) s->footer_buf; -if (cpu_to_be32 (footer->type) ==VHD_FIXED ) { +if (be32_to_cpu (footer->type) ==VHD_FIXED ) {return bdrv_write (bs->file, sector_num, buf, nb_sectors); }while (nb_sectors >0 ) {
@@ -857,7 +857,7 @@ static int vpc_has_zero_init(BlockDriverState *bs)BDRVVPCState *s = bs->opaque;VHDFooter *footer = (VHDFooter *) s->footer_buf; -if (cpu_to_be32 (footer->type) ==VHD_FIXED ) { +if (be32_to_cpu (footer->type) ==VHD_FIXED ) {return bdrv_has_zero_init (bs->file); }else {return 1 ;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 03/22] qemu-io: Clean up openfile() after commit 2e40134
In reply to Kevin WolfFrom: Markus Armbruster <[email protected]>
Commit 6db9560 split off the growable case so it can use bdrv_file_open() instead of bdrv_open() then. Growable BDSes become anonymous. Weird.
Commit 2e40134 folded bdrv_file_open() back into bdrv_open() with new flag BDRV_O_PROTOCOL. We still have two bdrv_open() calls, and growable BDSes remain anonymous.
Circle back to before commit 6db9560: just one call, not anonymous.
--- qemu-io.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-)
qemu-io.c +13 -23
@@ -58,30 +58,20 @@ static int openfile(char *name, int flags, int growable, QDict *opts)return 1 ; } + qemuio_bs =bdrv_new ("hda" , &error_abort); +if (growable) { -if (bdrv_open (&qemuio_bs, name,NULL , opts, flags |BDRV_O_PROTOCOL , -NULL , &local_err)) - { -fprintf (stderr,"%s: can't open%s%s: %s\n" , progname, - name ?" device " :"" , name ?:"" , -error_get_pretty (local_err)); -error_free (local_err); -return 1 ; - } - }else { - qemuio_bs =bdrv_new ("hda" , &error_abort); - -if (bdrv_open (&qemuio_bs, name,NULL , opts, flags,NULL , &local_err) - <0 ) - { -fprintf (stderr,"%s: can't open%s%s: %s\n" , progname, - name ?" device " :"" , name ?:"" , -error_get_pretty (local_err)); -error_free (local_err); -bdrv_unref (qemuio_bs); - qemuio_bs =NULL ; -return 1 ; - } + flags |=BDRV_O_PROTOCOL ; + } + +if (bdrv_open (&qemuio_bs, name,NULL , opts, flags,NULL , &local_err) <0 ) { +fprintf (stderr,"%s: can't open%s%s: %s\n" , progname, + name ?" device " :"" , name ?:"" , +error_get_pretty (local_err)); +error_free (local_err); +bdrv_unref (qemuio_bs); + qemuio_bs =NULL ; +return 1 ; }return 0 ;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 04/22] xen_disk: Plug memory leak on error path
In reply to Kevin WolfFrom: Markus Armbruster <[email protected]>
The Error object was leaked after failed bdrv_new(). While there, streamline control flow a bit.
--- hw/block/xen_disk.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-)
hw/block/xen_disk.c +14 -17
@@ -852,28 +852,25 @@ static int blk_connect(struct XenDevice *xendev) blkdev->dinfo =drive_get (IF_XEN ,0 , index);if (!blkdev->dinfo) {Error *local_err =NULL ; +BlockDriver *drv; +/* setup via xenbus -> create new block driver instance */ xen_be_printf (&blkdev->xendev,2 ,"create new bdrv (xenbus setup)\n" ); - blkdev->bs =bdrv_new (blkdev->dev, &local_err); -if (local_err) { - blkdev->bs =NULL ; - } -if (blkdev->bs) { -BlockDriver *drv =bdrv_find_whitelisted_format (blkdev->fileproto, - readonly); -if (bdrv_open (&blkdev->bs, blkdev->filename,NULL ,NULL , qflags, - drv, &local_err) !=0 ) - { -xen_be_printf (&blkdev->xendev,0 ,"error: %s\n" , -error_get_pretty (local_err)); -error_free (local_err); -bdrv_unref (blkdev->bs); - blkdev->bs =NULL ; - } - } + blkdev->bs =bdrv_new (blkdev->dev,NULL );if (!blkdev->bs) {return -1 ; } + + drv =bdrv_find_whitelisted_format (blkdev->fileproto, readonly); +if (bdrv_open (&blkdev->bs, blkdev->filename,NULL ,NULL , qflags, + drv, &local_err) !=0 ) { +xen_be_printf (&blkdev->xendev,0 ,"error: %s\n" , +error_get_pretty (local_err)); +error_free (local_err); +bdrv_unref (blkdev->bs); + blkdev->bs =NULL ; +return -1 ; + } }else {/* setup via qemu cmdline -> already setup for us */ xen_be_printf (&blkdev->xendev,2 ,"get configured bdrv (cmdline setup)\n" );
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 05/22] xen: Drop redundant bdrv_close() from pci_piix3_xen_ide_unplug()
In reply to Kevin WolfFrom: Markus Armbruster <[email protected]>
drive_del() closes just fine.
--- hw/ide/piix.c | 1 - 1 file changed, 1 deletion(-)
hw/ide/piix.c +0 -1
@@ -182,7 +182,6 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev)if (ds) {bdrv_detach_dev (di->bdrv, ds); } -bdrv_close (di->bdrv); pci_ide->bus[di->bus].ifs[di->unit].bs =NULL ;drive_del (di); }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 09/22] block: Extract the block accounting code
In reply to Kevin WolfFrom: Benoît Canet <[email protected]>
The plan is to add new accounting metrics (latency, invalid requests, failed requests, queue depth) and block.c is overpopulated so it will be better to work in a separate module.
Moreover the long term plan is to have statistics in each of the BDS of the graph for metrology purpose; this means that the device model statistics must move from the topmost BDS to the device model.
So we need to decouple the statistic code from BlockDriverState.
This is another argument for the extraction of the code in a separate module.
--- block.c | 27 ++------------------ block/Makefile.objs | 1 + block/accounting.c | 57 ++++++++++++++++++++++++++++++++++++++++++ include/block/accounting.h | 57 ++++++++++++++++++++++++++++++++++++++++++ include/block/block.h | 24 ------------------ include/block/block_int.h | 1 + include/hw/virtio/virtio-blk.h | 1 + include/sysemu/dma.h | 1 + 8 files changed, 120 insertions(+), 49 deletions(-) create mode 100644 block/accounting.c create mode 100644 include/block/accounting.h
block.c +2 -25
@@ -3363,9 +3363,8 @@ static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs,bdrv_set_dirty (bs, sector_num, nb_sectors); -if (bs->stats.wr_highest_sector < sector_num + nb_sectors -1 ) { - bs->stats.wr_highest_sector = sector_num + nb_sectors -1 ; - } +bdrv_acct_highest_sector (bs, sector_num, nb_sectors); +if (bs->growable && ret >=0 ) { bs->total_sectors =MAX (bs->total_sectors, sector_num + nb_sectors); }
@@ -5572,28 +5571,6 @@ void bdrv_iostatus_set_err(BlockDriverState *bs, int error) } } -void -bdrv_acct_start (BlockDriverState *bs,BlockAcctCookie *cookie,int64_t bytes, -enum BlockAcctType type) -{ -assert (type <BDRV_MAX_IOTYPE ); - - cookie->bytes = bytes; - cookie->start_time_ns =get_clock (); - cookie->type = type; -} - -void -bdrv_acct_done (BlockDriverState *bs,BlockAcctCookie *cookie) -{ -assert (cookie->type <BDRV_MAX_IOTYPE ); - - bs->stats.nr_bytes[cookie->type] += cookie->bytes; - bs->stats.nr_ops[cookie->type]++; - bs->stats.total_time_ns[cookie->type] +=get_clock () - - cookie->start_time_ns; -} - void bdrv_img_create(const char *filename, const char *fmt, const char *base_filename, const char *base_fmt, char *options, uint64_t img_size, int flags,
block/Makefile.objs +1 -0
@@ -18,6 +18,7 @@ block-obj-$(CONFIG_RBD) += rbd.o block-obj-$(CONFIG_GLUSTERFS) += gluster.o block-obj-$(CONFIG_ARCHIPELAGO) += archipelago.o block-obj-$(CONFIG_LIBSSH2) += ssh.o +block-obj-y += accounting.o common-obj-y += stream.o common-obj-y += commit.o
block/accounting.c new file +57 -0
57 lines not on this page · raw message
include/block/accounting.h new file +57 -0
57 lines not on this page · raw message
include/block/block.h +0 -24
@@ -485,30 +485,6 @@ void bdrv_op_block_all(BlockDriverState *bs, Error *reason);void bdrv_op_unblock_all (BlockDriverState *bs,Error *reason);bool bdrv_op_blocker_is_empty (BlockDriverState *bs); -enum BlockAcctType { -BDRV_ACCT_READ , -BDRV_ACCT_WRITE , -BDRV_ACCT_FLUSH , -BDRV_MAX_IOTYPE , -}; - -typedef struct BlockAcctStats { -uint64_t nr_bytes[BDRV_MAX_IOTYPE ]; -uint64_t nr_ops[BDRV_MAX_IOTYPE ]; -uint64_t total_time_ns[BDRV_MAX_IOTYPE ]; -uint64_t wr_highest_sector; -}BlockAcctStats ; - -typedef struct BlockAcctCookie { -int64_t bytes; -int64_t start_time_ns; -enum BlockAcctType type; -}BlockAcctCookie ; - -void bdrv_acct_start (BlockDriverState *bs,BlockAcctCookie *cookie, -int64_t bytes,enum BlockAcctType type); -void bdrv_acct_done (BlockDriverState *bs,BlockAcctCookie *cookie); - typedef enum { BLKDBG_L1_UPDATE,
include/block/block_int.h +1 -0
@@ -24,6 +24,7 @@#ifndef BLOCK_INT_H #define BLOCK_INT_H +#include "block/accounting.h" #include "block/block.h" #include "qemu/option.h" #include "qemu/queue.h"
include/hw/virtio/virtio-blk.h +1 -0
@@ -18,6 +18,7 @@#include "hw/block/block.h" #include "sysemu/iothread.h" #include "block/block.h" +#include "block/accounting.h" #define TYPE_VIRTIO_BLK "virtio-blk-device"#define VIRTIO_BLK (obj) \
include/sysemu/dma.h +1 -0
@@ -15,6 +15,7 @@#include "exec/address-spaces.h" #include "hw/hw.h" #include "block/block.h" +#include "block/accounting.h" #include "sysemu/kvm.h" typedef struct ScatterGatherEntry ScatterGatherEntry ;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 01/22] block: extend BLOCK_IO_ERROR event with nospace indicator
In reply to Kevin WolfFrom: Luiz Capitulino <[email protected]>
Management software, such as RHEV's vdsm, want to be able to allocate disk space on demand. The basic use case is to start a VM with a small disk and then the disk is enlarged when QEMU hits a ENOSPC condition.
To this end, the management software has to be notified when QEMU encounters ENOSPC. The solution implemented by this commit is simple:
it extends the BLOCK_IO_ERROR with a 'nospace' key, which is true when QEMU is stopped due to ENOSPC.
Note that support for querying this event is already present in query-block by means of the 'io-status' key. Also, the new 'nospace' BLOCK_IO_ERROR field shares the same semantics with 'io-status', which basically means that werror= has to be set to either 'stop' or 'enospc' to enable 'nospace'.
Finally, this commit also updates the 'io-status' key doc in the schema with a list of supported device models.
--- block.c | 22 ++++++++++++++-------- qapi/block-core.json | 8 +++++++- 2 files changed, 21 insertions(+), 9 deletions(-)
block.c +14 -8
@@ -3639,6 +3639,18 @@ BlockErrorAction bdrv_get_error_action(BlockDriverState *bs, bool is_read, int e } } +static void send_qmp_error_event (BlockDriverState *bs, +BlockErrorAction action, +bool is_read,int error) +{ +BlockErrorAction ac; + + ac = is_read ?IO_OPERATION_TYPE_READ :IO_OPERATION_TYPE_WRITE ; +qapi_event_send_block_io_error (bdrv_get_device_name (bs), ac, action, +bdrv_iostatus_is_enabled (bs), + error ==ENOSPC , &error_abort); +} +/* This is done by device models because, while the block layer knows * about the error, it does not know whether an operation comes from * the device or the block layer (from a job, for example).
@@ -3664,16 +3676,10 @@ void bdrv_error_action(BlockDriverState *bs, BlockErrorAction action,* also ensures that the STOP/RESUME pair of events is emitted. */ qemu_system_vmstop_request_prepare (); -qapi_event_send_block_io_error (bdrv_get_device_name (bs), - is_read ?IO_OPERATION_TYPE_READ : -IO_OPERATION_TYPE_WRITE , - action, &error_abort); +send_qmp_error_event (bs, action, is_read, error);qemu_system_vmstop_request (RUN_STATE_IO_ERROR ); }else { -qapi_event_send_block_io_error (bdrv_get_device_name (bs), - is_read ?IO_OPERATION_TYPE_READ : -IO_OPERATION_TYPE_WRITE , - action, &error_abort); +send_qmp_error_event (bs, action, is_read, error); } }
qapi/block-core.json +7 -1
@@ -336,6 +336,7 @@ # # @io-status: #optional @BlockDeviceIoStatus. Only present if the device # supports it and the VM is configured to stop on errors +# (supported device models: virtio-blk, ide, scsi-disk) # # @inserted: #optional @BlockDeviceInfo describing the device if media is # present
@@ -1587,6 +1588,11 @@ # # @action: action that has been taken # +# @nospace: #optional true if I/O error was caused due to a no-space +# condition. This key is only present if query-block's +# io-status is present, please see query-block documentation +# for more information (since: 2.2) +# # Note: If action is "stop", a STOP event will eventually follow the # BLOCK_IO_ERROR event #
@@ -1594,7 +1600,7 @@ ## { 'event': 'BLOCK_IO_ERROR', 'data': { 'device': 'str', 'operation': 'IoOperationType', - 'action': 'BlockErrorAction' } } + 'action': 'BlockErrorAction', '*nospace': 'bool' } } ## # @BLOCK_JOB_COMPLETED
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 07/22] IDE: MMIO IDE device control should be little endian
In reply to Kevin WolfFrom: Valentin Manea <[email protected]>
Set the IDE MMIO memory type to little endian. The ATA specs identify words part of the control commands encoded as little endian. While this has no impact on little endian systems, it's required for big endian systems(eg OpenRisc).
--- hw/ide/mmio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ide/mmio.c +2 -2
@@ -82,7 +82,7 @@ static void mmio_ide_write(void *opaque, hwaddr addr,static const MemoryRegionOps mmio_ide_ops = { .read = mmio_ide_read, .write = mmio_ide_write, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_LITTLE_ENDIAN , }; static uint64_t mmio_ide_status_read(void *opaque, hwaddr addr,
@@ -102,7 +102,7 @@ static void mmio_ide_cmd_write(void *opaque, hwaddr addr,static const MemoryRegionOps mmio_ide_cs_ops = { .read = mmio_ide_status_read, .write = mmio_ide_cmd_write, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_LITTLE_ENDIAN , };static const VMStateDescription vmstate_ide_mmio = {
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 10/22] block: rename BlockAcctType members to start with BLOCK_ instead of BDRV_
In reply to Kevin WolfFrom: Benoît Canet <[email protected]>
The middle term goal is to move the BlockAcctStats structure in the device models. (Capturing I/O accounting statistics in the device models is good for billing) This patch make a small step in this direction by removing a reference to BDRV.
--- block/accounting.c | 4 ++-- block/qapi.c | 16 ++++++++-------- hw/block/nvme.c | 2 +- hw/block/virtio-blk.c | 6 +++--- hw/block/xen_disk.c | 6 ++++-- hw/ide/ahci.c | 4 ++-- hw/ide/atapi.c | 8 ++++---- hw/ide/core.c | 10 +++++----- hw/ide/macio.c | 8 ++++---- hw/scsi/scsi-disk.c | 28 ++++++++++++++++------------ include/block/accounting.h | 14 +++++++------- 11 files changed, 56 insertions(+), 50 deletions(-)
block/accounting.c +2 -2
@@ -29,7 +29,7 @@ void bdrv_acct_start(BlockDriverState *bs, BlockAcctCookie *cookie, int64_t bytes, enum BlockAcctType type) { -assert (type <BDRV_MAX_IOTYPE ); +assert (type <BLOCK_MAX_IOTYPE ); cookie->bytes = bytes; cookie->start_time_ns =get_clock ();
@@ -39,7 +39,7 @@ bdrv_acct_start(BlockDriverState *bs, BlockAcctCookie *cookie, int64_t bytes,void bdrv_acct_done (BlockDriverState *bs,BlockAcctCookie *cookie) { -assert (cookie->type <BDRV_MAX_IOTYPE ); +assert (cookie->type <BLOCK_MAX_IOTYPE ); bs->stats.nr_bytes[cookie->type] += cookie->bytes; bs->stats.nr_ops[cookie->type]++;
block/qapi.c +8 -8
@@ -333,16 +333,16 @@ static BlockStats *bdrv_query_stats(const BlockDriverState *bs) } s->stats =g_malloc0 (sizeof (*s->stats)); - s->stats->rd_bytes = bs->stats.nr_bytes[BDRV_ACCT_READ ]; - s->stats->wr_bytes = bs->stats.nr_bytes[BDRV_ACCT_WRITE ]; - s->stats->rd_operations = bs->stats.nr_ops[BDRV_ACCT_READ ]; - s->stats->wr_operations = bs->stats.nr_ops[BDRV_ACCT_WRITE ]; + s->stats->rd_bytes = bs->stats.nr_bytes[BLOCK_ACCT_READ ]; + s->stats->wr_bytes = bs->stats.nr_bytes[BLOCK_ACCT_WRITE ]; + s->stats->rd_operations = bs->stats.nr_ops[BLOCK_ACCT_READ ]; + s->stats->wr_operations = bs->stats.nr_ops[BLOCK_ACCT_WRITE ]; s->stats->wr_highest_offset = bs->stats.wr_highest_sector *BDRV_SECTOR_SIZE ; - s->stats->flush_operations = bs->stats.nr_ops[BDRV_ACCT_FLUSH ]; - s->stats->wr_total_time_ns = bs->stats.total_time_ns[BDRV_ACCT_WRITE ]; - s->stats->rd_total_time_ns = bs->stats.total_time_ns[BDRV_ACCT_READ ]; - s->stats->flush_total_time_ns = bs->stats.total_time_ns[BDRV_ACCT_FLUSH ]; + s->stats->flush_operations = bs->stats.nr_ops[BLOCK_ACCT_FLUSH ]; + s->stats->wr_total_time_ns = bs->stats.total_time_ns[BLOCK_ACCT_WRITE ]; + s->stats->rd_total_time_ns = bs->stats.total_time_ns[BLOCK_ACCT_READ ]; + s->stats->flush_total_time_ns = bs->stats.total_time_ns[BLOCK_ACCT_FLUSH ];if (bs->file) { s->has_parent = true;
hw/block/nvme.c +1 -1
@@ -232,7 +232,7 @@ static uint16_t nvme_rw(NvmeCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd,assert ((nlb << data_shift) == req->qsg.size);dma_acct_start (n->conf.bs, &req->acct, &req->qsg, is_write ? -BDRV_ACCT_WRITE :BDRV_ACCT_READ ); +BLOCK_ACCT_WRITE :BLOCK_ACCT_READ ); req->aiocb = is_write ?dma_bdrv_write (n->conf.bs, &req->qsg, aio_slba, nvme_rw_cb, req) :dma_bdrv_read (n->conf.bs, &req->qsg, aio_slba, nvme_rw_cb, req);
hw/block/virtio-blk.c +3 -3
@@ -279,7 +279,7 @@ void virtio_submit_multiwrite(BlockDriverState *bs, MultiReqBuffer *mrb)static void virtio_blk_handle_flush (VirtIOBlockReq *req,MultiReqBuffer *mrb) { -bdrv_acct_start (req->dev->bs, &req->acct,0 ,BDRV_ACCT_FLUSH ); +bdrv_acct_start (req->dev->bs, &req->acct,0 ,BLOCK_ACCT_FLUSH );/* * Make sure all outstanding writes are posted to the backing device.
@@ -322,7 +322,7 @@ static void virtio_blk_handle_write(VirtIOBlockReq *req, MultiReqBuffer *mrb)return ; } -bdrv_acct_start (req->dev->bs, &req->acct, req->qiov.size,BDRV_ACCT_WRITE ); +bdrv_acct_start (req->dev->bs, &req->acct, req->qiov.size,BLOCK_ACCT_WRITE );if (mrb->num_writes ==32 ) {virtio_submit_multiwrite (req->dev->bs, mrb);
@@ -353,7 +353,7 @@ static void virtio_blk_handle_read(VirtIOBlockReq *req)return ; } -bdrv_acct_start (req->dev->bs, &req->acct, req->qiov.size,BDRV_ACCT_READ ); +bdrv_acct_start (req->dev->bs, &req->acct, req->qiov.size,BLOCK_ACCT_READ );bdrv_aio_readv (req->dev->bs, sector, &req->qiov, req->qiov.size /BDRV_SECTOR_SIZE , virtio_blk_rw_complete, req);
hw/block/xen_disk.c +4 -2
@@ -518,7 +518,8 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq)switch (ioreq->req.operation) {case BLKIF_OP_READ : -bdrv_acct_start (blkdev->bs, &ioreq->acct, ioreq->v.size,BDRV_ACCT_READ ); +bdrv_acct_start (blkdev->bs, &ioreq->acct, ioreq->v.size, +BLOCK_ACCT_READ ); ioreq->aio_inflight++; bdrv_aio_readv(blkdev->bs, ioreq->start / BLOCK_SIZE, &ioreq->v, ioreq->v.size / BLOCK_SIZE,
@@ -530,7 +531,8 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq)break ; } -bdrv_acct_start (blkdev->bs, &ioreq->acct, ioreq->v.size,BDRV_ACCT_WRITE ); +bdrv_acct_start (blkdev->bs, &ioreq->acct, ioreq->v.size, +BLOCK_ACCT_WRITE ); ioreq->aio_inflight++; bdrv_aio_writev(blkdev->bs, ioreq->start / BLOCK_SIZE, &ioreq->v, ioreq->v.size / BLOCK_SIZE,
hw/ide/ahci.c +2 -2
@@ -860,7 +860,7 @@ static void process_ncq_command(AHCIState *s, int port, uint8_t *cmd_fis, ncq_tfs->tag, ncq_tfs->lba);dma_acct_start (ncq_tfs->drive->port.ifs[0 ].bs, &ncq_tfs->acct, - &ncq_tfs->sglist,BDRV_ACCT_READ ); + &ncq_tfs->sglist,BLOCK_ACCT_READ ); ncq_tfs->aiocb =dma_bdrv_read (ncq_tfs->drive->port.ifs[0 ].bs, &ncq_tfs->sglist, ncq_tfs->lba, ncq_cb, ncq_tfs);
@@ -873,7 +873,7 @@ static void process_ncq_command(AHCIState *s, int port, uint8_t *cmd_fis, ncq_tfs->tag, ncq_tfs->lba);dma_acct_start (ncq_tfs->drive->port.ifs[0 ].bs, &ncq_tfs->acct, - &ncq_tfs->sglist,BDRV_ACCT_WRITE ); + &ncq_tfs->sglist,BLOCK_ACCT_WRITE ); ncq_tfs->aiocb =dma_bdrv_write (ncq_tfs->drive->port.ifs[0 ].bs, &ncq_tfs->sglist, ncq_tfs->lba, ncq_cb, ncq_tfs);
hw/ide/atapi.c +4 -4
@@ -110,12 +110,12 @@ static int cd_read_sector(IDEState *s, int lba, uint8_t *buf, int sector_size)switch (sector_size) {case 2048 : -bdrv_acct_start (s->bs, &s->acct,4 *BDRV_SECTOR_SIZE ,BDRV_ACCT_READ ); +bdrv_acct_start (s->bs, &s->acct,4 *BDRV_SECTOR_SIZE ,BLOCK_ACCT_READ ); ret =bdrv_read (s->bs, (int64_t )lba <<2 , buf,4 );bdrv_acct_done (s->bs, &s->acct);break ;case 2352 : -bdrv_acct_start (s->bs, &s->acct,4 *BDRV_SECTOR_SIZE ,BDRV_ACCT_READ ); +bdrv_acct_start (s->bs, &s->acct,4 *BDRV_SECTOR_SIZE ,BLOCK_ACCT_READ ); ret =bdrv_read (s->bs, (int64_t )lba <<2 , buf +16 ,4 );bdrv_acct_done (s->bs, &s->acct);if (ret <0 )
@@ -253,7 +253,7 @@ static void ide_atapi_cmd_reply(IDEState *s, int size, int max_size) s->io_buffer_index =0 ;if (s->atapi_dma) { -bdrv_acct_start (s->bs, &s->acct, size,BDRV_ACCT_READ ); +bdrv_acct_start (s->bs, &s->acct, size,BLOCK_ACCT_READ ); s->status =READY_STAT |SEEK_STAT |DRQ_STAT ;ide_start_dma (s, ide_atapi_cmd_read_dma_cb); }else {
@@ -369,7 +369,7 @@ static void ide_atapi_cmd_read_dma(IDEState *s, int lba, int nb_sectors, s->io_buffer_size =0 ; s->cd_sector_size = sector_size; -bdrv_acct_start (s->bs, &s->acct, s->packet_transfer_size,BDRV_ACCT_READ ); +bdrv_acct_start (s->bs, &s->acct, s->packet_transfer_size,BLOCK_ACCT_READ );/* XXX: check if BUSY_STAT should be set */ s->status =READY_STAT |SEEK_STAT |DRQ_STAT |BUSY_STAT ;
hw/ide/core.c +5 -5
@@ -624,7 +624,7 @@ void ide_sector_read(IDEState *s) s->iov.iov_len = n *BDRV_SECTOR_SIZE ;qemu_iovec_init_external (&s->qiov, &s->iov,1 ); -bdrv_acct_start (s->bs, &s->acct, n *BDRV_SECTOR_SIZE ,BDRV_ACCT_READ ); +bdrv_acct_start (s->bs, &s->acct, n *BDRV_SECTOR_SIZE ,BLOCK_ACCT_READ ); s->pio_aiocb =bdrv_aio_readv (s->bs, sector_num, &s->qiov, n, ide_sector_read_cb, s); }
@@ -771,11 +771,11 @@ static void ide_sector_start_dma(IDEState *s, enum ide_dma_cmd dma_cmd)switch (dma_cmd) {case IDE_DMA_READ :bdrv_acct_start (s->bs, &s->acct, s->nsector *BDRV_SECTOR_SIZE , -BDRV_ACCT_READ ); +BLOCK_ACCT_READ );break ;case IDE_DMA_WRITE :bdrv_acct_start (s->bs, &s->acct, s->nsector *BDRV_SECTOR_SIZE , -BDRV_ACCT_WRITE ); +BLOCK_ACCT_WRITE );break ;default :break ;
@@ -869,7 +869,7 @@ void ide_sector_write(IDEState *s) s->iov.iov_len = n *BDRV_SECTOR_SIZE ;qemu_iovec_init_external (&s->qiov, &s->iov,1 ); -bdrv_acct_start (s->bs, &s->acct, n *BDRV_SECTOR_SIZE ,BDRV_ACCT_READ ); +bdrv_acct_start (s->bs, &s->acct, n *BDRV_SECTOR_SIZE ,BLOCK_ACCT_READ ); s->pio_aiocb =bdrv_aio_writev (s->bs, sector_num, &s->qiov, n, ide_sector_write_cb, s); }
@@ -903,7 +903,7 @@ void ide_flush_cache(IDEState *s) } s->status |=BUSY_STAT ; -bdrv_acct_start (s->bs, &s->acct,0 ,BDRV_ACCT_FLUSH ); +bdrv_acct_start (s->bs, &s->acct,0 ,BLOCK_ACCT_FLUSH ); s->pio_aiocb =bdrv_aio_flush (s->bs, ide_flush_cb, s); }
hw/ide/macio.c +4 -4
@@ -371,7 +371,7 @@ static void pmac_ide_transfer(DBDMA_io *io)if (s->lba ==-1 ) { s->io_buffer_size =MIN (io->len, s->packet_transfer_size);bdrv_acct_start (s->bs, &s->acct, s->io_buffer_size, -BDRV_ACCT_READ ); +BLOCK_ACCT_READ );MACIO_DPRINTF ("non-block ATAPI DMA transfer size: %d\n" , s->io_buffer_size);
@@ -387,17 +387,17 @@ static void pmac_ide_transfer(DBDMA_io *io)return ; } -bdrv_acct_start (s->bs, &s->acct, io->len,BDRV_ACCT_READ ); +bdrv_acct_start (s->bs, &s->acct, io->len,BLOCK_ACCT_READ );pmac_ide_atapi_transfer_cb (io,0 );return ; }switch (s->dma_cmd) {case IDE_DMA_READ : -bdrv_acct_start (s->bs, &s->acct, io->len,BDRV_ACCT_READ ); +bdrv_acct_start (s->bs, &s->acct, io->len,BLOCK_ACCT_READ );break ;case IDE_DMA_WRITE : -bdrv_acct_start (s->bs, &s->acct, io->len,BDRV_ACCT_WRITE ); +bdrv_acct_start (s->bs, &s->acct, io->len,BLOCK_ACCT_WRITE );break ;default :break ;
hw/scsi/scsi-disk.c +16 -12
@@ -237,7 +237,7 @@ static void scsi_write_do_fua(SCSIDiskReq *r) }if (scsi_is_cmd_fua (&r->req.cmd)) { -bdrv_acct_start (s->qdev.conf.bs, &r->acct,0 ,BDRV_ACCT_FLUSH ); +bdrv_acct_start (s->qdev.conf.bs, &r->acct,0 ,BLOCK_ACCT_FLUSH ); r->req.aiocb =bdrv_aio_flush (s->qdev.conf.bs, scsi_aio_complete, r);return ; }
@@ -349,13 +349,14 @@ static void scsi_do_read(void *opaque, int ret)scsi_req_ref (&r->req);if (r->req.sg) { -dma_acct_start (s->qdev.conf.bs, &r->acct, r->req.sg,BDRV_ACCT_READ ); +dma_acct_start (s->qdev.conf.bs, &r->acct, r->req.sg,BLOCK_ACCT_READ ); r->req.resid -= r->req.sg->size; r->req.aiocb =dma_bdrv_read (s->qdev.conf.bs, r->req.sg, r->sector, scsi_dma_complete, r); }else { n =scsi_init_iovec (r,SCSI_DMA_BUF_SIZE ); -bdrv_acct_start (s->qdev.conf.bs, &r->acct, n *BDRV_SECTOR_SIZE ,BDRV_ACCT_READ ); +bdrv_acct_start (s->qdev.conf.bs, &r->acct, n *BDRV_SECTOR_SIZE , +BLOCK_ACCT_READ ); r->req.aiocb =bdrv_aio_readv (s->qdev.conf.bs, r->sector, &r->qiov, n, scsi_read_complete, r); }
@@ -399,7 +400,7 @@ static void scsi_read_data(SCSIRequest *req) first = !r->started; r->started = true;if (first &&scsi_is_cmd_fua (&r->req.cmd)) { -bdrv_acct_start (s->qdev.conf.bs, &r->acct,0 ,BDRV_ACCT_FLUSH ); +bdrv_acct_start (s->qdev.conf.bs, &r->acct,0 ,BLOCK_ACCT_FLUSH ); r->req.aiocb =bdrv_aio_flush (s->qdev.conf.bs, scsi_do_read, r); }else {scsi_do_read (r,0 );
@@ -522,13 +523,14 @@ static void scsi_write_data(SCSIRequest *req) }if (r->req.sg) { -dma_acct_start (s->qdev.conf.bs, &r->acct, r->req.sg,BDRV_ACCT_WRITE ); +dma_acct_start (s->qdev.conf.bs, &r->acct, r->req.sg,BLOCK_ACCT_WRITE ); r->req.resid -= r->req.sg->size; r->req.aiocb =dma_bdrv_write (s->qdev.conf.bs, r->req.sg, r->sector, scsi_dma_complete, r); }else { n = r->qiov.size /512 ; -bdrv_acct_start (s->qdev.conf.bs, &r->acct, n *BDRV_SECTOR_SIZE ,BDRV_ACCT_WRITE ); +bdrv_acct_start (s->qdev.conf.bs, &r->acct, n *BDRV_SECTOR_SIZE , +BLOCK_ACCT_WRITE ); r->req.aiocb =bdrv_aio_writev (s->qdev.conf.bs, r->sector, &r->qiov, n, scsi_write_complete, r); }
@@ -1496,7 +1498,7 @@ static void scsi_disk_emulate_mode_select(SCSIDiskReq *r, uint8_t *inbuf)if (!bdrv_enable_write_cache (s->qdev.conf.bs)) {/* The request is used as the AIO opaque value, so add a ref. */ scsi_req_ref (&r->req); -bdrv_acct_start (s->qdev.conf.bs, &r->acct,0 ,BDRV_ACCT_FLUSH ); +bdrv_acct_start (s->qdev.conf.bs, &r->acct,0 ,BLOCK_ACCT_FLUSH ); r->req.aiocb =bdrv_aio_flush (s->qdev.conf.bs, scsi_aio_complete, r);return ; }
@@ -1662,7 +1664,8 @@ static void scsi_write_same_complete(void *opaque, int ret) data->sector += data->iov.iov_len /512 ; data->iov.iov_len =MIN (data->nb_sectors *512 , data->iov.iov_len);if (data->iov.iov_len) { -bdrv_acct_start (s->qdev.conf.bs, &r->acct, data->iov.iov_len,BDRV_ACCT_WRITE ); +bdrv_acct_start (s->qdev.conf.bs, &r->acct, data->iov.iov_len, +BLOCK_ACCT_WRITE ); r->req.aiocb =bdrv_aio_writev (s->qdev.conf.bs, data->sector, &data->qiov, data->iov.iov_len /512 , scsi_write_same_complete, data);
@@ -1708,8 +1711,8 @@ static void scsi_disk_emulate_write_same(SCSIDiskReq *r, uint8_t *inbuf)/* The request is used as the AIO opaque value, so add a ref. */ scsi_req_ref (&r->req); -bdrv_acct_start (s->qdev.conf.bs, &r->acct, nb_sectors * s->qdev.blocksize, -BDRV_ACCT_WRITE ); +bdrv_acct_start (s->qdev.conf.bs, &r->acct, + nb_sectors * s->qdev.blocksize,BLOCK_ACCT_WRITE ); r->req.aiocb = bdrv_aio_write_zeroes(s->qdev.conf.bs, r->req.cmd.lba * (s->qdev.blocksize / 512), nb_sectors * (s->qdev.blocksize / 512),
@@ -1730,7 +1733,8 @@ static void scsi_disk_emulate_write_same(SCSIDiskReq *r, uint8_t *inbuf) }scsi_req_ref (&r->req); -bdrv_acct_start (s->qdev.conf.bs, &r->acct, data->iov.iov_len,BDRV_ACCT_WRITE ); +bdrv_acct_start (s->qdev.conf.bs, &r->acct, data->iov.iov_len, +BLOCK_ACCT_WRITE ); r->req.aiocb =bdrv_aio_writev (s->qdev.conf.bs, data->sector, &data->qiov, data->iov.iov_len /512 , scsi_write_same_complete, data);
@@ -1994,7 +1998,7 @@ static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf)case SYNCHRONIZE_CACHE :/* The request is used as the AIO opaque value, so add a ref. */ scsi_req_ref (&r->req); -bdrv_acct_start (s->qdev.conf.bs, &r->acct,0 ,BDRV_ACCT_FLUSH ); +bdrv_acct_start (s->qdev.conf.bs, &r->acct,0 ,BLOCK_ACCT_FLUSH ); r->req.aiocb =bdrv_aio_flush (s->qdev.conf.bs, scsi_aio_complete, r);return 0 ;case SEEK_10 :
include/block/accounting.h +7 -7
@@ -29,16 +29,16 @@#include "qemu/typedefs.h" enum BlockAcctType { -BDRV_ACCT_READ , -BDRV_ACCT_WRITE , -BDRV_ACCT_FLUSH , -BDRV_MAX_IOTYPE , +BLOCK_ACCT_READ , +BLOCK_ACCT_WRITE , +BLOCK_ACCT_FLUSH , +BLOCK_MAX_IOTYPE , };typedef struct BlockAcctStats { -uint64_t nr_bytes[BDRV_MAX_IOTYPE ]; -uint64_t nr_ops[BDRV_MAX_IOTYPE ]; -uint64_t total_time_ns[BDRV_MAX_IOTYPE ]; +uint64_t nr_bytes[BLOCK_MAX_IOTYPE ]; +uint64_t nr_ops[BLOCK_MAX_IOTYPE ]; +uint64_t total_time_ns[BLOCK_MAX_IOTYPE ];uint64_t wr_highest_sector; }BlockAcctStats ;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 11/22] block: Make the block accounting functions operate on BlockAcctStats
In reply to Kevin WolfFrom: Benoît Canet <[email protected]>
This is the next step for decoupling block accounting functions from BlockDriverState.
In a future commit the BlockAcctStats structure will be moved from BlockDriverState to the device models structures.
Note that bdrv_get_stats was introduced so device models can retrieve the BlockAcctStats structure of a BlockDriverState without being aware of it's layout.
This function should go away when BlockAcctStats will be embedded in the device models structures.
--- block.c | 13 ++++++++++++- block/accounting.c | 23 ++++++++++------------- dma-helpers.c | 2 +- hw/block/nvme.c | 2 +- hw/block/virtio-blk.c | 15 +++++++++------ hw/block/xen_disk.c | 10 +++++----- hw/ide/ahci.c | 3 ++- hw/ide/atapi.c | 18 +++++++++++------- hw/ide/core.c | 24 +++++++++++++----------- hw/ide/macio.c | 19 +++++++++++-------- hw/scsi/scsi-disk.c | 45 +++++++++++++++++++++++++-------------------- include/block/accounting.h | 10 +++++----- include/block/block.h | 3 +++ 13 files changed, 108 insertions(+), 79 deletions(-)
block.c +12 -1
@@ -3363,7 +3363,7 @@ static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs,bdrv_set_dirty (bs, sector_num, nb_sectors); -bdrv_acct_highest_sector (bs, sector_num, nb_sectors); +block_acct_highest_sector (&bs->stats, sector_num, nb_sectors);if (bs->growable && ret >=0 ) { bs->total_sectors =MAX (bs->total_sectors, sector_num + nb_sectors);
@@ -6087,3 +6087,14 @@ void bdrv_refresh_filename(BlockDriverState *bs)QDECREF (json); } } + +/* This accessor function purpose is to allow the device models to access the +* BlockAcctStats structure embedded inside a BlockDriverState without being +* aware of the BlockDriverState structure layout. +* It will go away when the BlockAcctStats structure will be moved inside +* the device models. +*/ +BlockAcctStats *bdrv_get_stats (BlockDriverState *bs) +{ +return &bs->stats; +}
block/accounting.c +10 -13
@@ -25,9 +25,8 @@#include "block/accounting.h" #include "block/block_int.h" -void -bdrv_acct_start (BlockDriverState *bs,BlockAcctCookie *cookie,int64_t bytes, -enum BlockAcctType type) +void block_acct_start (BlockAcctStats *stats,BlockAcctCookie *cookie, +int64_t bytes,enum BlockAcctType type) {assert (type <BLOCK_MAX_IOTYPE );
@@ -36,22 +35,20 @@ bdrv_acct_start(BlockDriverState *bs, BlockAcctCookie *cookie, int64_t bytes, cookie->type = type; } -void -bdrv_acct_done (BlockDriverState *bs,BlockAcctCookie *cookie) +void block_acct_done (BlockAcctStats *stats,BlockAcctCookie *cookie) {assert (cookie->type <BLOCK_MAX_IOTYPE ); - bs->stats.nr_bytes[cookie->type] += cookie->bytes; - bs->stats.nr_ops[cookie->type]++; - bs->stats.total_time_ns[cookie->type] +=get_clock () - - cookie->start_time_ns; + stats->nr_bytes[cookie->type] += cookie->bytes; + stats->nr_ops[cookie->type]++; + stats->total_time_ns[cookie->type] +=get_clock () - cookie->start_time_ns; } -void bdrv_acct_highest_sector (BlockDriverState *bs,int64_t sector_num, -unsigned int nb_sectors) +void block_acct_highest_sector (BlockAcctStats *stats,int64_t sector_num, +unsigned int nb_sectors) { -if (bs->stats.wr_highest_sector < sector_num + nb_sectors -1 ) { - bs->stats.wr_highest_sector = sector_num + nb_sectors -1 ; +if (stats->wr_highest_sector < sector_num + nb_sectors -1 ) { + stats->wr_highest_sector = sector_num + nb_sectors -1 ; } }
dma-helpers.c +1 -1
@@ -277,5 +277,5 @@ uint64_t dma_buf_write(uint8_t *ptr, int32_t len, QEMUSGList *sg)void dma_acct_start (BlockDriverState *bs,BlockAcctCookie *cookie,QEMUSGList *sg,enum BlockAcctType type) { -bdrv_acct_start (bs, cookie, sg->size, type); +block_acct_start (bdrv_get_stats (bs), cookie, sg->size, type); }
hw/block/nvme.c +1 -1
@@ -197,7 +197,7 @@ static void nvme_rw_cb(void *opaque, int ret)NvmeCtrl *n = sq->ctrl;NvmeCQueue *cq = n->cq[sq->cqid]; -bdrv_acct_done (n->conf.bs, &req->acct); +block_acct_done (bdrv_get_stats (n->conf.bs), &req->acct);if (!ret) { req->status =NVME_SUCCESS ; }else {
hw/block/virtio-blk.c +9 -6
@@ -74,7 +74,7 @@ static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error, s->rq = req; }else if (action ==BLOCK_ERROR_ACTION_REPORT ) {virtio_blk_req_complete (req,VIRTIO_BLK_S_IOERR ); -bdrv_acct_done (s->bs, &req->acct); +block_acct_done (bdrv_get_stats (s->bs), &req->acct);virtio_blk_free_request (req); }
@@ -96,7 +96,7 @@ static void virtio_blk_rw_complete(void *opaque, int ret) }virtio_blk_req_complete (req,VIRTIO_BLK_S_OK ); -bdrv_acct_done (req->dev->bs, &req->acct); +block_acct_done (bdrv_get_stats (req->dev->bs), &req->acct);virtio_blk_free_request (req); }
@@ -111,7 +111,7 @@ static void virtio_blk_flush_complete(void *opaque, int ret) }virtio_blk_req_complete (req,VIRTIO_BLK_S_OK ); -bdrv_acct_done (req->dev->bs, &req->acct); +block_acct_done (bdrv_get_stats (req->dev->bs), &req->acct);virtio_blk_free_request (req); }
@@ -279,7 +279,8 @@ void virtio_submit_multiwrite(BlockDriverState *bs, MultiReqBuffer *mrb)static void virtio_blk_handle_flush (VirtIOBlockReq *req,MultiReqBuffer *mrb) { -bdrv_acct_start (req->dev->bs, &req->acct,0 ,BLOCK_ACCT_FLUSH ); +block_acct_start (bdrv_get_stats (req->dev->bs), &req->acct,0 , +BLOCK_ACCT_FLUSH );/* * Make sure all outstanding writes are posted to the backing device.
@@ -322,7 +323,8 @@ static void virtio_blk_handle_write(VirtIOBlockReq *req, MultiReqBuffer *mrb)return ; } -bdrv_acct_start (req->dev->bs, &req->acct, req->qiov.size,BLOCK_ACCT_WRITE ); +block_acct_start (bdrv_get_stats (req->dev->bs), &req->acct, req->qiov.size, +BLOCK_ACCT_WRITE );if (mrb->num_writes ==32 ) {virtio_submit_multiwrite (req->dev->bs, mrb);
@@ -353,7 +355,8 @@ static void virtio_blk_handle_read(VirtIOBlockReq *req)return ; } -bdrv_acct_start (req->dev->bs, &req->acct, req->qiov.size,BLOCK_ACCT_READ ); +block_acct_start (bdrv_get_stats (req->dev->bs), &req->acct, req->qiov.size, +BLOCK_ACCT_READ );bdrv_aio_readv (req->dev->bs, sector, &req->qiov, req->qiov.size /BDRV_SECTOR_SIZE , virtio_blk_rw_complete, req);
hw/block/xen_disk.c +5 -5
@@ -493,7 +493,7 @@ static void qemu_aio_complete(void *opaque, int ret)break ; }case BLKIF_OP_READ : -bdrv_acct_done (ioreq->blkdev->bs, &ioreq->acct); +block_acct_done (bdrv_get_stats (ioreq->blkdev->bs), &ioreq->acct);break ;case BLKIF_OP_DISCARD :default :
@@ -518,8 +518,8 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq)switch (ioreq->req.operation) {case BLKIF_OP_READ : -bdrv_acct_start (blkdev->bs, &ioreq->acct, ioreq->v.size, -BLOCK_ACCT_READ ); +block_acct_start (bdrv_get_stats (blkdev->bs), &ioreq->acct, + ioreq->v.size,BLOCK_ACCT_READ ); ioreq->aio_inflight++; bdrv_aio_readv(blkdev->bs, ioreq->start / BLOCK_SIZE, &ioreq->v, ioreq->v.size / BLOCK_SIZE,
@@ -531,8 +531,8 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq)break ; } -bdrv_acct_start (blkdev->bs, &ioreq->acct, ioreq->v.size, -BLOCK_ACCT_WRITE ); +block_acct_start (bdrv_get_stats (blkdev->bs), &ioreq->acct, + ioreq->v.size,BLOCK_ACCT_WRITE ); ioreq->aio_inflight++; bdrv_aio_writev(blkdev->bs, ioreq->start / BLOCK_SIZE, &ioreq->v, ioreq->v.size / BLOCK_SIZE,
hw/ide/ahci.c +2 -1
@@ -809,7 +809,8 @@ static void ncq_cb(void *opaque, int ret)DPRINTF (ncq_tfs->drive->port_no,"NCQ transfer tag %d finished\n" , ncq_tfs->tag); -bdrv_acct_done (ncq_tfs->drive->port.ifs[0 ].bs, &ncq_tfs->acct); +block_acct_done (bdrv_get_stats (ncq_tfs->drive->port.ifs[0 ].bs), + &ncq_tfs->acct);qemu_sglist_destroy (&ncq_tfs->sglist); ncq_tfs->used =0 ; }
hw/ide/atapi.c +11 -7
@@ -110,14 +110,16 @@ static int cd_read_sector(IDEState *s, int lba, uint8_t *buf, int sector_size)switch (sector_size) {case 2048 : -bdrv_acct_start (s->bs, &s->acct,4 *BDRV_SECTOR_SIZE ,BLOCK_ACCT_READ ); +block_acct_start (bdrv_get_stats (s->bs), &s->acct, +4 *BDRV_SECTOR_SIZE ,BLOCK_ACCT_READ ); ret =bdrv_read (s->bs, (int64_t )lba <<2 , buf,4 ); -bdrv_acct_done (s->bs, &s->acct); +block_acct_done (bdrv_get_stats (s->bs), &s->acct);break ;case 2352 : -bdrv_acct_start (s->bs, &s->acct,4 *BDRV_SECTOR_SIZE ,BLOCK_ACCT_READ ); +block_acct_start (bdrv_get_stats (s->bs), &s->acct, +4 *BDRV_SECTOR_SIZE ,BLOCK_ACCT_READ ); ret =bdrv_read (s->bs, (int64_t )lba <<2 , buf +16 ,4 ); -bdrv_acct_done (s->bs, &s->acct); +block_acct_done (bdrv_get_stats (s->bs), &s->acct);if (ret <0 )return ret;cd_data_to_raw (buf, lba);
@@ -253,7 +255,8 @@ static void ide_atapi_cmd_reply(IDEState *s, int size, int max_size) s->io_buffer_index =0 ;if (s->atapi_dma) { -bdrv_acct_start (s->bs, &s->acct, size,BLOCK_ACCT_READ ); +block_acct_start (bdrv_get_stats (s->bs), &s->acct, size, +BLOCK_ACCT_READ ); s->status =READY_STAT |SEEK_STAT |DRQ_STAT ;ide_start_dma (s, ide_atapi_cmd_read_dma_cb); }else {
@@ -354,7 +357,7 @@ static void ide_atapi_cmd_read_dma_cb(void *opaque, int ret)return ; eot: -bdrv_acct_done (s->bs, &s->acct); +block_acct_done (bdrv_get_stats (s->bs), &s->acct);ide_set_inactive (s, false); }
@@ -369,7 +372,8 @@ static void ide_atapi_cmd_read_dma(IDEState *s, int lba, int nb_sectors, s->io_buffer_size =0 ; s->cd_sector_size = sector_size; -bdrv_acct_start (s->bs, &s->acct, s->packet_transfer_size,BLOCK_ACCT_READ ); +block_acct_start (bdrv_get_stats (s->bs), &s->acct, s->packet_transfer_size, +BLOCK_ACCT_READ );/* XXX: check if BUSY_STAT should be set */ s->status =READY_STAT |SEEK_STAT |DRQ_STAT |BUSY_STAT ;
hw/ide/core.c +13 -11
@@ -568,7 +568,7 @@ static void ide_sector_read_cb(void *opaque, int ret) s->pio_aiocb =NULL ; s->status &= ~BUSY_STAT ; -bdrv_acct_done (s->bs, &s->acct); +block_acct_done (bdrv_get_stats (s->bs), &s->acct);if (ret !=0 ) {if (ide_handle_rw_error (s, -ret,IDE_RETRY_PIO |IDE_RETRY_READ )) {
@@ -624,7 +624,8 @@ void ide_sector_read(IDEState *s) s->iov.iov_len = n *BDRV_SECTOR_SIZE ;qemu_iovec_init_external (&s->qiov, &s->iov,1 ); -bdrv_acct_start (s->bs, &s->acct, n *BDRV_SECTOR_SIZE ,BLOCK_ACCT_READ ); +block_acct_start (bdrv_get_stats (s->bs), &s->acct, + n *BDRV_SECTOR_SIZE ,BLOCK_ACCT_READ ); s->pio_aiocb =bdrv_aio_readv (s->bs, sector_num, &s->qiov, n, ide_sector_read_cb, s); }
@@ -756,7 +757,7 @@ void ide_dma_cb(void *opaque, int ret) eot:if (s->dma_cmd ==IDE_DMA_READ || s->dma_cmd ==IDE_DMA_WRITE ) { -bdrv_acct_done (s->bs, &s->acct); +block_acct_done (bdrv_get_stats (s->bs), &s->acct); }ide_set_inactive (s, stay_active); }
@@ -770,12 +771,12 @@ static void ide_sector_start_dma(IDEState *s, enum ide_dma_cmd dma_cmd)switch (dma_cmd) {case IDE_DMA_READ : -bdrv_acct_start (s->bs, &s->acct, s->nsector *BDRV_SECTOR_SIZE , -BLOCK_ACCT_READ ); +block_acct_start (bdrv_get_stats (s->bs), &s->acct, + s->nsector *BDRV_SECTOR_SIZE ,BLOCK_ACCT_READ );break ;case IDE_DMA_WRITE : -bdrv_acct_start (s->bs, &s->acct, s->nsector *BDRV_SECTOR_SIZE , -BLOCK_ACCT_WRITE ); +block_acct_start (bdrv_get_stats (s->bs), &s->acct, + s->nsector *BDRV_SECTOR_SIZE ,BLOCK_ACCT_WRITE );break ;default :break ;
@@ -802,7 +803,7 @@ static void ide_sector_write_cb(void *opaque, int ret)IDEState *s = opaque;int n; -bdrv_acct_done (s->bs, &s->acct); +block_acct_done (bdrv_get_stats (s->bs), &s->acct); s->pio_aiocb =NULL ; s->status &= ~BUSY_STAT ;
@@ -869,7 +870,8 @@ void ide_sector_write(IDEState *s) s->iov.iov_len = n *BDRV_SECTOR_SIZE ;qemu_iovec_init_external (&s->qiov, &s->iov,1 ); -bdrv_acct_start (s->bs, &s->acct, n *BDRV_SECTOR_SIZE ,BLOCK_ACCT_READ ); +block_acct_start (bdrv_get_stats (s->bs), &s->acct, + n *BDRV_SECTOR_SIZE ,BLOCK_ACCT_READ ); s->pio_aiocb =bdrv_aio_writev (s->bs, sector_num, &s->qiov, n, ide_sector_write_cb, s); }
@@ -888,7 +890,7 @@ static void ide_flush_cb(void *opaque, int ret) }if (s->bs) { -bdrv_acct_done (s->bs, &s->acct); +block_acct_done (bdrv_get_stats (s->bs), &s->acct); } s->status =READY_STAT |SEEK_STAT ;ide_cmd_done (s);
@@ -903,7 +905,7 @@ void ide_flush_cache(IDEState *s) } s->status |=BUSY_STAT ; -bdrv_acct_start (s->bs, &s->acct,0 ,BLOCK_ACCT_FLUSH ); +block_acct_start (bdrv_get_stats (s->bs), &s->acct,0 ,BLOCK_ACCT_FLUSH ); s->pio_aiocb =bdrv_aio_flush (s->bs, ide_flush_cb, s); }
hw/ide/macio.c +11 -8
@@ -171,7 +171,7 @@ static void pmac_ide_atapi_transfer_cb(void *opaque, int ret) done:MACIO_DPRINTF ("done DMA\n" ); -bdrv_acct_done (s->bs, &s->acct); +block_acct_done (bdrv_get_stats (s->bs), &s->acct); io->dma_end (opaque); }
@@ -352,7 +352,7 @@ static void pmac_ide_transfer_cb(void *opaque, int ret) done:if (s->dma_cmd ==IDE_DMA_READ || s->dma_cmd ==IDE_DMA_WRITE ) { -bdrv_acct_done (s->bs, &s->acct); +block_acct_done (bdrv_get_stats (s->bs), &s->acct); } io->dma_end (io); }
@@ -370,8 +370,8 @@ static void pmac_ide_transfer(DBDMA_io *io)/* Handle non-block ATAPI DMA transfers */ if (s->lba ==-1 ) { s->io_buffer_size =MIN (io->len, s->packet_transfer_size); -bdrv_acct_start (s->bs, &s->acct, s->io_buffer_size, -BLOCK_ACCT_READ ); +block_acct_start (bdrv_get_stats (s->bs), &s->acct, s->io_buffer_size, +BLOCK_ACCT_READ );MACIO_DPRINTF ("non-block ATAPI DMA transfer size: %d\n" , s->io_buffer_size);
@@ -382,22 +382,25 @@ static void pmac_ide_transfer(DBDMA_io *io) m->dma_active = false;MACIO_DPRINTF ("end of non-block ATAPI DMA transfer\n" ); -bdrv_acct_done (s->bs, &s->acct); +block_acct_done (bdrv_get_stats (s->bs), &s->acct); io->dma_end (io);return ; } -bdrv_acct_start (s->bs, &s->acct, io->len,BLOCK_ACCT_READ ); +block_acct_start (bdrv_get_stats (s->bs), &s->acct, io->len, +BLOCK_ACCT_READ );pmac_ide_atapi_transfer_cb (io,0 );return ; }switch (s->dma_cmd) {case IDE_DMA_READ : -bdrv_acct_start (s->bs, &s->acct, io->len,BLOCK_ACCT_READ ); +block_acct_start (bdrv_get_stats (s->bs), &s->acct, io->len, +BLOCK_ACCT_READ );break ;case IDE_DMA_WRITE : -bdrv_acct_start (s->bs, &s->acct, io->len,BLOCK_ACCT_WRITE ); +block_acct_start (bdrv_get_stats (s->bs), &s->acct, io->len, +BLOCK_ACCT_WRITE );break ;default :break ;
hw/scsi/scsi-disk.c +25 -20
135 lines not on this page · raw message
include/block/accounting.h +5 -5
@@ -48,10 +48,10 @@ typedef struct BlockAcctCookie { enum BlockAcctType type; } BlockAcctCookie; -void bdrv_acct_start (BlockDriverState *bs,BlockAcctCookie *cookie, -int64_t bytes,enum BlockAcctType type); -void bdrv_acct_done (BlockDriverState *bs,BlockAcctCookie *cookie); -void bdrv_acct_highest_sector (BlockDriverState *bs,int64_t sector_num, -unsigned int nb_sectors); +void block_acct_start (BlockAcctStats *stats,BlockAcctCookie *cookie, +int64_t bytes,enum BlockAcctType type); +void block_acct_done (BlockAcctStats *stats,BlockAcctCookie *cookie); +void block_acct_highest_sector (BlockAcctStats *stats,int64_t sector_num, +unsigned int nb_sectors);#endif
include/block/block.h +3 -0
@@ -5,6 +5,7 @@#include "qemu-common.h" #include "qemu/option.h" #include "block/coroutine.h" +#include "block/accounting.h" #include "qapi/qmp/qobject.h" #include "qapi-types.h"
@@ -574,4 +575,6 @@ void bdrv_io_plug(BlockDriverState *bs);void bdrv_io_unplug (BlockDriverState *bs);void bdrv_flush_io_queue (BlockDriverState *bs); +BlockAcctStats *bdrv_get_stats (BlockDriverState *bs); +#endif
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 06/22] thread-pool: Drop unnecessary includes
In reply to Kevin WolfFrom: Markus Armbruster <[email protected]>
Dragging block_int.h into a header is *not* nice. Fortunately, this is the only offender.
--- include/block/thread-pool.h | 6 +----- thread-pool.c | 1 - 2 files changed, 1 insertion(+), 6 deletions(-)
include/block/thread-pool.h +1 -5
@@ -18,11 +18,7 @@#ifndef QEMU_THREAD_POOL_H #define QEMU_THREAD_POOL_H 1 -#include "qemu-common.h" -#include "qemu/queue.h" -#include "qemu/thread.h" -#include "block/coroutine.h" -#include "block/block_int.h" +#include "block/block.h" typedef int ThreadPoolFunc (void *opaque);
thread-pool.c +0 -1
@@ -20,7 +20,6 @@#include "qemu/osdep.h" #include "block/coroutine.h" #include "trace.h" -#include "block/block_int.h" #include "block/thread-pool.h" #include "qemu/main-loop.h"
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 08/22] block: Extract the BlockAcctStats structure
In reply to Kevin WolfFrom: Benoît Canet <[email protected]>
Extract the block accounting statistics into a structure so the block device models can hold them in the future.
--- block.c | 11 ++++++----- block/qapi.c | 19 ++++++++++--------- include/block/block.h | 7 +++++++ include/block/block_int.h | 5 +---- 4 files changed, 24 insertions(+), 18 deletions(-)
block.c +6 -5
@@ -3363,8 +3363,8 @@ static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs,bdrv_set_dirty (bs, sector_num, nb_sectors); -if (bs->wr_highest_sector < sector_num + nb_sectors -1 ) { - bs->wr_highest_sector = sector_num + nb_sectors -1 ; +if (bs->stats.wr_highest_sector < sector_num + nb_sectors -1 ) { + bs->stats.wr_highest_sector = sector_num + nb_sectors -1 ; }if (bs->growable && ret >=0 ) { bs->total_sectors =MAX (bs->total_sectors, sector_num + nb_sectors);
@@ -5588,9 +5588,10 @@ bdrv_acct_done(BlockDriverState *bs, BlockAcctCookie *cookie) {assert (cookie->type <BDRV_MAX_IOTYPE ); - bs->nr_bytes[cookie->type] += cookie->bytes; - bs->nr_ops[cookie->type]++; - bs->total_time_ns[cookie->type] +=get_clock () - cookie->start_time_ns; + bs->stats.nr_bytes[cookie->type] += cookie->bytes; + bs->stats.nr_ops[cookie->type]++; + bs->stats.total_time_ns[cookie->type] +=get_clock () - + cookie->start_time_ns; } void bdrv_img_create(const char *filename, const char *fmt,
block/qapi.c +10 -9
@@ -333,15 +333,16 @@ static BlockStats *bdrv_query_stats(const BlockDriverState *bs) } s->stats =g_malloc0 (sizeof (*s->stats)); - s->stats->rd_bytes = bs->nr_bytes[BDRV_ACCT_READ ]; - s->stats->wr_bytes = bs->nr_bytes[BDRV_ACCT_WRITE ]; - s->stats->rd_operations = bs->nr_ops[BDRV_ACCT_READ ]; - s->stats->wr_operations = bs->nr_ops[BDRV_ACCT_WRITE ]; - s->stats->wr_highest_offset = bs->wr_highest_sector *BDRV_SECTOR_SIZE ; - s->stats->flush_operations = bs->nr_ops[BDRV_ACCT_FLUSH ]; - s->stats->wr_total_time_ns = bs->total_time_ns[BDRV_ACCT_WRITE ]; - s->stats->rd_total_time_ns = bs->total_time_ns[BDRV_ACCT_READ ]; - s->stats->flush_total_time_ns = bs->total_time_ns[BDRV_ACCT_FLUSH ]; + s->stats->rd_bytes = bs->stats.nr_bytes[BDRV_ACCT_READ ]; + s->stats->wr_bytes = bs->stats.nr_bytes[BDRV_ACCT_WRITE ]; + s->stats->rd_operations = bs->stats.nr_ops[BDRV_ACCT_READ ]; + s->stats->wr_operations = bs->stats.nr_ops[BDRV_ACCT_WRITE ]; + s->stats->wr_highest_offset = + bs->stats.wr_highest_sector *BDRV_SECTOR_SIZE ; + s->stats->flush_operations = bs->stats.nr_ops[BDRV_ACCT_FLUSH ]; + s->stats->wr_total_time_ns = bs->stats.total_time_ns[BDRV_ACCT_WRITE ]; + s->stats->rd_total_time_ns = bs->stats.total_time_ns[BDRV_ACCT_READ ]; + s->stats->flush_total_time_ns = bs->stats.total_time_ns[BDRV_ACCT_FLUSH ];if (bs->file) { s->has_parent = true;
include/block/block.h +7 -0
@@ -492,6 +492,13 @@ enum BlockAcctType { BDRV_MAX_IOTYPE, }; +typedef struct BlockAcctStats { +uint64_t nr_bytes[BDRV_MAX_IOTYPE ]; +uint64_t nr_ops[BDRV_MAX_IOTYPE ]; +uint64_t total_time_ns[BDRV_MAX_IOTYPE ]; +uint64_t wr_highest_sector; +}BlockAcctStats ; + typedef struct BlockAcctCookie { int64_t bytes; int64_t start_time_ns;
include/block/block_int.h +1 -4
@@ -359,10 +359,7 @@ struct BlockDriverState {bool io_limits_enabled;/* I/O stats (display with "info blockstats"). */ -uint64_t nr_bytes[BDRV_MAX_IOTYPE ]; -uint64_t nr_ops[BDRV_MAX_IOTYPE ]; -uint64_t total_time_ns[BDRV_MAX_IOTYPE ]; -uint64_t wr_highest_sector; +BlockAcctStats stats;/* I/O Limits */ BlockLimits bl;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 12/22] block/archipelago: Implement bdrv_truncate()
In reply to Kevin WolfFrom: Chrysostomos Nanakos <[email protected]>
--- block/archipelago.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-)
block/archipelago.c +61 -2
@@ -63,8 +63,6 @@#include <xseg/xseg.h> #include <xseg/protocol.h> -#define ARCHIP_FD_READ 0 -#define ARCHIP_FD_WRITE 1#define MAX_REQUEST_SIZE 524288#define ARCHIPELAGO_OPT_VOLUME "volume"
@@ -84,6 +82,7 @@ typedef enum {ARCHIP_OP_WRITE ,ARCHIP_OP_FLUSH ,ARCHIP_OP_VOLINFO , +ARCHIP_OP_TRUNCATE , } ARCHIPCmd; typedef struct ArchipelagoAIOCB {
@@ -248,6 +247,7 @@ static void xseg_request_handler(void *state) }break ;case ARCHIP_OP_VOLINFO : +case ARCHIP_OP_TRUNCATE : s->is_signaled = true;qemu_cond_signal (&s->archip_cond);break ;
@@ -995,6 +995,64 @@ static int64_t qemu_archipelago_getlength(BlockDriverState *bs)return ret; } +static int qemu_archipelago_truncate (BlockDriverState *bs,int64_t offset) +{ +int ret, targetlen; +struct xseg_request *req; +BDRVArchipelagoState *s = bs->opaque; +AIORequestData *reqdata =g_new (AIORequestData,1 ); + +const char *volname = s->volname; + targetlen =strlen (volname); + req =xseg_get_request (s->xseg, s->srcport, s->mportno,X_ALLOC ); +if (!req) { +archipelagolog ("Cannot get XSEG request\n" ); +return err_exit2; + } + + ret =xseg_prep_request (s->xseg, req, targetlen,0 ); +if (ret <0 ) { +archipelagolog ("Cannot prepare XSEG request\n" ); + goto err_exit; + } +char *target =xseg_get_target (s->xseg, req); +if (!target) { +archipelagolog ("Cannot get XSEG target\n" ); + goto err_exit; + } +memcpy (target, volname, targetlen); + req->offset = offset; + req->op =X_TRUNCATE ; + + reqdata->op =ARCHIP_OP_TRUNCATE ; + reqdata->volname = volname; + +xseg_set_req_data (s->xseg, req, reqdata); + +xport p =xseg_submit (s->xseg, req, s->srcport,X_ALLOC ); +if (p == NoPort) { +archipelagolog ("Cannot submit XSEG request\n" ); + goto err_exit; + } + +xseg_signal (s->xseg, p); +qemu_mutex_lock (&s->archip_mutex); +while (!s->is_signaled) { +qemu_cond_wait (&s->archip_cond, &s->archip_mutex); + } + s->is_signaled = false; +qemu_mutex_unlock (&s->archip_mutex); +xseg_put_request (s->xseg, req, s->srcport); +g_free (reqdata); +return 0 ; + +err_exit: +xseg_put_request (s->xseg, req, s->srcport); +err_exit2: +g_free (reqdata); +return -EIO ; +} +static QemuOptsList qemu_archipelago_create_opts = { .name ="archipelago-create-opts" , .head =QTAILQ_HEAD_INITIALIZER (qemu_archipelago_create_opts.head),
@@ -1024,6 +1082,7 @@ static BlockDriver bdrv_archipelago = { .bdrv_close = qemu_archipelago_close, .bdrv_create = qemu_archipelago_create, .bdrv_getlength = qemu_archipelago_getlength, + .bdrv_truncate = qemu_archipelago_truncate, .bdrv_aio_readv = qemu_archipelago_aio_readv, .bdrv_aio_writev = qemu_archipelago_aio_writev, .bdrv_aio_flush = qemu_archipelago_aio_flush,
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 13/22] qemu-iotests: Run 025 for Archipelago block driver
In reply to Kevin WolfFrom: Chrysostomos Nanakos <[email protected]>
Run resize grow test to ensure that existing data
is not lost during grow and new space is zeroed.
--- tests/qemu-iotests/025 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/025 +1 -1
@@ -40,7 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.pattern _supported_fmt raw qcow2 qed -_supported_proto file sheepdog rbd nfs +_supported_proto file sheepdog rbd nfs archipelago _supported_os Linux echo "=== Creating image"
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 14/22] dataplane: fix virtio_blk_data_plane_create() op blocker error path
In reply to Kevin WolfFrom: Stefan Hajnoczi <[email protected]>
Commit 3718d8ab65f68de2acccbe6a315907805f54e3cc ("block: Replace in_use with operation blocker") broke the error path because it consumed local_err instead of propagating it.
The caller has no way to know that the function failed. This caused virtio-blk to start "successfully" even though there was a fatal dataplane error.
Steps to reproduce:
$ qemu-system-x86_64 -enable-kvm -object iothread,id=iothread0 \
-drive if=none,id=drive0,file=a.img \
(qemu) drive_mirror drive0 /tmp/foo.img
(qemu) device_add virtio-blk-pci,iothread=iothread0,drive=drive0Expected result:
Since the mirror block job is using drive0 it is not possible to start virtio-blk data-plane.
device_add fails and the PCI adapter is not added.
Actual result:
device_add completes and the PCI adapter is added.
--- hw/block/dataplane/virtio-blk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/block/dataplane/virtio-blk.c +2 -2
@@ -164,8 +164,8 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk,* block jobs that can conflict. */ if (bdrv_op_is_blocked (blk->conf.bs,BLOCK_OP_TYPE_DATAPLANE , &local_err)) { -error_report ("cannot start dataplane thread: %s" , -error_get_pretty (local_err)); +error_setg (errp,"cannot start dataplane thread: %s" , +error_get_pretty (local_err));error_free (local_err);return ; }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 17/22] iotests: Send the correct fd in socket_scm_helper
In reply to Kevin WolfFrom: Stratos Psomadakis <[email protected]>
Make sure to pass the correct fd via SCM_RIGHTS in socket_scm_helper.c (i.e. fd_to_send, not socket-fd).
--- tests/qemu-iotests/socket_scm_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/socket_scm_helper.c +1 -1
@@ -52,7 +52,7 @@ static int send_fd(int fd, int fd_to_send) cmsg->cmsg_len =CMSG_LEN (sizeof (int )); cmsg->cmsg_level =SOL_SOCKET ; cmsg->cmsg_type =SCM_RIGHTS ; -memcpy (CMSG_DATA (cmsg), &fd,sizeof (int )); +memcpy (CMSG_DATA (cmsg), &fd_to_send,sizeof (int )); do { ret = sendmsg(fd, &msg, 0);
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 16/22] blockdev: Refuse to drive_del something added with blockdev-add
In reply to Kevin WolfFrom: Markus Armbruster <[email protected]>
For some device models, the guest can prevent unplug. Some users need a way to forcibly revoke device model access to the block backend then, so the underlying images can be safely used for something else.
drive_del lets you do that. Unfortunately, it conflates revoking access with destroying the backend.
Commit 9063f81 made drive_del immediately destroy the root BDS. Nice:
the device name becomes available for reuse immediately. Not so nice:
the device model's pointer to the root BDS dangles, and we're prone to crash when the memory gets reused.
Commit d22b2f4 fixed that by hiding the root BDS instead of destroying it. Destruction only happens on unplug. "Hiding" means removing it from bdrv_states and graph_bdrv_states; see bdrv_make_anon().
This "destroy on revoke" is a misfeature we don't want to carry forward to blockdev-add, just like "destroy on unplug" (commit 2d246f0). So make drive_del fail on anything added with blockdev-add.
We'll add separate QMP commands to revoke device model access and to destroy backends.
--- blockdev.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
blockdev.c +9 -1
@@ -1739,6 +1739,7 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data) {const char *id =qdict_get_str (qdict,"id" );BlockDriverState *bs; +DriveInfo *dinfo;AioContext *aio_context;Error *local_err =NULL ;
@@ -1748,6 +1749,13 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)return -1 ; } + dinfo =drive_get_by_blockdev (bs); +if (dinfo && !dinfo->enable_auto_del) { +error_report ("Deleting device added with blockdev-add" +" is not supported" ); +return -1 ; + } + aio_context =bdrv_get_aio_context (bs);aio_context_acquire (aio_context);
@@ -1775,7 +1783,7 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)bdrv_set_on_error (bs,BLOCKDEV_ON_ERROR_REPORT ,BLOCKDEV_ON_ERROR_REPORT ); }else { -drive_del (drive_get_by_blockdev (bs)); +drive_del (dinfo); }aio_context_release (aio_context);
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 18/22] block: round up file size to nearest sector
In reply to Kevin WolfFrom: Hu Tao <[email protected]>
Currently the file size requested by user is rounded down to nearest sector, causing the actual file size could be a bit less than the size user requested. Since some formats (like qcow2) record virtual disk size in bytes, this can make the last few bytes cannot be accessed.
This patch fixes it by rounding up file size to nearest sector so that the actual file size is no less than the requested file size.
--- block/archipelago.c | 3 ++- block/cow.c | 3 ++- block/gluster.c | 4 +-- block/iscsi.c | 4 +-- block/nfs.c | 3 ++- block/qcow.c | 3 ++- block/qcow2.c | 3 ++- block/qed.c | 3 ++- block/raw-posix.c | 8 +++--- block/raw-win32.c | 4 +-- block/rbd.c | 3 ++- block/sheepdog.c | 3 ++- block/ssh.c | 3 ++- block/vdi.c | 3 ++- block/vhdx.c | 3 ++- block/vmdk.c | 3 ++- block/vpc.c | 3 ++- tests/qemu-iotests/104 | 57 ++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/104.out | 12 +++++++++ tests/qemu-iotests/common.filter | 21 +++++++++++++++ tests/qemu-iotests/group | 1 + 21 files changed, 127 insertions(+), 23 deletions(-) create mode 100755 tests/qemu-iotests/104 create mode 100644 tests/qemu-iotests/104.out
block/archipelago.c +2 -1
@@ -708,7 +708,8 @@ static int qemu_archipelago_create(const char *filename,parse_filename_opts (filename, errp, &volname, &segment_name, &mport, &vport); - total_size =qemu_opt_get_size_del (options,BLOCK_OPT_SIZE ,0 ); + total_size =ROUND_UP (qemu_opt_get_size_del (options,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE );if (segment_name ==NULL ) { segment_name =g_strdup ("archipelago" );
block/cow.c +2 -1
@@ -335,7 +335,8 @@ static int cow_create(const char *filename, QemuOpts *opts, Error **errp)BlockDriverState *cow_bs =NULL ;/* Read out options */ - image_sectors =qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ) /512 ; + image_sectors =DIV_ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); image_filename =qemu_opt_get_del (opts,BLOCK_OPT_BACKING_FILE ); ret =bdrv_create_file (filename, opts, &local_err);
block/gluster.c +2 -2
@@ -494,8 +494,8 @@ static int qemu_gluster_create(const char *filename, goto out; } - total_size = -qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ) /BDRV_SECTOR_SIZE ; + total_size =DIV_ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); tmp =qemu_opt_get_del (opts,BLOCK_OPT_PREALLOC );if (!tmp || !strcmp (tmp,"off" )) {
block/iscsi.c +2 -2
@@ -1531,8 +1531,8 @@ static int iscsi_create(const char *filename, QemuOpts *opts, Error **errp) bs =bdrv_new ("" , &error_abort);/* Read out options */ - total_size = -qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ) /BDRV_SECTOR_SIZE ; + total_size =DIV_ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); bs->opaque = g_new0(struct IscsiLun, 1); iscsilun = bs->opaque;
block/nfs.c +2 -1
@@ -418,7 +418,8 @@ static int nfs_file_create(const char *url, QemuOpts *opts, Error **errp) client->aio_context =qemu_get_aio_context ();/* Read out options */ - total_size =qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ); + total_size =ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); ret =nfs_client_open (client, url,O_CREAT , errp);if (ret <0 ) {
block/qcow.c +2 -1
@@ -725,7 +725,8 @@ static int qcow_create(const char *filename, QemuOpts *opts, Error **errp)BlockDriverState *qcow_bs;/* Read out options */ - total_size =qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ) /512 ; + total_size =DIV_ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); backing_file =qemu_opt_get_del (opts,BLOCK_OPT_BACKING_FILE );if (qemu_opt_get_bool_del (opts,BLOCK_OPT_ENCRYPT , false)) { flags |=BLOCK_FLAG_ENCRYPT ;
block/qcow2.c +2 -1
@@ -1921,7 +1921,8 @@ static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp)int ret;/* Read out options */ - sectors =qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ) /512 ; + sectors =DIV_ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); backing_file =qemu_opt_get_del (opts,BLOCK_OPT_BACKING_FILE ); backing_fmt =qemu_opt_get_del (opts,BLOCK_OPT_BACKING_FMT );if (qemu_opt_get_bool_del (opts,BLOCK_OPT_ENCRYPT , false)) {
block/qed.c +2 -1
@@ -648,7 +648,8 @@ static int bdrv_qed_create(const char *filename, QemuOpts *opts, Error **errp)char *backing_fmt =NULL ;int ret; - image_size =qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ); + image_size =ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); backing_file =qemu_opt_get_del (opts,BLOCK_OPT_BACKING_FILE ); backing_fmt =qemu_opt_get_del (opts,BLOCK_OPT_BACKING_FMT ); cluster_size = qemu_opt_get_size_del(opts,
block/raw-posix.c +4 -4
@@ -1369,8 +1369,8 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp)strstart (filename,"file:" , &filename);/* Read out options */ - total_size = -qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ) /BDRV_SECTOR_SIZE ; + total_size =DIV_ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); nocow =qemu_opt_get_bool (opts,BLOCK_OPT_NOCOW , false); fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
@@ -1966,8 +1966,8 @@ static int hdev_create(const char *filename, QemuOpts *opts, (void )has_prefix;/* Read out options */ - total_size = -qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ) /BDRV_SECTOR_SIZE ; + total_size =DIV_ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); fd =qemu_open (filename,O_WRONLY |O_BINARY );if (fd <0 ) {
block/raw-win32.c +2 -2
@@ -511,8 +511,8 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp)strstart (filename,"file:" , &filename);/* Read out options */ - total_size = -qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ) /512 ; + total_size =DIV_ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); fd =qemu_open (filename,O_WRONLY |O_CREAT |O_TRUNC |O_BINARY ,0644 );
block/rbd.c +2 -1
@@ -314,7 +314,8 @@ static int qemu_rbd_create(const char *filename, QemuOpts *opts, Error **errp) }/* Read out options */ - bytes =qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ); + bytes =ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); objsize =qemu_opt_get_size_del (opts,BLOCK_OPT_CLUSTER_SIZE ,0 );if (objsize) {if ((objsize -1 ) & objsize) {/* not a power of 2? */
block/sheepdog.c +2 -1
@@ -1702,7 +1702,8 @@ static int sd_create(const char *filename, QemuOpts *opts, goto out; } - s->inode.vdi_size =qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ); + s->inode.vdi_size =ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); backing_file =qemu_opt_get_del (opts,BLOCK_OPT_BACKING_FILE ); buf =qemu_opt_get_del (opts,BLOCK_OPT_PREALLOC );if (!buf || !strcmp (buf,"off" )) {
block/ssh.c +2 -1
@@ -700,7 +700,8 @@ static int ssh_create(const char *filename, QemuOpts *opts, Error **errp)ssh_state_init (&s);/* Get desired file size. */ - total_size =qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ); + total_size =ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE );DPRINTF ("total_size=%" PRIi64, total_size); uri_options =qdict_new ();
block/vdi.c +2 -1
@@ -700,7 +700,8 @@ static int vdi_create(const char *filename, QemuOpts *opts, Error **errp)logout ("\n" );/* Read out options. */ - bytes =qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ); + bytes =ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE );#if defined(CONFIG_VDI_BLOCK_SIZE )/* TODO: Additional checks (SECTOR_SIZE * 2^n, ...). */ block_size = qemu_opt_get_size_del(opts,
block/vhdx.c +2 -1
@@ -1766,7 +1766,8 @@ static int vhdx_create(const char *filename, QemuOpts *opts, Error **errp)VHDXImageType image_type;Error *local_err =NULL ; - image_size =qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ); + image_size =ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); log_size =qemu_opt_get_size_del (opts,VHDX_BLOCK_OPT_LOG_SIZE ,0 ); block_size =qemu_opt_get_size_del (opts,VHDX_BLOCK_OPT_BLOCK_SIZE ,0 ); type =qemu_opt_get_del (opts,BLOCK_OPT_SUBFMT );
block/vmdk.c +2 -1
@@ -1807,7 +1807,8 @@ static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp) goto exit; }/* Read out options */ - total_size =qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ); + total_size =ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); adapter_type =qemu_opt_get_del (opts,BLOCK_OPT_ADAPTER_TYPE ); backing_file =qemu_opt_get_del (opts,BLOCK_OPT_BACKING_FILE );if (qemu_opt_get_bool_del (opts,BLOCK_OPT_COMPAT6 , false)) {
block/vpc.c +2 -1
@@ -757,7 +757,8 @@ static int vpc_create(const char *filename, QemuOpts *opts, Error **errp)BlockDriverState *bs =NULL ;/* Read out options */ - total_size =qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ); + total_size =ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); disk_type_param =qemu_opt_get_del (opts,BLOCK_OPT_SUBFMT );if (disk_type_param) {if (!strcmp (disk_type_param,"dynamic" )) {
tests/qemu-iotests/104 new file +57 -0
57 lines not on this page · raw message
tests/qemu-iotests/104.out new file +12 -0
@@ -0,0 +1,12 @@ +QA output created by 104 +=== Check qemu-img info output === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024 +image: TEST_DIR/t.IMGFMT +file format: IMGFMT +virtual size: 1.0K (1024 bytes) +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1234 +image: TEST_DIR/t.IMGFMT +file format: IMGFMT +virtual size: 1.5K (1536 bytes) +***done
tests/qemu-iotests/common.filter +21 -0
@@ -192,5 +192,26 @@ _filter_img_create() -e "s/archipelago:a/TEST_DIR\//g" } +_filter_img_info() +{ + sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \ + -e "s#$TEST_DIR#TEST_DIR#g" \ + -e "s#$IMGFMT#IMGFMT#g" \ + -e "/encrypted: yes/d" \ + -e "/cluster_size: [0-9]\\+/d" \ + -e "/table_size: [0-9]\\+/d" \ + -e "/compat: '[^']*'/d" \ + -e "/compat6: \\(on\\|off\\)/d" \ + -e "/static: \\(on\\|off\\)/d" \ + -e "/zeroed_grain: \\(on\\|off\\)/d" \ + -e "/subformat: '[^']*'/d" \ + -e "/adapter_type: '[^']*'/d" \ + -e "/lazy_refcounts: \\(on\\|off\\)/d" \ + -e "/block_size: [0-9]\\+/d" \ + -e "/block_state_zero: \\(on\\|off\\)/d" \ + -e "/log_size: [0-9]\\+/d" \ + -e "s/archipelago:a/TEST_DIR\//g" +} + # make sure this script returns success /bin/true
tests/qemu-iotests/group +1 -0
@@ -104,3 +104,4 @@ 100 rw auto quick 101 rw auto quick 103 rw auto quick +104 rw auto
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 19/22] block: don't convert file size to sector size
In reply to Kevin WolfFrom: Hu Tao <[email protected]>
and avoid converting it back later.
--- block/gluster.c | 9 ++++----- block/qcow.c | 8 ++++---- block/qcow2.c | 10 +++++----- block/raw-posix.c | 12 ++++++------ block/raw-win32.c | 6 +++--- 5 files changed, 22 insertions(+), 23 deletions(-)
block/gluster.c +4 -5
@@ -494,8 +494,8 @@ static int qemu_gluster_create(const char *filename, goto out; } - total_size =DIV_ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), -BDRV_SECTOR_SIZE ); + total_size =ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); tmp =qemu_opt_get_del (opts,BLOCK_OPT_PREALLOC );if (!tmp || !strcmp (tmp,"off" )) {
@@ -516,9 +516,8 @@ static int qemu_gluster_create(const char *filename,if (!fd) { ret = -errno; }else { -if (!glfs_ftruncate (fd, total_size *BDRV_SECTOR_SIZE )) { -if (prealloc &&qemu_gluster_zerofill (fd,0 , - total_size *BDRV_SECTOR_SIZE )) { +if (!glfs_ftruncate (fd, total_size)) { +if (prealloc &&qemu_gluster_zerofill (fd,0 , total_size)) { ret = -errno; } }else {
block/qcow.c +4 -4
@@ -725,8 +725,8 @@ static int qcow_create(const char *filename, QemuOpts *opts, Error **errp)BlockDriverState *qcow_bs;/* Read out options */ - total_size =DIV_ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), -BDRV_SECTOR_SIZE ); + total_size =ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); backing_file =qemu_opt_get_del (opts,BLOCK_OPT_BACKING_FILE );if (qemu_opt_get_bool_del (opts,BLOCK_OPT_ENCRYPT , false)) { flags |=BLOCK_FLAG_ENCRYPT ;
@@ -754,7 +754,7 @@ static int qcow_create(const char *filename, QemuOpts *opts, Error **errp)memset (&header,0 ,sizeof (header)); header.magic =cpu_to_be32 (QCOW_MAGIC ); header.version =cpu_to_be32 (QCOW_VERSION ); - header.size =cpu_to_be64 (total_size *512 ); + header.size =cpu_to_be64 (total_size); header_size =sizeof (header); backing_filename_len =0 ;if (backing_file) {
@@ -776,7 +776,7 @@ static int qcow_create(const char *filename, QemuOpts *opts, Error **errp) } header_size = (header_size +7 ) & ~7 ; shift = header.cluster_bits + header.l2_bits; - l1_size = ((total_size *512 ) + (1LL << shift) -1 ) >> shift; + l1_size = (total_size + (1LL << shift) -1 ) >> shift; header.l1_table_offset =cpu_to_be64 (header_size);if (flags &BLOCK_FLAG_ENCRYPT ) {
block/qcow2.c +5 -5
@@ -1859,7 +1859,7 @@ static int qcow2_create2(const char *filename, int64_t total_size, }/* Okay, now that we have a valid image, let's give it the right size */ - ret =bdrv_truncate (bs, total_size *BDRV_SECTOR_SIZE ); + ret =bdrv_truncate (bs, total_size);if (ret <0 ) {error_setg_errno (errp, -ret,"Could not resize image" ); goto out;
@@ -1912,7 +1912,7 @@ static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp)char *backing_file =NULL ;char *backing_fmt =NULL ;char *buf =NULL ; -uint64_t sectors =0 ; +uint64_t size =0 ;int flags =0 ;size_t cluster_size =DEFAULT_CLUSTER_SIZE ;int prealloc =0 ;
@@ -1921,8 +1921,8 @@ static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp)int ret;/* Read out options */ - sectors =DIV_ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), -BDRV_SECTOR_SIZE ); + size =ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); backing_file =qemu_opt_get_del (opts,BLOCK_OPT_BACKING_FILE ); backing_fmt =qemu_opt_get_del (opts,BLOCK_OPT_BACKING_FMT );if (qemu_opt_get_bool_del (opts,BLOCK_OPT_ENCRYPT , false)) {
@@ -1972,7 +1972,7 @@ static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp) goto finish; } - ret =qcow2_create2 (filename, sectors, backing_file, backing_fmt, flags, + ret =qcow2_create2 (filename, size, backing_file, backing_fmt, flags, cluster_size, prealloc, opts, version, &local_err);if (local_err) {error_propagate (errp, local_err);
block/raw-posix.c +6 -6
@@ -1369,8 +1369,8 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp)strstart (filename,"file:" , &filename);/* Read out options */ - total_size =DIV_ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), -BDRV_SECTOR_SIZE ); + total_size =ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); nocow =qemu_opt_get_bool (opts,BLOCK_OPT_NOCOW , false); fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
@@ -1394,7 +1394,7 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp)#endif } -if (ftruncate (fd, total_size *BDRV_SECTOR_SIZE ) !=0 ) { +if (ftruncate (fd, total_size) !=0 ) { result = -errno;error_setg_errno (errp, -result,"Could not resize file" ); }
@@ -1966,8 +1966,8 @@ static int hdev_create(const char *filename, QemuOpts *opts, (void )has_prefix;/* Read out options */ - total_size =DIV_ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), -BDRV_SECTOR_SIZE ); + total_size =ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); fd =qemu_open (filename,O_WRONLY |O_BINARY );if (fd <0 ) {
@@ -1983,7 +1983,7 @@ static int hdev_create(const char *filename, QemuOpts *opts,error_setg (errp,"The given file is neither a block nor a character device" ); ret = -ENODEV ; - }else if (lseek (fd,0 ,SEEK_END ) < total_size *BDRV_SECTOR_SIZE ) { + }else if (lseek (fd,0 ,SEEK_END ) < total_size) {error_setg (errp,"Device is too small" ); ret = -ENOSPC ; }
block/raw-win32.c +3 -3
@@ -511,8 +511,8 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp)strstart (filename,"file:" , &filename);/* Read out options */ - total_size =DIV_ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), -BDRV_SECTOR_SIZE ); + total_size =ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ), +BDRV_SECTOR_SIZE ); fd =qemu_open (filename,O_WRONLY |O_CREAT |O_TRUNC |O_BINARY ,0644 );
@@ -521,7 +521,7 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp)return -EIO ; }set_sparse (fd); -ftruncate (fd, total_size *512 ); +ftruncate (fd, total_size);qemu_close (fd);return 0 ; }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 15/22] block: extend BLOCK_IO_ERROR with reason string
In reply to Kevin WolfFrom: Luiz Capitulino <[email protected]>
BLOCK_IO_ERROR events are logged by libvirt, which helps with post mortem analysis of guests. However, one information that we miss today is a human readable string describing the cause of the I/O error.
This commit adds that string it to BLOCK_IO_ERROR. Note that this string is a debugging aid for humans, meaning that it should not parsed by applications.
--- block.c | 3 ++- qapi/block-core.json | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-)
block.c +2 -1
@@ -3647,7 +3647,8 @@ static void send_qmp_error_event(BlockDriverState *bs, ac = is_read ?IO_OPERATION_TYPE_READ :IO_OPERATION_TYPE_WRITE ;qapi_event_send_block_io_error (bdrv_get_device_name (bs), ac, action,bdrv_iostatus_is_enabled (bs), - error ==ENOSPC , &error_abort); + error ==ENOSPC ,strerror (error), + &error_abort); }/* This is done by device models because, while the block layer knows
qapi/block-core.json +6 -1
@@ -1593,6 +1593,10 @@ # io-status is present, please see query-block documentation # for more information (since: 2.2) # +# @reason: human readable string describing the error cause. +# (This field is a debugging aid for humans, it should not +# be parsed by applications) (since: 2.2) +# # Note: If action is "stop", a STOP event will eventually follow the # BLOCK_IO_ERROR event #
@@ -1600,7 +1604,8 @@ ## { 'event': 'BLOCK_IO_ERROR', 'data': { 'device': 'str', 'operation': 'IoOperationType', - 'action': 'BlockErrorAction', '*nospace': 'bool' } } + 'action': 'BlockErrorAction', '*nospace': 'bool', + 'reason': 'str' } } ## # @BLOCK_JOB_COMPLETED
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 20/22] qapi: introduce PreallocMode and new PreallocModes full and falloc.
In reply to Kevin WolfFrom: Hu Tao <[email protected]>
This patch prepares for the subsequent patches.
--- block/qcow2.c | 28 ++++++++++++++++++---------- qapi/block-core.json | 17 +++++++++++++++++ tests/qemu-iotests/049.out | 2 +- 3 files changed, 36 insertions(+), 11 deletions(-)
block/qcow2.c +18 -10
@@ -30,6 +30,7 @@#include "qemu/error-report.h" #include "qapi/qmp/qerror.h" #include "qapi/qmp/qbool.h" +#include "qapi/util.h" #include "trace.h" #include "qemu/option_int.h"
@@ -1738,7 +1739,7 @@ static int preallocate(BlockDriverState *bs)static int qcow2_create2 (const char *filename,int64_t total_size,const char *backing_file,const char *backing_format, -int flags,size_t cluster_size,int prealloc, +int flags,size_t cluster_size,PreallocMode prealloc,QemuOpts *opts,int version,Error **errp) {
@@ -1876,7 +1877,7 @@ static int qcow2_create2(const char *filename, int64_t total_size, }/* And if we're supposed to preallocate metadata, do that now */ -if (prealloc) { +if (prealloc ==PREALLOC_MODE_METADATA ) {BDRVQcowState *s = bs->opaque;qemu_co_mutex_lock (&s->lock); ret =preallocate (bs);
@@ -1915,7 +1916,7 @@ static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp)uint64_t size =0 ;int flags =0 ;size_t cluster_size =DEFAULT_CLUSTER_SIZE ; -int prealloc =0 ; +PreallocMode prealloc;int version =3 ;Error *local_err =NULL ;int ret;
@@ -1931,12 +1932,11 @@ static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp) cluster_size =qemu_opt_get_size_del (opts,BLOCK_OPT_CLUSTER_SIZE ,DEFAULT_CLUSTER_SIZE ); buf =qemu_opt_get_del (opts,BLOCK_OPT_PREALLOC ); -if (!buf || !strcmp (buf,"off" )) { - prealloc =0 ; - }else if (!strcmp (buf,"metadata" )) { - prealloc =1 ; - }else { -error_setg (errp,"Invalid preallocation mode: '%s'" , buf); + prealloc =qapi_enum_parse (PreallocMode_lookup, buf, +PREALLOC_MODE_MAX ,PREALLOC_MODE_OFF , + &local_err); +if (local_err) { +error_propagate (errp, local_err); ret = -EINVAL ; goto finish; }
@@ -1958,7 +1958,15 @@ static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp) flags |=BLOCK_FLAG_LAZY_REFCOUNTS ; } -if (backing_file && prealloc) { +if (prealloc !=PREALLOC_MODE_OFF && + prealloc !=PREALLOC_MODE_METADATA ) { + ret = -EINVAL ; +error_setg (errp,"Unsupported preallocate mode: %s" , + PreallocMode_lookup[prealloc]); + goto finish; + } + +if (backing_file && prealloc !=PREALLOC_MODE_OFF ) {error_setg (errp,"Backing file and preallocation cannot be used at " "the same time" ); ret = -EINVAL ;
qapi/block-core.json +17 -0
@@ -1708,3 +1708,20 @@ 'len' : 'int', 'offset': 'int', 'speed' : 'int' } } + +# @PreallocMode +# +# Preallocation mode of QEMU image file +# +# @off: no preallocation +# @metadata: preallocate only for metadata +# @falloc: like @full preallocation but allocate disk space by +# posix_fallocate() rather than writing zeros. +# @full: preallocate all data by writing zeros to device to ensure disk +# space is really available. @full preallocation also sets up +# metadata correctly. +# +# Since 2.2 +## +{ 'enum': 'PreallocMode', + 'data': [ 'off', 'metadata', 'falloc', 'full' ] }
tests/qemu-iotests/049.out +1 -1
@@ -179,7 +179,7 @@ qemu-img create -f qcow2 -o preallocation=metadata TEST_DIR/t.qcow2 64M Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=65536 preallocation='metadata' lazy_refcounts=off qemu-img create -f qcow2 -o preallocation=1234 TEST_DIR/t.qcow2 64M -qemu-img: TEST_DIR/t.qcow2: Invalid preallocation mode: '1234' +qemu-img: TEST_DIR/t.qcow2: invalid parameter value: 1234 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=65536 preallocation='1234' lazy_refcounts=off == Check encryption option ==
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 21/22] raw-posix: Add falloc and full preallocation option
In reply to Kevin WolfFrom: Hu Tao <[email protected]>
This patch adds a new option preallocation for raw format, and implements falloc and full preallocation.
--- block/raw-posix.c | 92 +++++++++++++++++++++++++++++++++++++++++++------------ qemu-doc.texi | 9 ++++++ qemu-img.texi | 9 ++++++ 3 files changed, 91 insertions(+), 19 deletions(-)
block/raw-posix.c +73 -19
@@ -30,6 +30,7 @@#include "block/thread-pool.h" #include "qemu/iov.h" #include "raw-aio.h" +#include "qapi/util.h" #if defined(__APPLE__) && (__MACH__)#include <paths.h>
@@ -1365,6 +1366,9 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp)int result =0 ;int64_t total_size =0 ;bool nocow = false; +PreallocMode prealloc; +char *buf =NULL ; +Error *local_err =NULL ;strstart (filename,"file:" , &filename);
@@ -1372,37 +1376,82 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp) total_size =ROUND_UP (qemu_opt_get_size_del (opts,BLOCK_OPT_SIZE ,0 ),BDRV_SECTOR_SIZE ); nocow =qemu_opt_get_bool (opts,BLOCK_OPT_NOCOW , false); + buf =qemu_opt_get_del (opts,BLOCK_OPT_PREALLOC ); + prealloc =qapi_enum_parse (PreallocMode_lookup, buf, +PREALLOC_MODE_MAX ,PREALLOC_MODE_OFF , + &local_err); +g_free (buf); +if (local_err) { +error_propagate (errp, local_err); + result = -EINVAL ; + goto out; + } fd =qemu_open (filename,O_WRONLY |O_CREAT |O_TRUNC |O_BINARY ,0644 );if (fd <0 ) { result = -errno;error_setg_errno (errp, -result,"Could not create file" ); - }else { -if (nocow) { + goto out; + } + +if (nocow) {#ifdef __linux__ -/* Set NOCOW flag to solve performance issue on fs like btrfs. -* This is an optimisation. The FS_IOC_SETFLAGS ioctl return value -* will be ignored since any failure of this operation should not -* block the left work. -*/ -int attr; -if (ioctl (fd,FS_IOC_GETFLAGS , &attr) ==0 ) { - attr |=FS_NOCOW_FL ; -ioctl (fd,FS_IOC_SETFLAGS , &attr); - } -#endif +/* Set NOCOW flag to solve performance issue on fs like btrfs. +* This is an optimisation. The FS_IOC_SETFLAGS ioctl return value +* will be ignored since any failure of this operation should not +* block the left work. +*/ +int attr; +if (ioctl (fd,FS_IOC_GETFLAGS , &attr) ==0 ) { + attr |=FS_NOCOW_FL ; +ioctl (fd,FS_IOC_SETFLAGS , &attr); } +#endif + } + +if (ftruncate (fd, total_size) !=0 ) { + result = -errno; +error_setg_errno (errp, -result,"Could not resize file" ); + goto out_close; + } -if (ftruncate (fd, total_size) !=0 ) { - result = -errno; -error_setg_errno (errp, -result,"Could not resize file" ); +if (prealloc ==PREALLOC_MODE_FALLOC ) { +/* posix_fallocate() doesn't set errno. */ + result = -posix_fallocate (fd,0 , total_size); +if (result !=0 ) { +error_setg_errno (errp, -result, +"Could not preallocate data for the new file" ); } -if (qemu_close (fd) !=0 ) { - result = -errno; -error_setg_errno (errp, -result,"Could not close the new file" ); + }else if (prealloc ==PREALLOC_MODE_FULL ) { + buf =g_malloc0 (65536 ); +int64_t num =0 , left = total_size; + +while (left >0 ) { + num =MIN (left,65536 ); + result =write (fd, buf, num); +if (result <0 ) { + result = -errno; +error_setg_errno (errp, -result, +"Could not write to the new file" ); +break ; + } + left -= num; } +fsync (fd); +g_free (buf); + }else if (prealloc !=PREALLOC_MODE_OFF ) { + result = -EINVAL ; +error_setg (errp,"Unsupported preallocation mode: %s" , + PreallocMode_lookup[prealloc]); } + +out_close: +if (qemu_close (fd) !=0 && result ==0 ) { + result = -errno; +error_setg_errno (errp, -result,"Could not close the new file" ); + } +out:return result; }
@@ -1585,6 +1634,11 @@ static QemuOptsList raw_create_opts = { .type = QEMU_OPT_BOOL, .help = "Turn off copy-on-write (valid only on btrfs)" }, + { + .name = BLOCK_OPT_PREALLOC, + .type = QEMU_OPT_STRING, + .help = "Preallocation mode (allowed values: off, falloc, full)" + }, {/* end of list */ } } };
qemu-doc.texi +9 -0
@@ -527,6 +527,15 @@ Linux or NTFS on Windows), then only the written sectors will reserve space. Use @code{qemu-img info} to know the real size used by the image or @code{ls -ls} on Unix/Linux. +Supported options: +@table @code +@item preallocation +Preallocation mode (allowed values: @code{off}, @code{falloc}, @code{full}). +@code{falloc} mode preallocates space for image by calling posix_fallocate(). +@code{full} mode preallocates space for image by writing zeros to underlying +storage. +@end table + @item qcow2 QEMU image format, the most versatile format. Use it to have smaller images (useful if your filesystem does not supports holes, for example
qemu-img.texi +9 -0
@@ -419,6 +419,15 @@ Linux or NTFS on Windows), then only the written sectors will reserve space. Use @code{qemu-img info} to know the real size used by the image or @code{ls -ls} on Unix/Linux. +Supported options: +@table @code +@item preallocation +Preallocation mode (allowed values: @code{off}, @code{falloc}, @code{full}). +@code{falloc} mode preallocates space for image by calling posix_fallocate(). +@code{full} mode preallocates space for image by writing zeros to underlying +storage. +@end table + @item qcow2 QEMU image format, the most versatile format. Use it to have smaller images (useful if your filesystem does not supports holes, for example
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 22/22] qcow2: Add falloc and full preallocation option
In reply to Kevin WolfFrom: Hu Tao <[email protected]>
preallocation=falloc allocates disk space by posix_fallocate(), preallocation=full allocates disk space by writing zeros to disk. Both modes imply preallocation=metadata.
--- block/qcow2.c | 63 ++++++++++++++++++++++++++++++++++++++-------- qemu-doc.texi | 8 +++--- qemu-img.texi | 8 +++--- tests/qemu-iotests/082.out | 54 +++++++++++++++++++-------------------- 4 files changed, 90 insertions(+), 43 deletions(-)
block/qcow2.c +53 -10
@@ -1772,6 +1772,56 @@ static int qcow2_create2(const char *filename, int64_t total_size,Error *local_err =NULL ;int ret; +if (prealloc ==PREALLOC_MODE_FULL || prealloc ==PREALLOC_MODE_FALLOC ) { +int64_t meta_size =0 ; +uint64_t nreftablee, nrefblocke, nl1e, nl2e; +int64_t aligned_total_size =align_offset (total_size, cluster_size); + +/* header: 1 cluster */ + meta_size += cluster_size; + +/* total size of L2 tables */ + nl2e = aligned_total_size / cluster_size; + nl2e =align_offset (nl2e, cluster_size /sizeof (uint64_t )); + meta_size += nl2e *sizeof (uint64_t ); + +/* total size of L1 tables */ + nl1e = nl2e *sizeof (uint64_t ) / cluster_size; + nl1e =align_offset (nl1e, cluster_size /sizeof (uint64_t )); + meta_size += nl1e *sizeof (uint64_t ); + +/* total size of refcount blocks +* +* note: every host cluster is reference-counted, including metadata +* (even refcount blocks are recursively included). +* Let: +* a = total_size (this is the guest disk size) +* m = meta size not including refcount blocks and refcount tables +* c = cluster size +* y1 = number of refcount blocks entries +* y2 = meta size including everything +* then, +* y1 = (y2 + a)/c +* y2 = y1 * sizeof(u16) + y1 * sizeof(u16) * sizeof(u64) / c + m +* we can get y1: +* y1 = (a + m) / (c - sizeof(u16) - sizeof(u16) * sizeof(u64) / c) +*/ + nrefblocke = (aligned_total_size + meta_size + cluster_size) / + (cluster_size -sizeof (uint16_t ) - +1.0 *sizeof (uint16_t ) *sizeof (uint64_t ) / cluster_size); + nrefblocke =align_offset (nrefblocke, cluster_size /sizeof (uint16_t )); + meta_size += nrefblocke *sizeof (uint16_t ); + +/* total size of refcount tables */ + nreftablee = nrefblocke *sizeof (uint16_t ) / cluster_size; + nreftablee =align_offset (nreftablee, cluster_size /sizeof (uint64_t )); + meta_size += nreftablee *sizeof (uint64_t ); + +qemu_opt_set_number (opts,BLOCK_OPT_SIZE , + aligned_total_size + meta_size); +qemu_opt_set (opts,BLOCK_OPT_PREALLOC , PreallocMode_lookup[prealloc]); + } + ret =bdrv_create_file (filename, opts, &local_err);if (ret <0 ) {error_propagate (errp, local_err);
@@ -1877,7 +1927,7 @@ static int qcow2_create2(const char *filename, int64_t total_size, }/* And if we're supposed to preallocate metadata, do that now */ -if (prealloc ==PREALLOC_MODE_METADATA ) { +if (prealloc !=PREALLOC_MODE_OFF ) {BDRVQcowState *s = bs->opaque;qemu_co_mutex_lock (&s->lock); ret =preallocate (bs);
@@ -1958,14 +2008,6 @@ static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp) flags |=BLOCK_FLAG_LAZY_REFCOUNTS ; } -if (prealloc !=PREALLOC_MODE_OFF && - prealloc !=PREALLOC_MODE_METADATA ) { - ret = -EINVAL ; -error_setg (errp,"Unsupported preallocate mode: %s" , - PreallocMode_lookup[prealloc]); - goto finish; - } -if (backing_file && prealloc !=PREALLOC_MODE_OFF ) {error_setg (errp,"Backing file and preallocation cannot be used at " "the same time" );
@@ -2526,7 +2568,8 @@ static QemuOptsList qcow2_create_opts = { { .name = BLOCK_OPT_PREALLOC, .type = QEMU_OPT_STRING, - .help ="Preallocation mode (allowed values: off, metadata)" + .help ="Preallocation mode (allowed values: off, metadata, " +"falloc, full)" }, { .name = BLOCK_OPT_LAZY_REFCOUNTS,
qemu-doc.texi +5 -3
@@ -584,9 +584,11 @@ sizes can improve the image file size whereas larger cluster sizes generally provide better performance. @item preallocation -Preallocation mode (allowed values: off, metadata). An image with preallocated -metadata is initially larger but can improve performance when the image needs -to grow. +Preallocation mode (allowed values: @code{off}, @code{metadata}, @code{falloc}, +@code{full}). An image with preallocated metadata is initially larger but can +improve performance when the image needs to grow. @code{falloc} and @code{full} +preallocations are like the same options of @code{raw} format, but sets up +metadata also. @item lazy_refcounts If this option is set to @code{on}, reference count updates are postponed with
qemu-img.texi +5 -3
@@ -476,9 +476,11 @@ sizes can improve the image file size whereas larger cluster sizes generally provide better performance. @item preallocation -Preallocation mode (allowed values: off, metadata). An image with preallocated -metadata is initially larger but can improve performance when the image needs -to grow. +Preallocation mode (allowed values: @code{off}, @code{metadata}, @code{falloc}, +@code{full}). An image with preallocated metadata is initially larger but can +improve performance when the image needs to grow. @code{falloc} and @code{full} +preallocations are like the same options of @code{raw} format, but sets up +metadata also. @item lazy_refcounts If this option is set to @code{on}, reference count updates are postponed with
tests/qemu-iotests/082.out +27 -27
216 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Peter Maydell
AppliedQuoted 9 lines · Kevin Wolf
The following changes since commit
10601bef566461efbea81ee344ed3355ce71954a:Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-signed' into staging (2014-09-09 15:08:05 +0100)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.gittags/for-upstream
Quoted 8 lines
for you to fetch changes up to
0e4271b711a8ea766d29824c844e268b91ac3ae5:qcow2: Add falloc and full preallocation option (2014-09-12 15:43:06 +0200)
----------------------------------------------------------------
Block patches----------------------------------------------------------------
Applied, thanks.
-- PMM