* [PATCH v2] nvme: use nvme_disk_is_ns_head helper
@ 2024-03-13 2:29 Guixin Liu
2024-03-13 7:46 ` Sagi Grimberg
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Guixin Liu @ 2024-03-13 2:29 UTC (permalink / raw)
To: kbusch, axboe, hch, sagi; +Cc: linux-nvme
Use nvme_disk_is_ns_head helper instead of check fops directly,
and also drop CONFIG_NVME_MULTIPATH check.
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
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(-)
diff --git a/drivers/nvme/host/pr.c b/drivers/nvme/host/pr.c
index fc3eed00f9ff..e05571b2a1b0 100644
--- a/drivers/nvme/host/pr.c
+++ b/drivers/nvme/host/pr.c
@@ -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,
diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c
index f2832f70e7e0..8b7bf9d943af 100644
--- a/drivers/nvme/host/sysfs.c
+++ b/drivers/nvme/host/sysfs.c
@@ -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);
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2] nvme: use nvme_disk_is_ns_head helper
2024-03-13 2:29 [PATCH v2] nvme: use nvme_disk_is_ns_head helper Guixin Liu
@ 2024-03-13 7:46 ` Sagi Grimberg
2024-03-13 21:52 ` Christoph Hellwig
2024-03-14 18:43 ` Keith Busch
2 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2024-03-13 7:46 UTC (permalink / raw)
To: Guixin Liu, kbusch, axboe, hch; +Cc: linux-nvme
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] nvme: use nvme_disk_is_ns_head helper
2024-03-13 2:29 [PATCH v2] nvme: use nvme_disk_is_ns_head helper Guixin Liu
2024-03-13 7:46 ` Sagi Grimberg
@ 2024-03-13 21:52 ` Christoph Hellwig
2024-03-14 18:43 ` Keith Busch
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2024-03-13 21:52 UTC (permalink / raw)
To: Guixin Liu; +Cc: kbusch, axboe, hch, sagi, linux-nvme
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] nvme: use nvme_disk_is_ns_head helper
2024-03-13 2:29 [PATCH v2] nvme: use nvme_disk_is_ns_head helper Guixin Liu
2024-03-13 7:46 ` Sagi Grimberg
2024-03-13 21:52 ` Christoph Hellwig
@ 2024-03-14 18:43 ` Keith Busch
2 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2024-03-14 18:43 UTC (permalink / raw)
To: Guixin Liu; +Cc: axboe, hch, sagi, linux-nvme
On Wed, Mar 13, 2024 at 10:29:05AM +0800, Guixin Liu wrote:
> 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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-03-14 18:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-13 2:29 [PATCH v2] nvme: use nvme_disk_is_ns_head helper Guixin Liu
2024-03-13 7:46 ` Sagi Grimberg
2024-03-13 21:52 ` Christoph Hellwig
2024-03-14 18:43 ` Keith Busch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox