]> www.infradead.org Git - users/hch/nvme-cli.git/commitdiff
nvme.c: create-ns arguments are added
authorSteven Seungcheol Lee <sc108.lee@samsung.com>
Sat, 16 Nov 2019 05:34:14 +0000 (14:34 +0900)
committerKeith Busch <kbusch@kernel.org>
Mon, 18 Nov 2019 16:06:18 +0000 (01:06 +0900)
ANA Group Identifier, NVM Set Identifier
Its based on NVMe 1.4 Spec

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Documentation/nvme-create-ns.1
Documentation/nvme-create-ns.html
Documentation/nvme-create-ns.txt
nvme-ioctl.c
nvme-ioctl.h
nvme.c

index 24266c2b369a2ad3b54a226d3092c2fb0659b901..6f4e5deaf8f9b196348a198d6e15740c7b7e6de9 100644 (file)
@@ -1,13 +1,13 @@
 '\" t
 .\"     Title: nvme-create-ns
-.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
-.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\"      Date: 11/08/2019
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
+.\"      Date: 11/16/2019
 .\"    Manual: NVMe Manual
 .\"    Source: NVMe
 .\"  Language: English
 .\"
-.TH "NVME\-CREATE\-NS" "1" "11/08/2019" "NVMe" "NVMe Manual"
+.TH "NVME\-CREATE\-NS" "1" "11/16/2019" "NVMe" "NVMe Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -37,14 +37,23 @@ nvme-create-ns \- Send NVMe Namespace management command to create namespace, re
                         [\-\-flbas=<flbas> | \-f <flbas>]
                         [\-\-dps=<dps> | \-d <dps>]
                         [\-\-nmic=<nmic> | \-m <nmic>]
+                        [\-\-anagrp\-id=<anagrpid> | \-a <anagrpid>]
+                        [\-\-nvmset\-id=<nvmsetid> | \-i <nvmsetid>]
                         [\-\-block\-size=<block\-size> | \-b <block\-size>]
+                        [\-\-timeout=<timeout> | \-t <timeout>]
+DESCRIPTION
 .fi
-.SH "DESCRIPTION"
 .sp
-For the NVMe device given, sends a namespace management command to create the namespace with the requested settings\&. On success, the namespace identifier assigned by the controller is returned\&.
-.sp
-The <device> parameter is mandatory and may be either the NVMe character device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1)\&.
-.SH "OPTIONS"
+.nf
+For the NVMe device given, sends a namespace management command to create
+the namespace with the requested settings\&. On success, the namespace
+identifier assigned by the controller is returned\&.
+
+The <device> parameter is mandatory and may be either the NVMe character
+device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1)\&.
+
+OPTIONS
+.fi
 .PP
 \-s, \-\-nsze
 .RS 4
@@ -71,6 +80,16 @@ The data protection settings\&.
 Namespace multipath and sharing capabilities\&.
 .RE
 .PP
+\-a, \-\-anagrp\-id
+.RS 4
+ANA Gorup Identifier\&. If this value is 0h specifies that the controller determines the value to use
+.RE
+.PP
+\-i <nvmsetid>, \-\-nvmset_id=<nvmsetid>
+.RS 4
+This field specifies the identifier of the NVM Set\&.
+.RE
+.PP
 \-b, \-\-block\-size
 .RS 4
 Target block size the new namespace should be formatted as\&. Potential FLBAS values will be values will be scanned and the lowest numbered will be selected for the create\-ns operation\&. Conflicts with \-\-flbas argument\&.
index 05225d7ba97e7323a0a29ac8a9b4a90a1c733c6c..1ecc66eebdcb73ad2ca09183f25fd259ddf8da9d 100644 (file)
@@ -751,24 +751,24 @@ nvme-create-ns(1) Manual Page
                         [--flbas=&lt;flbas&gt; | -f &lt;flbas&gt;]\r
                         [--dps=&lt;dps&gt; | -d &lt;dps&gt;]\r
                         [--nmic=&lt;nmic&gt; | -m &lt;nmic&gt;]\r
-                        [--block-size=&lt;block-size&gt; | -b &lt;block-size&gt;]</pre>\r
+                        [--anagrp-id=&lt;anagrpid&gt; | -a &lt;anagrpid&gt;]\r
+                        [--nvmset-id=&lt;nvmsetid&gt; | -i &lt;nvmsetid&gt;]\r
+                        [--block-size=&lt;block-size&gt; | -b &lt;block-size&gt;]\r
+                        [--timeout=&lt;timeout&gt; | -t &lt;timeout&gt;]\r
+DESCRIPTION</pre>\r
 <div class="attribution">\r
 </div></div>\r
