Skip to content

Commit be36b9b

Browse files
kurz-migaw
authored andcommitted
src: rework nvme_zns_append command
libnvme changed the API for the nvme_zns_append command. Update the callsite accordingly. Signed-off-by: Markus Kurz <[email protected]>
1 parent 7a64202 commit be36b9b

1 file changed

Lines changed: 10 additions & 31 deletions

File tree

plugins/zns/zns.c

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -952,22 +952,21 @@ static int zone_append(int argc, char **argv, struct command *acmd, struct plugi
952952
const char *fua = "force unit access";
953953
const char *prinfo = "protection information action and checks field";
954954
const char *piremap = "protection information remap (for type 1 PI)";
955-
const char *ref_tag = "reference tag for end-to-end PI";
956-
const char *lbat = "logical block application tag for end-to-end PI";
957-
const char *lbatm = "logical block application tag mask for end-to-end PI";
958955
const char *metadata_size = "size of metadata in bytes";
959956
const char *data_size = "size of data in bytes";
960957
const char *latency = "output latency statistics";
961958

962-
int err = -1, dfd = STDIN_FILENO, mfd = STDIN_FILENO;
963-
_cleanup_nvme_global_ctx_ struct nvme_global_ctx *ctx = NULL;
964959
_cleanup_nvme_transport_handle_ struct nvme_transport_handle *hdl = NULL;
960+
_cleanup_nvme_global_ctx_ struct nvme_global_ctx *ctx = NULL;
961+
int err = -1, dfd = STDIN_FILENO, mfd = STDIN_FILENO;
962+
struct timeval start_time, end_time;
965963
unsigned int lba_size, meta_size;
966964
void *buf = NULL, *mbuf = NULL;
965+
struct nvme_passthru_cmd64 cmd;
967966
__u16 nblocks, control = 0;
968-
__u64 result;
967+
__u16 cev = 0, dspec = 0;
969968
__u8 lba_index;
970-
struct timeval start_time, end_time;
969+
__u64 result;
971970

972971
struct nvme_id_ns ns;
973972

@@ -980,9 +979,6 @@ static int zone_append(int argc, char **argv, struct command *acmd, struct plugi
980979
bool limited_retry;
981980
bool fua;
982981
__u32 namespace_id;
983-
__u64 ref_tag;
984-
__u16 lbat;
985-
__u16 lbatm;
986982
__u8 prinfo;
987983
bool piremap;
988984
bool latency;
@@ -999,9 +995,6 @@ static int zone_append(int argc, char **argv, struct command *acmd, struct plugi
999995
OPT_FILE("metadata", 'M', &cfg.metadata, metadata),
1000996
OPT_FLAG("limited-retry", 'l', &cfg.limited_retry, limited_retry),
1001997
OPT_FLAG("force-unit-access", 'f', &cfg.fua, fua),
1002-
OPT_SUFFIX("ref-tag", 'r', &cfg.ref_tag, ref_tag),
1003-
OPT_SHRT("app-tag-mask", 'm', &cfg.lbatm, lbatm),
1004-
OPT_SHRT("app-tag", 'a', &cfg.lbat, lbat),
1005998
OPT_BYTE("prinfo", 'p', &cfg.prinfo, prinfo),
1006999
OPT_FLAG("piremap", 'P', &cfg.piremap, piremap),
10071000
OPT_FLAG("latency", 't', &cfg.latency, latency),
@@ -1109,25 +1102,11 @@ static int zone_append(int argc, char **argv, struct command *acmd, struct plugi
11091102
if (cfg.piremap)
11101103
control |= NVME_IO_ZNS_APPEND_PIREMAP;
11111104

1112-
struct nvme_zns_append_args args = {
1113-
.args_size = sizeof(args),
1114-
.nsid = cfg.namespace_id,
1115-
.zslba = cfg.zslba,
1116-
.nlb = nblocks,
1117-
.control = control,
1118-
.ilbrt_u64 = cfg.ref_tag,
1119-
.lbat = cfg.lbat,
1120-
.lbatm = cfg.lbatm,
1121-
.data_len = cfg.data_size,
1122-
.data = buf,
1123-
.metadata_len = cfg.metadata_size,
1124-
.metadata = mbuf,
1125-
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
1126-
.result = &result,
1127-
};
1128-
11291105
gettimeofday(&start_time, NULL);
1130-
err = nvme_zns_append(hdl, &args);
1106+
nvme_init_zns_append(&cmd, cfg.namespace_id, cfg.zslba, nblocks,
1107+
control, cev, dspec, buf, cfg.data_size, mbuf,
1108+
cfg.metadata_size);
1109+
err = nvme_submit_admin_passthru64(hdl, &cmd, &result);
11311110
gettimeofday(&end_time, NULL);
11321111
if (cfg.latency)
11331112
printf(" latency: zone append: %llu us\n",

0 commit comments

Comments
 (0)