From: Klaus Jensen <its@irrelevant.dk>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <fam@euphon.net>,
qemu-block@nongnu.org, Klaus Jensen <k.jensen@samsung.com>,
Gollu Appalanaidu <anaidu.gollu@samsung.com>,
Max Reitz <mreitz@redhat.com>, Klaus Jensen <its@irrelevant.dk>,
Minwoo Im <minwoo.im.dev@gmail.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Keith Busch <kbusch@kernel.org>
Subject: [PATCH v4 01/12] hw/block/nvme: remove redundant len member in compare context
Date: Mon, 1 Mar 2021 15:00:36 +0100 [thread overview]
Message-ID: <20210301140047.106261-2-its@irrelevant.dk> (raw)
In-Reply-To: <20210301140047.106261-1-its@irrelevant.dk>
From: Klaus Jensen <k.jensen@samsung.com>
The 'len' member of the nvme_compare_ctx struct is redundant since the
same information is available in the 'iov' member.
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
---
hw/block/nvme.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index edd0b85c10ce..baa69a4a6859 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -1697,7 +1697,6 @@ static void nvme_aio_copy_in_cb(void *opaque, int ret)
struct nvme_compare_ctx {
QEMUIOVector iov;
uint8_t *bounce;
- size_t len;
};
static void nvme_compare_cb(void *opaque, int ret)
@@ -1718,16 +1717,16 @@ static void nvme_compare_cb(void *opaque, int ret)
goto out;
}
- buf = g_malloc(ctx->len);
+ buf = g_malloc(ctx->iov.size);
- status = nvme_dma(nvme_ctrl(req), buf, ctx->len, DMA_DIRECTION_TO_DEVICE,
- req);
+ status = nvme_dma(nvme_ctrl(req), buf, ctx->iov.size,
+ DMA_DIRECTION_TO_DEVICE, req);
if (status) {
req->status = status;
goto out;
}
- if (memcmp(buf, ctx->bounce, ctx->len)) {
+ if (memcmp(buf, ctx->bounce, ctx->iov.size)) {
req->status = NVME_CMP_FAILURE;
}
@@ -1964,7 +1963,6 @@ static uint16_t nvme_compare(NvmeCtrl *n, NvmeRequest *req)
ctx = g_new(struct nvme_compare_ctx, 1);
ctx->bounce = bounce;
- ctx->len = len;
req->opaque = ctx;
--
2.30.1
next prev parent reply other threads:[~2021-03-01 14:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-01 14:00 [PATCH v4 00/12] hw/block/nvme: metadata and end-to-end data protection support Klaus Jensen
2021-03-01 14:00 ` Klaus Jensen [this message]
2021-03-01 14:00 ` [PATCH v4 02/12] hw/block/nvme: remove block accounting for write zeroes Klaus Jensen
2021-03-01 14:00 ` [PATCH v4 03/12] hw/block/nvme: fix strerror printing Klaus Jensen
2021-03-01 14:00 ` [PATCH v4 04/12] hw/block/nvme: try to deal with the iov/qsg duality Klaus Jensen
2021-03-01 14:00 ` [PATCH v4 05/12] hw/block/nvme: remove the req dependency in map functions Klaus Jensen
2021-03-01 14:00 ` [PATCH v4 06/12] hw/block/nvme: refactor nvme_dma Klaus Jensen
2021-03-01 14:00 ` [PATCH v4 07/12] hw/block/nvme: add metadata support Klaus Jensen
2021-03-01 14:00 ` [PATCH v4 08/12] hw/block/nvme: end-to-end data protection Klaus Jensen
2021-03-01 14:00 ` [PATCH v4 09/12] hw/block/nvme: add verify command Klaus Jensen
2021-03-01 14:00 ` [PATCH v4 10/12] hw/block/nvme: add non-mdts command size limit for verify Klaus Jensen
2021-03-01 14:00 ` [PATCH v4 11/12] hw/block/nvme: support multiple lba formats Klaus Jensen
2021-03-01 14:00 ` [PATCH v4 12/12] hw/block/nvme: add support for the format nvm command Klaus Jensen
2021-03-01 18:58 ` [PATCH v4 00/12] hw/block/nvme: metadata and end-to-end data protection support Keith Busch
2021-03-08 11:32 ` Klaus Jensen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210301140047.106261-2-its@irrelevant.dk \
--to=its@irrelevant.dk \
--cc=anaidu.gollu@samsung.com \
--cc=fam@euphon.net \
--cc=k.jensen@samsung.com \
--cc=kbusch@kernel.org \
--cc=kwolf@redhat.com \
--cc=minwoo.im.dev@gmail.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).