mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: John Meneghini <jmeneghi@redhat.com>,
	"kbusch@kernel.org" <kbusch@kernel.org>,
	"hch@lst.de" <hch@lst.de>, "sagi@grimberg.me" <sagi@grimberg.me>
Cc: "linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"emilne@redhat.com" <emilne@redhat.com>,
	"jrani@purestorage.com" <jrani@purestorage.com>,
	"randyj@purestorage.com" <randyj@purestorage.com>,
	"hare@kernel.org" <hare@kernel.org>
Subject: Re: [PATCH v8 1/2] nvme-multipath: prepare for "queue-depth" iopolicy
Date: Wed, 26 Jun 2024 08:02:52 +0000	[thread overview]
Message-ID: <0130bbae-8e63-42a1-b579-f122c55566d4@nvidia.com> (raw)
In-Reply-To: <20240625122605.857462-2-jmeneghi@redhat.com>

On 6/25/24 05:26, John Meneghini wrote:
> 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>
> ---
>   drivers/nvme/host/multipath.c | 21 +++++++++++++++------
>   1 file changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
> index 8a4d0e377114..0ade378e514b 100644
> --- a/drivers/nvme/host/multipath.c
> +++ b/drivers/nvme/host/multipath.c
> @@ -291,10 +291,14 @@ static struct nvme_ns *nvme_next_ns(struct nvme_ns_head *head,
>   	return list_first_or_null_rcu(&head->list, struct nvme_ns, siblings);
>   }
>   
> -static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
> -		int node, struct nvme_ns *old)
> +static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head)
>   {
>   	struct nvme_ns *ns, *found = NULL;
> +	int node = numa_node_id();
> +	struct nvme_ns *old = srcu_dereference(head->current_path[node], &head->srcu);
> +
> +	if (unlikely(!old))
> +		return __nvme_find_path(head, node);

nit:- above looks little bit odd with long line, I'd just :-

         struct nvme_ns *old;

         old = srcu_dereference(head->current_path[node], &head->srcu);
         if (unlikely(!old))
                 return __nvme_find_path(head, node);


>   
>   	if (list_is_singular(&head->list)) {
>   		if (nvme_path_is_disabled(old))
> @@ -340,7 +344,7 @@ static inline bool nvme_path_is_optimized(struct nvme_ns *ns)
>   		ns->ana_state == NVME_ANA_OPTIMIZED;
>   }
>   
> -inline struct nvme_ns *nvme_find_path(struct nvme_ns_head *head)
> +static struct nvme_ns *nvme_numa_path(struct nvme_ns_head *head)
>   {
>   	int node = numa_node_id();
>   	struct nvme_ns *ns;
> @@ -348,14 +352,19 @@ inline struct nvme_ns *nvme_find_path(struct nvme_ns_head *head)
>   	ns = srcu_dereference(head->current_path[node], &head->srcu);
>   	if (unlikely(!ns))
>   		return __nvme_find_path(head, node);
> -
> -	if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR)
> -		return nvme_round_robin_path(head, node, ns);
>   	if (unlikely(!nvme_path_is_optimized(ns)))
>   		return __nvme_find_path(head, node);
>   	return ns;
>   }
>   
> +inline struct nvme_ns *nvme_find_path(struct nvme_ns_head *head)
> +{
> +	if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR)
> +		return nvme_round_robin_path(head);
> +	else
> +		return nvme_numa_path(head);

nit: - else is not needed ...

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



  parent reply	other threads:[~2024-06-26  8:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25 12:26 [PATCH v8 0/2] nvme: queue-depth multipath iopolicy John Meneghini
2024-06-25 12:26 ` [PATCH v8 1/2] nvme-multipath: prepare for "queue-depth" iopolicy John Meneghini
2024-06-26  5:05   ` Christoph Hellwig
2024-06-26  8:02   ` Chaitanya Kulkarni [this message]
2024-06-26  8:24   ` Sagi Grimberg
2024-06-25 12:26 ` [PATCH v8 2/2] nvme-multipath: implement " John Meneghini
2024-06-26  5:06   ` Christoph Hellwig
2024-06-26  8:19   ` Chaitanya Kulkarni
2024-06-26  8:24   ` Sagi Grimberg
2024-06-25 16:37 ` [PATCH v8 0/2] nvme: queue-depth multipath iopolicy Keith Busch
2024-06-26 16:54   ` Keith Busch
2024-06-26 17:26     ` Randy Jennings

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0130bbae-8e63-42a1-b579-f122c55566d4@nvidia.com \
    --to=chaitanyak@nvidia.com \
    --cc=emilne@redhat.com \
    --cc=hare@kernel.org \
    --cc=hch@lst.de \
    --cc=jmeneghi@redhat.com \
    --cc=jrani@purestorage.com \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=randyj@purestorage.com \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®