-</div>\r
-</div>\r
-<div class="sect1">\r
-<h2 id="_description">DESCRIPTION</h2>\r
-<div class="sectionbody">\r
-<div class="paragraph"><p>For the NVMe device given, sends a namespace management command to create\r
+<div class="listingblock">\r
+<div class="content">\r
+<pre><code>For the NVMe device given, sends a namespace management command to create\r
 the namespace with the requested settings. On success, the namespace\r
-identifier assigned by the controller is returned.</p></div>\r
-<div class="paragraph"><p>The &lt;device&gt; parameter is mandatory and may be either the NVMe character\r
-device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></div>\r
-</div>\r
-</div>\r
-<div class="sect1">\r
-<h2 id="_options">OPTIONS</h2>\r
-<div class="sectionbody">\r
+identifier assigned by the controller is returned.\r
+\r
+The &lt;device&gt; parameter is mandatory and may be either the NVMe character\r
+device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).\r
+\r
+OPTIONS</code></pre>\r
+</div></div>\r
 <div class="dlist"><dl>\r
 <dt class="hdlist1">\r
 -s\r
@@ -827,6 +827,29 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di
 </p>\r
 </dd>\r
 <dt class="hdlist1">\r
+-a\r
+</dt>\r
+<dt class="hdlist1">\r
+--anagrp-id\r
+</dt>\r
+<dd>\r
+<p>\r
+        ANA Gorup Identifier. If this value is 0h specifies\r
+        that the controller determines the value to use\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
+-i &lt;nvmsetid&gt;\r
+</dt>\r
+<dt class="hdlist1">\r
+--nvmset_id=&lt;nvmsetid&gt;\r
+</dt>\r
+<dd>\r
+<p>\r
+        This field specifies the identifier of the NVM Set.\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
 -b\r
 </dt>\r
 <dt class="hdlist1">\r
@@ -858,7 +881,7 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Last updated 2019-01-28 17:49:54 MST\r
+Last updated 2019-11-16 14:07:32 KST\r
 </div>\r
 </div>\r
 </body>\r
index dcf00a3fd3928b1a650df4a9e846ee60e5c3bb38..661b01b3a905857516f56b37e876883ab81697bb 100644 (file)
@@ -13,8 +13,10 @@ SYNOPSIS
                        [--flbas=<flbas> | -f <flbas>]
                        [--dps=<dps> | -d <dps>]
                        [--nmic=<nmic> | -m <nmic>]
+                       [--anagrp-id=<anagrpid> | -a <anagrpid>]
+                       [--nvmset-id=<nvmsetid> | -i <nvmsetid>]
                        [--block-size=<block-size> | -b <block-size>]
-
+                       [--timeout=<timeout> | -t <timeout>]
 DESCRIPTION
 -----------
 For the NVMe device given, sends a namespace management command to create
@@ -47,6 +49,15 @@ OPTIONS
 --nmic::
        Namespace multipath and sharing capabilities.
 
+-a::
+--anagrp-id::
+       ANA Gorup Identifier. If this value is 0h specifies
+       that the controller determines the value to use
+
+-i <nvmsetid>::
+--nvmset-id=<nvmsetid>::
+       This field specifies the identifier of the NVM Set.
+
 -b::
 --block-size::
        Target block size the new namespace should be formatted as. Potential FLBAS
index cdaca74e010af4b34bee0dd0d5a93cc204adb5c0..7456a89c854adcaa28ef78dcec26ba8baffd76a0 100644 (file)
@@ -667,8 +667,9 @@ int nvme_format(int fd, __u32 nsid, __u8 lbaf, __u8 ses, __u8 pi,
        return nvme_submit_admin_passthru(fd, &cmd);
 }
 
