diff options
author | Olaf Hering | 2014-02-20 18:57:13 +0100 |
---|---|---|
committer | Stefano Stabellini | 2014-02-20 18:57:13 +0100 |
commit | 58da5b1e01a586eb5a52ba3eec342d6828269839 (patch) | |
tree | e8f6f557e461227ad7d6b4a45e68b2221e4bab2b /hw/block | |
parent | Call pci_piix3_xen_ide_unplug from unplug_disks (diff) | |
download | qemu-58da5b1e01a586eb5a52ba3eec342d6828269839.tar.gz qemu-58da5b1e01a586eb5a52ba3eec342d6828269839.tar.xz qemu-58da5b1e01a586eb5a52ba3eec342d6828269839.zip |
xen_disk: fix io accounting
bdrv_acct_done was called unconditional. But in case the ioreq has no
segments there is no matching bdrv_acct_start call. This could lead to
bogus accounting values.
Found by code inspection.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'hw/block')
-rw-r--r-- | hw/block/xen_disk.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index 098f6c62c7..7f0f14ae52 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -483,7 +483,18 @@ static void qemu_aio_complete(void *opaque, int ret) ioreq->status = ioreq->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY; ioreq_unmap(ioreq); ioreq_finish(ioreq); - bdrv_acct_done(ioreq->blkdev->bs, &ioreq->acct); + switch (ioreq->req.operation) { + case BLKIF_OP_WRITE: + case BLKIF_OP_FLUSH_DISKCACHE: + if (!ioreq->req.nr_segments) { + break; + } + case BLKIF_OP_READ: + bdrv_acct_done(ioreq->blkdev->bs, &ioreq->acct); + break; + default: + break; + } qemu_bh_schedule(ioreq->blkdev->bh); } |