[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 14/21] nvme: Account for failed and invalid opera
From: |
Alberto Garcia |
Subject: |
[Qemu-devel] [PATCH v3 14/21] nvme: Account for failed and invalid operations |
Date: |
Thu, 22 Oct 2015 11:11:24 +0300 |
Signed-off-by: Alberto Garcia <address@hidden>
---
hw/block/nvme.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 5da41b2..169e4fa 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -201,10 +201,11 @@ static void nvme_rw_cb(void *opaque, int ret)
NvmeCtrl *n = sq->ctrl;
NvmeCQueue *cq = n->cq[sq->cqid];
- block_acct_done(blk_get_stats(n->conf.blk), &req->acct);
if (!ret) {
+ block_acct_done(blk_get_stats(n->conf.blk), &req->acct);
req->status = NVME_SUCCESS;
} else {
+ block_acct_failed(blk_get_stats(n->conf.blk), &req->acct);
req->status = NVME_INTERNAL_DEV_ERROR;
}
if (req->has_sg) {
@@ -238,18 +239,22 @@ static uint16_t nvme_rw(NvmeCtrl *n, NvmeNamespace *ns,
NvmeCmd *cmd,
uint64_t data_size = (uint64_t)nlb << data_shift;
uint64_t aio_slba = slba << (data_shift - BDRV_SECTOR_BITS);
int is_write = rw->opcode == NVME_CMD_WRITE ? 1 : 0;
+ enum BlockAcctType acct = is_write ? BLOCK_ACCT_WRITE : BLOCK_ACCT_READ;
if ((slba + nlb) > ns->id_ns.nsze) {
+ block_acct_invalid(blk_get_stats(n->conf.blk), acct);
return NVME_LBA_RANGE | NVME_DNR;
}
+
if (nvme_map_prp(&req->qsg, prp1, prp2, data_size, n)) {
+ block_acct_invalid(blk_get_stats(n->conf.blk), acct);
return NVME_INVALID_FIELD | NVME_DNR;
}
+
assert((nlb << data_shift) == req->qsg.size);
req->has_sg = true;
- dma_acct_start(n->conf.blk, &req->acct, &req->qsg,
- is_write ? BLOCK_ACCT_WRITE : BLOCK_ACCT_READ);
+ dma_acct_start(n->conf.blk, &req->acct, &req->qsg, acct);
req->aiocb = is_write ?
dma_blk_write(n->conf.blk, &req->qsg, aio_slba, nvme_rw_cb, req) :
dma_blk_read(n->conf.blk, &req->qsg, aio_slba, nvme_rw_cb, req);
--
2.6.1
- [Qemu-devel] [PATCH v3 06/21] block: Add statistics for failed and invalid I/O operations, (continued)
- [Qemu-devel] [PATCH v3 06/21] block: Add statistics for failed and invalid I/O operations, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 05/21] block: Add idle_time_ns to BlockDeviceStats, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 04/21] util: Infrastructure for computing recent averages, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 09/21] block: Add average I/O queue depth to BlockDeviceTimedStats, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 21/21] block: Update copyright of the accounting code, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 12/21] block: Use QEMU_CLOCK_VIRTUAL for the accounting code in qtest mode, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 15/21] virtio-blk: Account for failed and invalid operations, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 19/21] macio: Account for failed operations, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 14/21] nvme: Account for failed and invalid operations,
Alberto Garcia <=
- [Qemu-devel] [PATCH v3 18/21] ide: Account for failed and invalid operations, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 17/21] atapi: Account for failed and invalid operations, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 11/21] qemu-io: Account for failed, invalid and flush operations, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 20/21] scsi-disk: Account for failed operations, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 13/21] iotests: Add test for the block device statistics, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 16/21] xen_disk: Account for failed and invalid operations, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v3 10/21] block: New option to define the intervals for collecting I/O statistics, Alberto Garcia, 2015/10/22
- Re: [Qemu-devel] [PATCH v3 00/21] Extended I/O accounting, Stefan Hajnoczi, 2015/10/23