-int nvme_ns_create(int fd, __u64 nsze, __u64 ncap, __u8 flbas,
-                  __u8 dps, __u8 nmic, __u32 timeout, __u32 *result)
+int nvme_ns_create(int fd, __u64 nsze, __u64 ncap, __u8 flbas, __u8 dps,
+               __u8 nmic, __u32 anagrpid, __u16 nvmsetid,  __u32 timeout,
+               __u32 *result)
 {
        struct nvme_id_ns ns = {
                .nsze           = cpu_to_le64(nsze),
@@ -676,6 +677,8 @@ int nvme_ns_create(int fd, __u64 nsze, __u64 ncap, __u8 flbas,
                .flbas          = flbas,
                .dps            = dps,
                .nmic           = nmic,
+               .anagrpid       = anagrpid,
+               .nvmsetid       = nvmsetid,
        };
 
        struct nvme_admin_cmd cmd = {
index 50e5d960e325f7655365def15d665969217f8e8a..f8de98cd7986cc9595ea55f96655a025bfe9c3a8 100644 (file)
@@ -118,8 +118,9 @@ int nvme_get_feature(int fd, __u32 nsid, __u8 fid, __u8 sel,
 int nvme_format(int fd, __u32 nsid, __u8 lbaf, __u8 ses, __u8 pi,
                __u8 pil, __u8 ms, __u32 timeout);
 
-int nvme_ns_create(int fd, __u64 nsze, __u64 ncap, __u8 flbas,
-                  __u8 dps, __u8 nmic, __u32 timeout, __u32 *result);
+int nvme_ns_create(int fd, __u64 nsze, __u64 ncap, __u8 flbas, __u8 dps,
+               __u8 nmic, __u32 anagrpid, __u16 nvmsetid,  __u32 timeout,
+               __u32 *result);
 int nvme_ns_delete(int fd, __u32 nsid, __u32 timeout);
 
 int nvme_ns_attachment(int fd, __u32 nsid, __u16 num_ctrls,
diff --git a/nvme.c b/nvme.c
index 81ecac7c5d569355182b58f5908ca9e1ecd48194..4803410928d2e9340b73ad5e40a2b9d075799f1a 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -1141,6 +1141,8 @@ static int create_ns(int argc, char **argv, struct command *cmd, struct plugin *
        const char *flbas = "FLBA size";
        const char *dps = "data protection capabilities";
        const char *nmic = "multipath and sharing capabilities";
+       const char *anagrpid = "ANA Group Identifier";
+       const char *nvmsetid = "NVM Set Identifier";
        const char *timeout = "timeout value, in milliseconds";
        const char *bs = "target block size";
 
@@ -1154,24 +1156,30 @@ static int create_ns(int argc, char **argv, struct command *cmd, struct plugin *
                __u8    flbas;
                __u8    dps;
                __u8    nmic;
+               __u32   anagrpid;
+               __u16   nvmsetid;
                __u64   bs;
                __u32   timeout;
        };
 
        struct config cfg = {
                .flbas          = 0xff,
+               .anagrpid       = 0,
+               .nvmsetid       = 0,
                .bs             = 0x00,
                .timeout        = NVME_IOCTL_TIMEOUT,
        };
 
        OPT_ARGS(opts) = {
-               OPT_SUFFIX("nsze",       's', &cfg.nsze,    nsze),
-               OPT_SUFFIX("ncap",       'c', &cfg.ncap,    ncap),
-               OPT_BYTE("flbas",        'f', &cfg.flbas,   flbas),
-               OPT_BYTE("dps",          'd', &cfg.dps,     dps),
-               OPT_BYTE("nmic",         'm', &cfg.nmic,    nmic),
-               OPT_SUFFIX("block-size", 'b', &cfg.bs,      bs),
-               OPT_UINT("timeout",      't', &cfg.timeout, timeout),
+               OPT_SUFFIX("nsze",       's', &cfg.nsze,     nsze),
+               OPT_SUFFIX("ncap",       'c', &cfg.ncap,     ncap),
+               OPT_BYTE("flbas",        'f', &cfg.flbas,    flbas),
+               OPT_BYTE("dps",          'd', &cfg.dps,      dps),
+               OPT_BYTE("nmic",         'm', &cfg.nmic,     nmic),
+               OPT_UINT("anagrp-id",    'a', &cfg.anagrpid, anagrpid),
+               OPT_UINT("nvmset-id",    'i', &cfg.nvmsetid, nvmsetid),
+               OPT_SUFFIX("block-size", 'b', &cfg.bs,       bs),
+               OPT_UINT("timeout",      't', &cfg.timeout,  timeout),
                OPT_END()
        };
 
@@ -1222,9 +1230,8 @@ static int create_ns(int argc, char **argv, struct command *cmd, struct plugin *
                goto close_fd;
        }
 
-
-       err = nvme_ns_create(fd, cfg.nsze, cfg.ncap, cfg.flbas, cfg.dps,
-                            cfg.nmic, cfg.timeout, &nsid);
+       err = nvme_ns_create(fd, cfg.nsze, cfg.ncap, cfg.flbas, cfg.dps, cfg.nmic,
+                           cfg.anagrpid, cfg.nvmsetid, cfg.timeout, &nsid);
        if (!err)
                printf("%s: Success, created nsid:%d\n", cmd->name, nsid);
        else if (err > 0)