From 2ff6aabb48f4524b0d6f43b0392d2d0b190dc7ee Mon Sep 17 00:00:00 2001 From: Steven Seungcheol Lee Date: Fri, 11 Feb 2022 16:02:18 +0900 Subject: [PATCH] nvme: fix dsm, dspec wrong usage dsm is 8bits on Command Dword13 [07:00] dspec should issued on nvme_io_args.dspec Signed-off-by: Steven Seungcheol Lee --- Documentation/nvme-compare.txt | 7 +++---- Documentation/nvme-read.txt | 6 +++--- Documentation/nvme-write.txt | 6 +++--- nvme.c | 12 ++++++------ 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Documentation/nvme-compare.txt b/Documentation/nvme-compare.txt index 4f651627..f082a33e 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 2d641371..8565431c 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 c730c92b..4ac46e03 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 c4d1be35..cc48aea9 100644 --- a/nvme.c +++ b/nvme.c @@ -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), @@ -6292,8 +6292,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, -- 2.50.1