mirror of https://gitee.com/openkylin/qemu.git
hw/block/nvme: consider metadata read aio return value in compare
Currently in compare command metadata aio read blk_aio_preadv return
value ignored. Consider it and complete the block accounting.
Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Fixes: 0a384f923f
("hw/block/nvme: add compare command")
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
This commit is contained in:
parent
9a31c61583
commit
b4a9832393
|
@ -2369,10 +2369,19 @@ static void nvme_compare_mdata_cb(void *opaque, int ret)
|
||||||
uint32_t reftag = le32_to_cpu(rw->reftag);
|
uint32_t reftag = le32_to_cpu(rw->reftag);
|
||||||
struct nvme_compare_ctx *ctx = req->opaque;
|
struct nvme_compare_ctx *ctx = req->opaque;
|
||||||
g_autofree uint8_t *buf = NULL;
|
g_autofree uint8_t *buf = NULL;
|
||||||
|
BlockBackend *blk = ns->blkconf.blk;
|
||||||
|
BlockAcctCookie *acct = &req->acct;
|
||||||
|
BlockAcctStats *stats = blk_get_stats(blk);
|
||||||
uint16_t status = NVME_SUCCESS;
|
uint16_t status = NVME_SUCCESS;
|
||||||
|
|
||||||
trace_pci_nvme_compare_mdata_cb(nvme_cid(req));
|
trace_pci_nvme_compare_mdata_cb(nvme_cid(req));
|
||||||
|
|
||||||
|
if (ret) {
|
||||||
|
block_acct_failed(stats, acct);
|
||||||
|
nvme_aio_err(req, ret);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
buf = g_malloc(ctx->mdata.iov.size);
|
buf = g_malloc(ctx->mdata.iov.size);
|
||||||
|
|
||||||
status = nvme_bounce_mdata(n, buf, ctx->mdata.iov.size,
|
status = nvme_bounce_mdata(n, buf, ctx->mdata.iov.size,
|
||||||
|
@ -2421,6 +2430,8 @@ static void nvme_compare_mdata_cb(void *opaque, int ret)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
block_acct_done(stats, acct);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
qemu_iovec_destroy(&ctx->data.iov);
|
qemu_iovec_destroy(&ctx->data.iov);
|
||||||
g_free(ctx->data.bounce);
|
g_free(ctx->data.bounce);
|
||||||
|
|
Loading…
Reference in New Issue