Add an attribute to show multipath NUMA node per-path (scsi_disk). The following is an example of reading the file:
$ cat /sys/devices/platform/host8/session1/target8:0:0/8:0:0:0/block/sdc:0/numa_ mpath_numa_nodes 0-3 $ cat /sys/devices/platform/host9/session2/target9:0:0/9:0:0:0/block/sdc:1/numa_ mpath_numa_nodes $ Signed-off-by: John Garry <[email protected]> --- drivers/scsi/sd.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 380da0b0298bb..ee604f9f8cd20 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -4033,8 +4033,25 @@ static ssize_t sd_mpath_dev_show(struct device *dev, } static DEVICE_ATTR(mpath_dev, 0444, sd_mpath_dev_show, NULL); +static ssize_t sd_mpath_numa_nodes_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct gendisk *gd = dev_to_disk(dev); + struct scsi_disk *sdkp = gd->private_data; + struct scsi_device *sdev = sdkp->device; + struct scsi_mpath_device *scsi_mpath_dev = sdev->scsi_mpath_dev; + struct mpath_device *mpath_device = &scsi_mpath_dev->mpath_device; + struct sd_mpath_disk *sd_mpath_disk = sdkp->sd_mpath_disk; + struct scsi_mpath_head *scsi_mpath_head = sd_mpath_disk->scsi_mpath_head; + struct mpath_iopolicy *mpath_iopolicy = &scsi_mpath_head->iopolicy; + + return mpath_numa_nodes_show(mpath_device, mpath_iopolicy, buf); +} +static DEVICE_ATTR(mpath_numa_nodes, 0444, sd_mpath_numa_nodes_show, NULL); + static struct attribute *sd_mpath_dev_attrs[] = { &dev_attr_mpath_dev.attr, + &dev_attr_mpath_numa_nodes.attr, NULL }; -- 2.43.5

