Skip to content

Commit dcad6f5

Browse files
guixinliu1995keithbusch
authored andcommitted
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. Signed-off-by: Guixin Liu <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent de10506 commit dcad6f5

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

drivers/nvme/host/pr.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ static int nvme_sc_to_pr_err(int nvme_sc)
9797
static int nvme_send_pr_command(struct block_device *bdev,
9898
struct nvme_command *c, void *data, unsigned int data_len)
9999
{
100-
if (IS_ENABLED(CONFIG_NVME_MULTIPATH) &&
101-
nvme_disk_is_ns_head(bdev->bd_disk))
100+
if (nvme_disk_is_ns_head(bdev->bd_disk))
102101
return nvme_send_ns_head_pr_command(bdev, c, data, data_len);
103102

104103
return nvme_send_ns_pr_command(bdev->bd_disk->private_data, c, data,

drivers/nvme/host/sysfs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,7 @@ static ssize_t nuse_show(struct device *dev, struct device_attribute *attr,
236236
struct block_device *bdev = disk->part0;
237237
int ret;
238238

239-
if (IS_ENABLED(CONFIG_NVME_MULTIPATH) &&
240-
bdev->bd_disk->fops == &nvme_ns_head_ops)
239+
if (nvme_disk_is_ns_head(bdev->bd_disk))
241240
ret = ns_head_update_nuse(head);
242241
else
243242
ret = ns_update_nuse(bdev->bd_disk->private_data);

0 commit comments

Comments
 (0)