[--nvmset-id=<nvmsetid> | -i <nvmsetid>]
[--csi=<command_set_identifier> | -y <command_set_identifier>]
[--lbstm=<lbstm> | -l <lbstm>]
+ [--nphndls=<nphndls> | -n <nphndls>]
[--block-size=<block-size> | -b <block-size>]
[--timeout=<timeout> | -t <timeout>]
[--nsze-si=<nsze-si> | -S <nsze-si>]
[--ncap-si=<ncap-si> | -C <ncap-si>]
+ [--phndls=<placement-handle-list,> | -p <placement-handle-list,>]
DESCRIPTION
-----------
--lbstm=<lbstm>::
Logical Block Storage Tag Mask for end-to-end protection.
+-n <nphndls>::
+--nphndls=<nphndls>::
+ Number of Placement Handle included in the Placement Handle List.
+ If the Flexible Data Placement capability is not supported or not enabled
+ in specified Endurance Group, then the controller shall ignore this field.
+
-b::
--block-size::
Target block size the new namespace should be formatted as. Potential FLBAS
The value SI suffixed is divided by the namespace LBA size to set as NCAP.
If the value not suffixed it is set as same with the ncap option.
+-p <placement-handle-list,>::
+--phndls=<placement-handle-list,>::
+ The comma separated list of Reclaim Unit Handle Identifier to be associated
+ with each Placement Handle.
+
EXAMPLES
--------
* Create a namespace:
opts+=" --nsze= -s --ncap= -c --flbas= -f \
--dps= -d --nmic= -m --anagrp-id= -a --nvmset-id= -i \
--block-size= -b --timeout= -t --csi= -y --lbstm= -l \
- --nsze-si= -S --ncap-si= -C"
+ --nphndls= -n --nsze-si= -S --ncap-si= -C --phndls= -p"
;;
"delete-ns")
opts+=" -namespace-id= -n --timeout= -t"
/* The MI & direct interfaces don't have an exactly-matching API for
* ns_mgmt_create, as we don't support a timeout for MI.
*/
-int nvme_cli_ns_mgmt_create(struct nvme_dev *dev, struct nvme_id_ns *ns,
+int nvme_cli_ns_mgmt_create(struct nvme_dev *dev,
+ struct nvme_ns_mgmt_host_sw_specified *data,
__u32 *nsid, __u32 timeout, __u8 csi)
{
if (dev->type == NVME_DEV_DIRECT)
- return nvme_ns_mgmt_create(dev_fd(dev), ns, nsid, timeout, csi);
+ return nvme_ns_mgmt_create(dev_fd(dev), NULL, nsid, timeout,
+ csi, data);
if (dev->type == NVME_DEV_MI)
- return nvme_mi_admin_ns_mgmt_create(dev->mi.ctrl, ns,
- csi, nsid);
+ return nvme_mi_admin_ns_mgmt_create(dev->mi.ctrl, NULL,
+ csi, nsid, data);
return -ENODEV;
}
__u16 ctrl_id,
struct nvme_secondary_ctrl_list *sc_list);
int nvme_cli_ns_mgmt_delete(struct nvme_dev *dev, __u32 nsid);
-int nvme_cli_ns_mgmt_create(struct nvme_dev *dev, struct nvme_id_ns *ns,
+int nvme_cli_ns_mgmt_create(struct nvme_dev *dev,
+ struct nvme_ns_mgmt_host_sw_specified *data,
__u32 *nsid, __u32 timeout, __u8 csi);
int nvme_cli_ns_attach(struct nvme_dev *dev, struct nvme_ns_attach_args *args);
const char *nvmsetid = "NVM Set Identifier (NVMSETID)";
const char *csi = "command set identifier (CSI)";
const char *lbstm = "logical block storage tag mask (LBSTM)";
+ const char *nphndls = "Number of Placement Handles (NPHNDLS)";
const char *bs = "target block size, specify only if \'FLBAS\' "\
"value not entered";
const char *nsze_si = "size of ns (NSZE) in standard SI units";
const char *ncap_si = "capacity of ns (NCAP) in standard SI units";
+ const char *phndls = "Comma separated list of Placement Handle "\
+ "Associated RUH";
struct nvme_id_ns ns;
struct nvme_dev *dev;
int err = 0, i;
__u32 nsid;
+ uint16_t num_phandle;
+ uint16_t phndl[128] = { 0, };
struct config {
__u64 nsze;
__u32 timeout;
__u8 csi;
__u64 lbstm;
+ __u16 nphndls;
char *nsze_si;
char *ncap_si;
+ char *phndls;
};
struct config cfg = {
.nmic = 0,
.anagrpid = 0,
.nvmsetid = 0,
- .bs = 0x00,
+ .bs = 0x00,
.timeout = 120000,
.csi = 0,
.lbstm = 0,
+ .nphndls = 0,
.nsze_si = NULL,
.ncap_si = NULL,
+ .phndls = "",
};
OPT_ARGS(opts) = {
OPT_UINT("timeout", 't', &cfg.timeout, timeout),
OPT_BYTE("csi", 'y', &cfg.csi, csi),
OPT_SUFFIX("lbstm", 'l', &cfg.lbstm, lbstm),
+ OPT_SHRT("nphndls", 'n', &cfg.nphndls, nphndls),
OPT_STR("nsze-si", 'S', &cfg.nsze_si, nsze_si),
OPT_STR("ncap-si", 'C', &cfg.ncap_si, ncap_si),
+ OPT_LIST("phndls", 'p', &cfg.phndls, phndls),
OPT_END()
};
if (err)
goto close_dev;
- struct nvme_id_ns ns2 = {
+ struct nvme_ns_mgmt_host_sw_specified data = {
.nsze = cpu_to_le64(cfg.nsze),
.ncap = cpu_to_le64(cfg.ncap),
.flbas = cfg.flbas,
.anagrpid = cpu_to_le32(cfg.anagrpid),
.nvmsetid = cpu_to_le16(cfg.nvmsetid),
.lbstm = cpu_to_le64(cfg.lbstm),
+ .nphndls = cpu_to_le16(cfg.nphndls),
};
- err = nvme_cli_ns_mgmt_create(dev, &ns2, &nsid, cfg.timeout, cfg.csi);
+ num_phandle = argconfig_parse_comma_sep_array_short(cfg.phndls, phndl, ARRAY_SIZE(phndl));
+ if (cfg.nphndls != num_phandle) {
+ fprintf(stderr, "Invaild Placement handle list\n");
+ err = -EINVAL;
+ goto close_dev;
+ }
+
+ for (i = 0; i < num_phandle; i++)
+ data.phndl[i] = cpu_to_le16(phndl[i]);
+
+ err = nvme_cli_ns_mgmt_create(dev, &data, &nsid, cfg.timeout, cfg.csi);
if (!err)
printf("%s: Success, created nsid:%d\n", cmd->name, nsid);
else if (err > 0)