Skip to contentSkip to conversation

nvme: use nvme_disk_is_ns_head helper

PATCH Applied Guixin Liu 4 participants 4 messages Mar 13, 2024 – Mar 14, 2024 NVMe

lore
Share & tools
lore

Guixin Liu

author
#0 lore raw

PATCH v2 1/1 nvme: use nvme_disk_is_ns_head helper

Use nvme_disk_is_ns_head helper instead of check fops directly, and also drop CONFIG_NVME_MULTIPATH check.

---
Changes from v1 to v2:
- Drop CONFIG_NVME_MULTIPATH check.

 drivers/nvme/host/pr.c    | 3 +--
 drivers/nvme/host/sysfs.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/nvme/host/pr.c +1 -2
index fc3eed00f9ff..e05571b2a1b0 100644
@@ -97,8 +97,7 @@ static int nvme_sc_to_pr_err(int nvme_sc)
 static int nvme_send_pr_command(struct block_device *bdev,
 		struct nvme_command *c, void *data, unsigned int data_len)
 {
-	if (IS_ENABLED(CONFIG_NVME_MULTIPATH) &&
-	    nvme_disk_is_ns_head(bdev->bd_disk))
+	if (nvme_disk_is_ns_head(bdev->bd_disk))
 		return nvme_send_ns_head_pr_command(bdev, c, data, data_len);
 
 	return nvme_send_ns_pr_command(bdev->bd_disk->private_data, c, data,
drivers/nvme/host/sysfs.c +1 -2
index f2832f70e7e0..8b7bf9d943af 100644
@@ -239,8 +239,7 @@ static ssize_t nuse_show(struct device *dev, struct device_attribute *attr,
 	struct block_device *bdev = disk->part0;
 	int ret;
 
-	if (IS_ENABLED(CONFIG_NVME_MULTIPATH) &&
-	    bdev->bd_disk->fops == &nvme_ns_head_ops)
+	if (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
maintainer Applied
#3 lore raw
In reply to Guixin Liu
Quoted 2 lines · Guixin Liu

Use nvme_disk_is_ns_head helper instead of check fops directly, and also drop CONFIG_NVME_MULTIPATH check.

Applied to nvme-6.9, thanks.