[PATCH] nvme: use nvme_disk_is_ns_head helper

Christoph Hellwig hch at lst.de
Tue Mar 12 05:32:11 PDT 2024


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 at 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.




More information about the Linux-nvme mailing list