diff options
author | Hannes Reinecke <hare@suse.de> | 2019-07-04 08:10:46 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2019-07-09 14:16:38 -0700 |
commit | ca7ae5c966bd4c00626d6ba05d68219f3c1fba36 (patch) | |
tree | f7fad26c46d8b9377d670df3b701816c322039e4 | |
parent | 81adb863349157c67ccec871e5ae5574600c50be (diff) | |
download | linux-stable-ca7ae5c966bd4c00626d6ba05d68219f3c1fba36.tar.gz linux-stable-ca7ae5c966bd4c00626d6ba05d68219f3c1fba36.tar.bz2 linux-stable-ca7ae5c966bd4c00626d6ba05d68219f3c1fba36.zip |
nvme-multipath: factor out a nvme_path_is_disabled helper
Factor our a common helper to check if a path has been disabled
by something other than the per-namespace ANA state.
Signed-off-by: Hannes Reinecke <hare@suse.com>
[hch: split from a bigger patch]
Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | drivers/nvme/host/multipath.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 499acf07d61a..5a6dbb422a9c 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -123,14 +123,19 @@ void nvme_mpath_clear_current_path(struct nvme_ns *ns) } } +static bool nvme_path_is_disabled(struct nvme_ns *ns) +{ + return ns->ctrl->state != NVME_CTRL_LIVE || + test_bit(NVME_NS_ANA_PENDING, &ns->flags); +} + static struct nvme_ns *__nvme_find_path(struct nvme_ns_head *head, int node) { int found_distance = INT_MAX, fallback_distance = INT_MAX, distance; struct nvme_ns *found = NULL, *fallback = NULL, *ns; list_for_each_entry_rcu(ns, &head->list, siblings) { - if (ns->ctrl->state != NVME_CTRL_LIVE || - test_bit(NVME_NS_ANA_PENDING, &ns->flags)) + if (nvme_path_is_disabled(ns)) continue; if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_NUMA) @@ -184,8 +189,7 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head, for (ns = nvme_next_ns(head, old); ns != old; ns = nvme_next_ns(head, ns)) { - if (ns->ctrl->state != NVME_CTRL_LIVE || - test_bit(NVME_NS_ANA_PENDING, &ns->flags)) + if (nvme_path_is_disabled(ns)) continue; if (ns->ana_state == NVME_ANA_OPTIMIZED) { |