On 09/15/2017 12:00 PM, Guan Junxiong wrote: > > > 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@xxxxxxxx> >> --- > >> - } >> - 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) > Sure, good idea. The above patch was just a stop-gap measure to get rid of the '#' in the topology output. Will be updating the patch. Cheers, Hannes -- Dr. Hannes Reinecke Teamlead Storage & Networking hare@xxxxxxx +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel