From: hare@suse.de (Hannes Reinecke)
Subject: [PATCH 2/6] nvme-ioctl: retrieve log pages in 4k chunks
Date: Thu, 20 Sep 2018 11:09:35 +0200 [thread overview]
Message-ID: <20180920090939.6348-3-hare@suse.de> (raw)
In-Reply-To: <20180920090939.6348-1-hare@suse.de>
Some log pages increase with the scale of the subsystem, so the
overall size might be larger than the MDTS value for that controller.
In order to avoid having to pass in the MDTS value we should restrict
the transfer size to 4k and retrieve the log page in 4k chunks.
Signed-off-by: Hannes Reinecke <hare at suse.com>
---
nvme-ioctl.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/nvme-ioctl.c b/nvme-ioctl.c
index 03842d2..b168699 100644
--- a/nvme-ioctl.c
+++ b/nvme-ioctl.c
@@ -421,8 +421,30 @@ int nvme_get_log13(int fd, __u32 nsid, __u8 log_id, __u8 lsp, __u64 lpo,
int nvme_get_log(int fd, __u32 nsid, __u8 log_id, __u32 data_len, void *data)
{
- return nvme_get_log13(fd, nsid, log_id, NVME_NO_LOG_LSP, NVME_NO_LOG_LPO,
- 0, 0, data_len, data);
+ void *ptr = data;
+ __u32 offset = 0, xfer_len = data_len;
+ int ret;
+
+ /*
+ * 4k is the smallest possible transfer unit, so by
+ * restricting ourselves for 4k transfers we avoid having
+ * to check the MDTS value of the controller.
+ */
+ do {
+ xfer_len = data_len - offset;
+ if (xfer_len > 4096)
+ xfer_len = 4096;
+
+ ret = nvme_get_log13(fd, nsid, log_id, NVME_NO_LOG_LSP,
+ offset, 0, false, xfer_len, ptr);
+ if (ret)
+ return ret;
+
+ offset += xfer_len;
+ ptr += xfer_len;
+ } while (offset < data_len);
+
+ return 0;
}
int nvme_get_telemetry_log(int fd, void *lp, int generate_report,
--
2.13.7
next prev parent reply other threads:[~2018-09-20 9:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-20 9:09 [PATCH 0/6] nvme-cli: fixup large log page transfer Hannes Reinecke
2018-09-20 9:09 ` [PATCH 1/6] nvme-discover: Retry discovery log if the generation counter changes Hannes Reinecke
2018-09-20 9:09 ` Hannes Reinecke [this message]
2018-09-20 9:09 ` [PATCH 3/6] nvme-discover: Re-check generation counter after log page transfer Hannes Reinecke
2018-09-20 9:09 ` [PATCH 4/6] seagate-nvme: fixup coding style Hannes Reinecke
2018-09-20 9:09 ` [PATCH 5/6] nvme-cli: Add 'rae' argument to nvme_get_log() Hannes Reinecke
2018-09-20 9:09 ` [PATCH 6/6] nvme-cli: kill nvme_passthru_admin() Hannes Reinecke
2018-09-20 15:22 ` [PATCH 0/6] nvme-cli: fixup large log page transfer Keith Busch
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=20180920090939.6348-3-hare@suse.de \
--to=hare@suse.de \
/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).