From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: Max Gurtovoy <mgurtovoy@nvidia.com>,
Chaitanya Kulkarni <chaitanyak@nvidia.com>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Cc: "kbusch@kernel.org" <kbusch@kernel.org>,
"hch@lst.de" <hch@lst.de>, "sagi@grimberg.me" <sagi@grimberg.me>
Subject: Re: [PATCH] nvme-fabrics: open code __nvmf_host_find()
Date: Mon, 5 Jun 2023 09:13:06 +0000 [thread overview]
Message-ID: <4b0ddae0-bc01-34ad-9ab4-4d63e262ae3f@nvidia.com> (raw)
In-Reply-To: <f03639ad-18b7-a051-c83c-7bca5ef1ec0b@nvidia.com>
On 6/3/23 17:35, Max Gurtovoy wrote:
> Hi,
>
> On 02/06/2023 9:47, Chaitanya Kulkarni wrote:
>> There is no point in maintaining a separate funciton __nvmf_host_find()
>
> typo *function
>
>> that has only one caller nvmf_host_add() especially when caller and
>> callee both are small enough to merge.
>>
>> Due to this we are actually repeating the error handling code in both
>> callee and caller for no reason that can be avoided, but instead we have
>> to read both function to establish the correctness along with additional
>> lockdep warning check due to involved locking.
>>
>> Just open code __nvmf_host_find() in nvme_host_alloc() with appropriate
>> comment that removes repeated error checks in the callee/caller and
>> lockdep check that is needed for the nvmf_hosts_mutex involvement,
>> diffstats :-
>
> The above 2 sentences are redundant IMO.
> There is no error handling in the callee so it can't be repeated. We
> just return error in the callee.
and that is error handling, without error conditions we would
only returning either valid host (that is non NULL) or NULL in
absence of host in the list. That -EINVAL return is the reason
we need separate check with IS_ERR in the caller ...
- if (IS_ERR(host)) {
- goto out_unlock;
- } else if (host) {
- kref_get(&host->ref);
- goto out_unlock;
> The first sentence is good enough to justify this patch.
>
> Lets have instead:
>
> "Merge its code with the only caller nvmf_host_add() since both are
> small enough.
> The lockdep check in __nvmf_host_find() after the merge becomes
> redundant so we can remove it too."
>
>
I don't understand what you are saying, provide a complete commit
log that can be applied verbatim to this patch.
-ck
next prev parent reply other threads:[~2023-06-05 9:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 6:47 [PATCH] nvme-fabrics: open code __nvmf_host_find() Chaitanya Kulkarni
2023-06-02 15:04 ` Christoph Hellwig
2023-06-04 0:35 ` Max Gurtovoy
2023-06-05 9:13 ` Chaitanya Kulkarni [this message]
2023-06-05 10:51 ` Max Gurtovoy
2023-06-05 21:52 ` Sagi Grimberg
2023-06-09 15:46 ` Keith Busch
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=4b0ddae0-bc01-34ad-9ab4-4d63e262ae3f@nvidia.com \
--to=chaitanyak@nvidia.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=mgurtovoy@nvidia.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