nvme: use nvme_disk_is_ns_head helper
PATCH 1/1 nvme: use nvme_disk_is_ns_head helper
Use nvme_disk_is_ns_head helper instead of check
fops directly.
--- drivers/nvme/host/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/sysfs.c +1 -1
@@ -240,7 +240,7 @@ static ssize_t nuse_show(struct device *dev, struct device_attribute *attr,int ret;if (IS_ENABLED (CONFIG_NVME_MULTIPATH ) && - bdev->bd_disk->fops == &nvme_ns_head_ops) +nvme_disk_is_ns_head (bdev->bd_disk)) ret =ns_head_update_nuse (head);else ret =ns_update_nuse (bdev->bd_disk->private_data);
Signature · 1 line
2.43.0
Christoph Hellwig
maintainerQuoted 13 lines · Guixin Liu
Use
nvme_disk_is_ns_headhelper instead of check
fops directly.Signed-off-by Guixin Liu <[email protected]>--- drivers/nvme/host/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/nvme/host/sysfs.c +0
-0
drivers/nvme/host/sysfs.c static ssize_t nuse_show(struct device *dev, struct device_attribute *attr, · line 243
Quoted 5 lines
drivers/nvme/host/sysfs.c +1
-1@@ -240,7 +240,7 @@ static ssize_t nuse_show(struct device *dev, struct device_attribute *attr,int ret;if (IS_ENABLED (CONFIG_NVME_MULTIPATH ) && - bdev->bd_disk->fops == &nvme_ns_head_ops) +nvme_disk_is_ns_head (bdev->bd_disk))
When using nvme_disk_is_ns_head we should also be able to drop the IS_ENABLED(CONFIG_NVME_MULTIPATH) check.
Quoted 16 lines · Christoph Hellwig
Quoted 15 lines · Guixin Liu
Use
nvme_disk_is_ns_headhelper instead of check
fops directly.Signed-off-by Guixin Liu <[email protected]>--- drivers/nvme/host/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/nvme/host/sysfs.c +0
-0@@ -240,7 +240,7 @@ static ssize_t nuse_show(struct device *dev, struct device_attribute *attr,int ret;
Quoted 5 lines
drivers/nvme/host/sysfs.c static ssize_t nuse_show(struct device *dev, struct device_attribute *attr, · line 243
Quoted 3 lines
drivers/nvme/host/sysfs.c +1
-1if (IS_ENABLED (CONFIG_NVME_MULTIPATH ) && - bdev->bd_disk->fops == &nvme_ns_head_ops) +nvme_disk_is_ns_head (bdev->bd_disk))When using
nvme_disk_is_ns_headwe should also be able to drop theIS_ENABLED(CONFIG_NVME_MULTIPATH)check.
It will be changed in v2, and I will also remove
IS_ENABLED(CONFIG_NVME_MULTIPATH) check in nvme_send_pr_command().
Best regards,
Guixin Liu