[dm-devel] [PATCH 1/4] discovery: sanitize NVMe discovery

Guan Junxiong guanjunxiong at huawei.com
Fri Sep 15 10:00:01 UTC 2017



On 2017/9/15 14:30, Hannes Reinecke wrote:
> Bring the output of NVMe discovery inline with the other transports,
> and set the sg_id mappings to avoid ugly '#' outputs.
> 
> Signed-off-by: Hannes Reinecke <hare at suse.com>
> ---

> -	}
> -	if (!nvme)
> +	if (sscanf(attr_path, "nvme%dn%d",
> +		   &pp->sg_id.host_no,
> +		   &pp->sg_id.scsi_id) != 2)
> +		return 1;
> +	pp->sg_id.channel = 0;
> +	pp->sg_id.lun = 0;
> +


As seen in PATCH0/4, it's better to use nvme_id fields which shows the true
topology of NVMe/NVMf storage something like this: host NQN ->portid->subsytem NQN ->
controller ID ->namespace id .
The NQN is too long may be we could select the last few bytes.

However, your current method looks fine. And some suggestions:

(1)How about assigning sg_id.channel to controller id of target (seen in the
/sys/class/nvme/nvme0/nvme0n1/device/cntlid)
(2)And assigning sg_id.lun to namespace ID of target(seen in the
:/sys/class/nvme/nvme0/nvme0n1/nsid)








More information about the dm-devel mailing list