Commit dcad6f5f authored by Guixin Liu's avatar Guixin Liu Committed by Keith Busch

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: default avatarGuixin Liu <kanie@linux.alibaba.com>
Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
parent de105068
...@@ -97,8 +97,7 @@ static int nvme_sc_to_pr_err(int nvme_sc) ...@@ -97,8 +97,7 @@ static int nvme_sc_to_pr_err(int nvme_sc)
static int nvme_send_pr_command(struct block_device *bdev, static int nvme_send_pr_command(struct block_device *bdev,
struct nvme_command *c, void *data, unsigned int data_len) struct nvme_command *c, void *data, unsigned int data_len)
{ {
if (IS_ENABLED(CONFIG_NVME_MULTIPATH) && if (nvme_disk_is_ns_head(bdev->bd_disk))
nvme_disk_is_ns_head(bdev->bd_disk))
return nvme_send_ns_head_pr_command(bdev, c, data, data_len); 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, return nvme_send_ns_pr_command(bdev->bd_disk->private_data, c, data,
......
...@@ -236,8 +236,7 @@ static ssize_t nuse_show(struct device *dev, struct device_attribute *attr, ...@@ -236,8 +236,7 @@ static ssize_t nuse_show(struct device *dev, struct device_attribute *attr,
struct block_device *bdev = disk->part0; struct block_device *bdev = disk->part0;
int ret; int ret;
if (IS_ENABLED(CONFIG_NVME_MULTIPATH) && if (nvme_disk_is_ns_head(bdev->bd_disk))
bdev->bd_disk->fops == &nvme_ns_head_ops)
ret = ns_head_update_nuse(head); ret = ns_head_update_nuse(head);
else else
ret = ns_update_nuse(bdev->bd_disk->private_data); ret = ns_update_nuse(bdev->bd_disk->private_data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment