diff --git a/Documentation/nvme-compare.txt b/Documentation/nvme-compare.txt index 4f65162775..f082a33e1a 100644 --- a/Documentation/nvme-compare.txt +++ b/Documentation/nvme-compare.txt @@ -118,15 +118,14 @@ metadata is passes. -D :: --dsm=:: - The optional data set management attributes for this command. The - argument for this is the lower 16 bits of the DSM field in a write - command; the upper 16 bits of the field come from the directive + The optional data set management attributes for this command. The argument + for this is the least significant 8 bits of the DSM field in a write + command; the most significant 16 bits of the field come from the directive specific field, if used. This may be used to set attributes for the LBAs being written, like access frequency, type, latency, among other things, as well as yet to be defined types. Please consult the NVMe specification for detailed breakdown of how to use this field. - -v:: --show-cmd:: Print out the command to be sent. diff --git a/Documentation/nvme-read.txt b/Documentation/nvme-read.txt index 2d64137113..8565431cc5 100644 --- a/Documentation/nvme-read.txt +++ b/Documentation/nvme-read.txt @@ -107,9 +107,9 @@ metadata is passes. -D :: --dsm=:: - The optional data set management attributes for this command. The - argument for this is the lower 16 bits of the DSM field in a write - command; the upper 16 bits of the field come from the directive + The optional data set management attributes for this command. The argument + for this is the least significant 8 bits of the DSM field in a write + command; the most significant 16 bits of the field come from the directive specific field, if used. This may be used to set attributes for the LBAs being written, like access frequency, type, latency, among other things, as well as yet to be defined types. Please diff --git a/Documentation/nvme-write.txt b/Documentation/nvme-write.txt index c730c92b84..4ac46e030b 100644 --- a/Documentation/nvme-write.txt +++ b/Documentation/nvme-write.txt @@ -115,9 +115,9 @@ metadata is passes. -D :: --dsm=:: - The optional data set management attributes for this command. The - argument for this is the lower 16 bits of the DSM field in a write - command; the upper 16 bits of the field come from the directive + The optional data set management attributes for this command. The argument + for this is the least significant 8 bits of the DSM field in a write + command; the most significant 16 bits of the field come from the directive specific field, if used. This may be used to set attributes for the LBAs being written, like access frequency, type, latency, among other things, as well as yet to be defined types. Please diff --git a/nvme.c b/nvme.c index c4d1be352d..7e6f10176e 100644 --- a/nvme.c +++ b/nvme.c @@ -6031,7 +6031,7 @@ static int submit_io(int opcode, char *command, const char *desc, int flags = opcode & 1 ? O_RDONLY : O_WRONLY | O_CREAT; int mode = S_IRUSR | S_IWUSR |S_IRGRP | S_IWGRP| S_IROTH; __u16 control = 0; - __u32 dsmgmt = 0, nsid = 0; + __u32 dsmgmt = 0; int logical_block_size = 0; long long buffer_size = 0, mbuffer_size = 0; bool huge; @@ -6056,7 +6056,7 @@ static int submit_io(int opcode, char *command, const char *desc, const char *dry = "show command instead of sending"; const char *dtype = "directive type (for write-only)"; const char *dspec = "directive specific (for write-only)"; - const char *dsm = "dataset management attributes (lower 16 bits)"; + const char *dsm = "dataset management attributes (lower 8 bits)"; const char *storage_tag_check = "This bit specifies the Storage Tag field shall be " \ "checked as part of end-to-end data protection processing"; const char *storage_tag = "storage tag, CDW2 and CDW3 (00:47) bits "\ @@ -6073,9 +6073,9 @@ static int submit_io(int opcode, char *command, const char *desc, char *data; char *metadata; __u8 prinfo; - __u8 dtype; + __u8 dtype; __u16 dspec; - __u16 dsmgmt; + __u8 dsmgmt; __u16 app_tag_mask; __u16 app_tag; __u64 storage_tag; @@ -6123,7 +6123,7 @@ static int submit_io(int opcode, char *command, const char *desc, OPT_FLAG("storage-tag-check", 'C', &cfg.storage_tag_check, storage_tag_check), OPT_BYTE("dir-type", 'T', &cfg.dtype, dtype), OPT_SHRT("dir-spec", 'S', &cfg.dspec, dspec), - OPT_SHRT("dsm", 'D', &cfg.dsmgmt, dsm), + OPT_BYTE("dsm", 'D', &cfg.dsmgmt, dsm), OPT_FLAG("show-command", 'v', &cfg.show, show), OPT_FLAG("dry-run", 'w', &cfg.dry_run, dry), OPT_FLAG("latency", 't', &cfg.latency, latency), @@ -6144,7 +6144,6 @@ static int submit_io(int opcode, char *command, const char *desc, fprintf(stderr, "get-namespace-id: %s\n", nvme_strerror(errno)); goto close_fd; } - err = -1; } dfd = mfd = opcode & 1 ? STDIN_FILENO : STDOUT_FILENO; @@ -6216,12 +6215,7 @@ static int submit_io(int opcode, char *command, const char *desc, } if (cfg.metadata_size) { - err = nvme_get_nsid(fd, &nsid); - if (err < 0) { - fprintf(stderr, "get-namespace-id: %s\n", nvme_strerror(errno)); - goto close_mfd; - } - err = nvme_identify_ns(fd, nsid, &ns); + err = nvme_identify_ns(fd, cfg.namespace_id, &ns); if (err) { nvme_show_status(err); goto free_buffer; @@ -6266,7 +6260,7 @@ static int submit_io(int opcode, char *command, const char *desc, } } - if (cfg.show) { + if (cfg.show || cfg.dry_run) { printf("opcode : %02x\n", opcode); printf("nsid : %02x\n", cfg.namespace_id); printf("flags : %02x\n", 0); @@ -6292,8 +6286,8 @@ static int submit_io(int opcode, char *command, const char *desc, .slba = cfg.start_block, .nlb = cfg.block_count, .control = control, - .dsm = dsmgmt, - .dspec = 0, + .dsm = cfg.dsmgmt, + .dspec = cfg.dspec, .reftag = cfg.ref_tag, .apptag = cfg.app_tag, .appmask = cfg.app_tag_mask, @@ -7180,7 +7174,7 @@ static int passthru(int argc, char **argv, bool admin, } } - if (cfg.show_command) { + if (cfg.show_command || cfg.dry_run) { printf("opcode : %02x\n", cfg.opcode); printf("flags : %02x\n", cfg.flags); printf("rsvd1 : %04x\n", cfg.rsvd); diff --git a/subprojects/libnvme.wrap b/subprojects/libnvme.wrap index d9f050c576..9fc7f6f592 100644 --- a/subprojects/libnvme.wrap +++ b/subprojects/libnvme.wrap @@ -1,6 +1,6 @@ [wrap-git] url = https://github.com/linux-nvme/libnvme.git -revision = ee30b6824f1209417e314d2c5b2e8d22b8707b6e +revision = 6d38953853c989c2312b755932c0af570257836e [provide] libnvme = libnvme_dep