* [PATCH] nvme: use nvme_disk_is_ns_head helper
@ 2024-03-12 7:53 Guixin Liu
2024-03-12 12:32 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Guixin Liu @ 2024-03-12 7:53 UTC (permalink / raw)
To: kbusch, axboe, hch, sagi; +Cc: linux-nvme
Use nvme_disk_is_ns_head helper instead of check
fops directly.
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
drivers/nvme/host/sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c
index f2832f70e7e0..ac8d622b5fc0 100644
--- a/drivers/nvme/host/sysfs.c
+++ b/drivers/nvme/host/sysfs.c
@@ -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);
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme: use nvme_disk_is_ns_head helper
2024-03-12 7:53 [PATCH] nvme: use nvme_disk_is_ns_head helper Guixin Liu
@ 2024-03-12 12:32 ` Christoph Hellwig
2024-03-12 12:47 ` Guixin Liu
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2024-03-12 12:32 UTC (permalink / raw)
To: Guixin Liu; +Cc: kbusch, axboe, hch, sagi, linux-nvme
On Tue, Mar 12, 2024 at 03:53:10PM +0800, Guixin Liu wrote:
> Use nvme_disk_is_ns_head helper instead of check
> fops directly.
>
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
> ---
> drivers/nvme/host/sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c
> index f2832f70e7e0..ac8d622b5fc0 100644
> --- a/drivers/nvme/host/sysfs.c
> +++ b/drivers/nvme/host/sysfs.c
> @@ -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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme: use nvme_disk_is_ns_head helper
2024-03-12 12:32 ` Christoph Hellwig
@ 2024-03-12 12:47 ` Guixin Liu
0 siblings, 0 replies; 3+ messages in thread
From: Guixin Liu @ 2024-03-12 12:47 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: kbusch, axboe, sagi, linux-nvme
在 2024/3/12 20:32, Christoph Hellwig 写道:
> On Tue, Mar 12, 2024 at 03:53:10PM +0800, Guixin Liu wrote:
>> Use nvme_disk_is_ns_head helper instead of check
>> fops directly.
>>
>> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
>> ---
>> drivers/nvme/host/sysfs.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c
>> index f2832f70e7e0..ac8d622b5fc0 100644
>> --- a/drivers/nvme/host/sysfs.c
>> +++ b/drivers/nvme/host/sysfs.c
>> @@ -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.
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-12 12:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-12 7:53 [PATCH] nvme: use nvme_disk_is_ns_head helper Guixin Liu
2024-03-12 12:32 ` Christoph Hellwig
2024-03-12 12:47 ` Guixin Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox