[PATCH] nvme: use nvme_disk_is_ns_head helper

Guixin Liu kanie at linux.alibaba.com
Tue Mar 12 05:47:47 PDT 2024


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




More information about the Linux-nvme mailing list