Commit fd8099e7 authored by Christoph Hellwig's avatar Christoph Hellwig

nvme: cleanup __nvme_check_ids

Pass the actual nvme_ns_ids used for the comparison instead of the
ns_head that isn't needed and use a more descriptive function name.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarKeith Busch <kbusch@kernel.org>
Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
parent 0a9f8500
...@@ -3673,16 +3673,15 @@ static struct nvme_ns_head *nvme_find_ns_head(struct nvme_subsystem *subsys, ...@@ -3673,16 +3673,15 @@ static struct nvme_ns_head *nvme_find_ns_head(struct nvme_subsystem *subsys,
return NULL; return NULL;
} }
static int __nvme_check_ids(struct nvme_subsystem *subsys, static int nvme_subsys_check_duplicate_ids(struct nvme_subsystem *subsys,
struct nvme_ns_head *new) struct nvme_ns_ids *ids)
{ {
struct nvme_ns_head *h; struct nvme_ns_head *h;
lockdep_assert_held(&subsys->lock); lockdep_assert_held(&subsys->lock);
list_for_each_entry(h, &subsys->nsheads, entry) { list_for_each_entry(h, &subsys->nsheads, entry) {
if (nvme_ns_ids_valid(&new->ids) && if (nvme_ns_ids_valid(ids) && nvme_ns_ids_equal(ids, &h->ids))
nvme_ns_ids_equal(&new->ids, &h->ids))
return -EINVAL; return -EINVAL;
} }
...@@ -3781,7 +3780,7 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl, ...@@ -3781,7 +3780,7 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl,
head->ids = *ids; head->ids = *ids;
kref_init(&head->ref); kref_init(&head->ref);
ret = __nvme_check_ids(ctrl->subsys, head); ret = nvme_subsys_check_duplicate_ids(ctrl->subsys, &head->ids);
if (ret) { if (ret) {
dev_err(ctrl->device, dev_err(ctrl->device,
"duplicate IDs for nsid %d\n", nsid); "duplicate IDs for nsid %d\n", nsid);
......
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