Skip to content

Commit 04f203b

Browse files
committed
nvme-multipath: prepare for "queue-depth" iopolicy
JIRA: https://issues.redhat.com/browse/RHEL-45230 Upstream Status: git://git.infradead.org/nvme.git branch "nvme-6.11" This patch prepares for the introduction of a new iopolicy by breaking up the nvme_find_path() code path into sub-routines. Signed-off-by: John Meneghini <jmeneghi@redhat.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Signed-off-by: Keith Busch <kbusch@kernel.org> (cherry picked from commit 3d7c2fd) Signed-off-by: John Meneghini <jmeneghi@redhat.com>
1 parent d32ddc3 commit 04f203b

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

drivers/nvme/host/multipath.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,15 @@ static struct nvme_ns *nvme_next_ns(struct nvme_ns_head *head,
296296
return list_first_or_null_rcu(&head->list, struct nvme_ns, siblings);
297297
}
298298

299-
static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
300-
int node, struct nvme_ns *old)
299+
static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head)
301300
{
302301
struct nvme_ns *ns, *found = NULL;
302+
int node = numa_node_id();
303+
struct nvme_ns *old = srcu_dereference(head->current_path[node],
304+
&head->srcu);
305+
306+
if (unlikely(!old))
307+
return __nvme_find_path(head, node);
303308

304309
if (list_is_singular(&head->list)) {
305310
if (nvme_path_is_disabled(old))
@@ -345,22 +350,26 @@ static inline bool nvme_path_is_optimized(struct nvme_ns *ns)
345350
ns->ana_state == NVME_ANA_OPTIMIZED;
346351
}
347352

348-
inline struct nvme_ns *nvme_find_path(struct nvme_ns_head *head)
353+
static struct nvme_ns *nvme_numa_path(struct nvme_ns_head *head)
349354
{
350355
int node = numa_node_id();
351356
struct nvme_ns *ns;
352357

353358
ns = srcu_dereference(head->current_path[node], &head->srcu);
354359
if (unlikely(!ns))
355360
return __nvme_find_path(head, node);
356-
357-
if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR)
358-
return nvme_round_robin_path(head, node, ns);
359361
if (unlikely(!nvme_path_is_optimized(ns)))
360362
return __nvme_find_path(head, node);
361363
return ns;
362364
}
363365

366+
inline struct nvme_ns *nvme_find_path(struct nvme_ns_head *head)
367+
{
368+
if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR)
369+
return nvme_round_robin_path(head);
370+
return nvme_numa_path(head);
371+
}
372+
364373
static bool nvme_available_path(struct nvme_ns_head *head)
365374
{
366375
struct nvme_ns *ns;

0 commit comments

Comments
 (0)