From a0c7756dddc6a9d13febba3f35dd2080307f574e Mon Sep 17 00:00:00 2001 From: Hans Holmberg Date: Fri, 19 Jun 2020 13:52:32 +0000 Subject: [PATCH] Add warning if not all zone changed list entries are retrieved. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The Changed Zone List only support reporting of a maximum of 511 entries. Signed-off-by: Hans Holmberg Signed-off-by: Matias Bjørling --- nvme-print.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nvme-print.c b/nvme-print.c index 6227c34..f58e4c3 100644 --- a/nvme-print.c +++ b/nvme-print.c @@ -2959,7 +2959,7 @@ void nvme_show_zns_id_ns(struct nvme_zns_id_ns *ns, ns->lbafe[i].zdes, i == lbaf ? " (in use)" : ""); } -void nvme_show_zns_changed( struct nvme_zns_changed_zone_log *log, +void nvme_show_zns_changed(struct nvme_zns_changed_zone_log *log, unsigned long flags) { uint16_t nrzid; @@ -2970,9 +2970,14 @@ void nvme_show_zns_changed( struct nvme_zns_changed_zone_log *log, nrzid = le16_to_cpu(log->nrzid); printf("NVMe Changed Zone List:\n"); - printf("nrzid: %u\n", nrzid); - for (i = 0; i < min(nrzid, (uint16_t)NVME_ZNS_CHANGED_ZONES_MAX); i++) + if (nrzid == 0xFFFF) { + printf("Too many zones have changed to fit into the log. Use report zones for changes.\n"); + return; + } + + printf("nrzid: %u\n", nrzid); + for (i = 0; i < nrzid; i++) printf("zid %03d: %"PRIu64"\n", i, (uint64_t)le64_to_cpu(log->zid[i])); } -- 2.49.0