nvme-fabrics: open code __nvmf_host_find()
authorChaitanya Kulkarni <kch@nvidia.com>
Fri, 2 Jun 2023 06:47:42 +0000 (23:47 -0700)
committerKeith Busch <kbusch@kernel.org>
Mon, 12 Jun 2023 17:37:00 +0000 (10:37 -0700)
commit959ffef13bac792e4e2e3321d6e2bd2b00c0f5f9
tree2b203e0032359ed85724c902fcb831f362c064f1
parent900095bfbbf6623fbfa9e5ceb3982f293b6f3275
nvme-fabrics: open code __nvmf_host_find()

There is no point in maintaining a separate funciton __nvmf_host_find()
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 :-

 drivers/nvme/host/fabrics.c | 75 +++++++++++++------------------------
 1 file changed, 27 insertions(+), 48 deletions(-)

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/fabrics.c