From 51a54248be84fa716903ba5173594d9927ee76ed Mon Sep 17 00:00:00 2001 From: Klaus Jensen Date: Tue, 9 Mar 2021 14:22:50 +0100 Subject: [PATCH] zns: support piremap flag for zone append Add the '--piremap' / '-P' flag for zone-append. Signed-off-by: Klaus Jensen --- linux/nvme.h | 1 + plugins/zns/zns.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/linux/nvme.h b/linux/nvme.h index 16640ed1..355bcb04 100644 --- a/linux/nvme.h +++ b/linux/nvme.h @@ -1143,6 +1143,7 @@ enum { NVME_RW_DSM_LATENCY_LOW = 3 << 4, NVME_RW_DSM_SEQ_REQ = 1 << 6, NVME_RW_DSM_COMPRESSED = 1 << 7, + NVME_RW_PIREMAP = 1 << 9, NVME_RW_PRINFO_PRCHK_REF = 1 << 10, NVME_RW_PRINFO_PRCHK_APP = 1 << 11, NVME_RW_PRINFO_PRCHK_GUARD = 1 << 12, diff --git a/plugins/zns/zns.c b/plugins/zns/zns.c index 46f95f77..baf880fe 100644 --- a/plugins/zns/zns.c +++ b/plugins/zns/zns.c @@ -670,6 +670,7 @@ static int zone_append(int argc, char **argv, struct command *cmd, struct plugin const char *limited_retry = "limit media access attempts"; const char *fua = "force unit access"; const char *prinfo = "protection information action and checks field"; + const char *piremap = "protection information remap (for type 1 PI)"; const char *ref_tag = "reference tag (for end to end PI)"; const char *lbat = "logical block application tag (for end to end PI)"; const char *lbatm = "logical block application tag mask (for end to end PI)"; @@ -699,6 +700,7 @@ static int zone_append(int argc, char **argv, struct command *cmd, struct plugin __u16 lbat; __u16 lbatm; __u8 prinfo; + int piremap; int latency; }; @@ -718,6 +720,7 @@ static int zone_append(int argc, char **argv, struct command *cmd, struct plugin OPT_SHRT("app-tag-mask", 'm', &cfg.lbatm, lbatm), OPT_SHRT("app-tag", 'a', &cfg.lbat, lbat), OPT_BYTE("prinfo", 'p', &cfg.prinfo, prinfo), + OPT_FLAG("piremap", 'P', &cfg.piremap, piremap), OPT_FLAG("latency", 't', &cfg.latency, latency), OPT_END() }; @@ -823,6 +826,8 @@ static int zone_append(int argc, char **argv, struct command *cmd, struct plugin control |= NVME_RW_LR; if (cfg.fua) control |= NVME_RW_FUA; + if (cfg.piremap) + control |= NVME_RW_PIREMAP; gettimeofday(&start_time, NULL); err = nvme_zns_append(fd, cfg.namespace_id, cfg.zslba, nblocks, -- 2.50.1