* [PATCH v2 0/2] nvme(t)-fc: couple of fixes/cleanups
@ 2024-04-04 14:41 Daniel Wagner
2024-04-04 14:41 ` [PATCH v2 1/2] nvmet-fc: move RCU read lock to nvmet_fc_assoc_exists Daniel Wagner
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Daniel Wagner @ 2024-04-04 14:41 UTC (permalink / raw)
To: James Smart
Cc: Keith Busch, Christoph Hellwig, Sagi Grimberg, Hannes Reinecke,
linux-nvme, linux-kernel, Daniel Wagner
Both patches are just a rebased to the current nvme-6.9 head.
Daniel Wagner (2):
nvmet-fc: move RCU read lock to nvmet_fc_assoc_exists
nvme-fc: rename free_ctrl callback to match name pattern
drivers/nvme/host/fc.c | 4 ++--
drivers/nvme/target/fc.c | 17 ++++++++++-------
2 files changed, 12 insertions(+), 9 deletions(-)
--
2.44.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH v2 1/2] nvmet-fc: move RCU read lock to nvmet_fc_assoc_exists 2024-04-04 14:41 [PATCH v2 0/2] nvme(t)-fc: couple of fixes/cleanups Daniel Wagner @ 2024-04-04 14:41 ` Daniel Wagner 2024-04-04 14:52 ` Hannes Reinecke 2024-04-05 6:15 ` Christoph Hellwig 2024-04-04 14:41 ` [PATCH v2 2/2] nvme-fc: rename free_ctrl callback to match name pattern Daniel Wagner 2024-04-04 15:57 ` [PATCH v2 0/2] nvme(t)-fc: couple of fixes/cleanups Keith Busch 2 siblings, 2 replies; 7+ messages in thread From: Daniel Wagner @ 2024-04-04 14:41 UTC (permalink / raw) To: James Smart Cc: Keith Busch, Christoph Hellwig, Sagi Grimberg, Hannes Reinecke, linux-nvme, linux-kernel, Daniel Wagner The RCU lock is only needed for the lookup loop and not for list_ad_tail_rcu call. Thus move it down the call chain into nvmet_fc_assoc_exists. While at it also fix the name typo of the function. Signed-off-by: Daniel Wagner <dwagner@suse.de> --- drivers/nvme/target/fc.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c index b4706a8a9837..a8fb89da7281 100644 --- a/drivers/nvme/target/fc.c +++ b/drivers/nvme/target/fc.c @@ -1115,16 +1115,21 @@ nvmet_fc_schedule_delete_assoc(struct nvmet_fc_tgt_assoc *assoc) } static bool -nvmet_fc_assoc_exits(struct nvmet_fc_tgtport *tgtport, u64 association_id) +nvmet_fc_assoc_exists(struct nvmet_fc_tgtport *tgtport, u64 association_id) { struct nvmet_fc_tgt_assoc *a; + bool found = false; + rcu_read_lock(); list_for_each_entry_rcu(a, &tgtport->assoc_list, a_list) { - if (association_id == a->association_id) - return true; + if (association_id == a->association_id) { + found = true; + break; + } } + rcu_read_unlock(); - return false; + return found; } static struct nvmet_fc_tgt_assoc * @@ -1164,13 +1169,11 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle) ran = ran << BYTES_FOR_QID_SHIFT; spin_lock_irqsave(&tgtport->lock, flags); - rcu_read_lock(); - if (!nvmet_fc_assoc_exits(tgtport, ran)) { + if (!nvmet_fc_assoc_exists(tgtport, ran)) { assoc->association_id = ran; list_add_tail_rcu(&assoc->a_list, &tgtport->assoc_list); done = true; } - rcu_read_unlock(); spin_unlock_irqrestore(&tgtport->lock, flags); } while (!done); -- 2.44.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] nvmet-fc: move RCU read lock to nvmet_fc_assoc_exists 2024-04-04 14:41 ` [PATCH v2 1/2] nvmet-fc: move RCU read lock to nvmet_fc_assoc_exists Daniel Wagner @ 2024-04-04 14:52 ` Hannes Reinecke 2024-04-05 6:15 ` Christoph Hellwig 1 sibling, 0 replies; 7+ messages in thread From: Hannes Reinecke @ 2024-04-04 14:52 UTC (permalink / raw) To: Daniel Wagner, James Smart Cc: Keith Busch, Christoph Hellwig, Sagi Grimberg, linux-nvme, linux-kernel On 4/4/24 16:41, Daniel Wagner wrote: > The RCU lock is only needed for the lookup loop and not for > list_ad_tail_rcu call. Thus move it down the call chain into > nvmet_fc_assoc_exists. > > While at it also fix the name typo of the function. > > Signed-off-by: Daniel Wagner <dwagner@suse.de> > --- > drivers/nvme/target/fc.c | 17 ++++++++++------- > 1 file changed, 10 insertions(+), 7 deletions(-) > Reviewed-by: Hannes Reinecke <hare@suse.de> Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] nvmet-fc: move RCU read lock to nvmet_fc_assoc_exists 2024-04-04 14:41 ` [PATCH v2 1/2] nvmet-fc: move RCU read lock to nvmet_fc_assoc_exists Daniel Wagner 2024-04-04 14:52 ` Hannes Reinecke @ 2024-04-05 6:15 ` Christoph Hellwig 1 sibling, 0 replies; 7+ messages in thread From: Christoph Hellwig @ 2024-04-05 6:15 UTC (permalink / raw) To: Daniel Wagner Cc: James Smart, Keith Busch, Christoph Hellwig, Sagi Grimberg, Hannes Reinecke, linux-nvme, linux-kernel Looks good: Reviewed-by: Christoph Hellwig <hch@lst.de> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] nvme-fc: rename free_ctrl callback to match name pattern 2024-04-04 14:41 [PATCH v2 0/2] nvme(t)-fc: couple of fixes/cleanups Daniel Wagner 2024-04-04 14:41 ` [PATCH v2 1/2] nvmet-fc: move RCU read lock to nvmet_fc_assoc_exists Daniel Wagner @ 2024-04-04 14:41 ` Daniel Wagner 2024-04-04 14:52 ` Hannes Reinecke 2024-04-04 15:57 ` [PATCH v2 0/2] nvme(t)-fc: couple of fixes/cleanups Keith Busch 2 siblings, 1 reply; 7+ messages in thread From: Daniel Wagner @ 2024-04-04 14:41 UTC (permalink / raw) To: James Smart Cc: Keith Busch, Christoph Hellwig, Sagi Grimberg, Hannes Reinecke, linux-nvme, linux-kernel, Daniel Wagner Rename nvme_fc_nvme_ctrl_freed to nvme_fc_free_ctrl to match the name pattern for the callback. Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Daniel Wagner <dwagner@suse.de> --- drivers/nvme/host/fc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 68a5d971657b..a5b29e9ad342 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -2428,7 +2428,7 @@ nvme_fc_ctrl_get(struct nvme_fc_ctrl *ctrl) * controller. Called after last nvme_put_ctrl() call */ static void -nvme_fc_nvme_ctrl_freed(struct nvme_ctrl *nctrl) +nvme_fc_free_ctrl(struct nvme_ctrl *nctrl) { struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl); @@ -3384,7 +3384,7 @@ static const struct nvme_ctrl_ops nvme_fc_ctrl_ops = { .reg_read32 = nvmf_reg_read32, .reg_read64 = nvmf_reg_read64, .reg_write32 = nvmf_reg_write32, - .free_ctrl = nvme_fc_nvme_ctrl_freed, + .free_ctrl = nvme_fc_free_ctrl, .submit_async_event = nvme_fc_submit_async_event, .delete_ctrl = nvme_fc_delete_ctrl, .get_address = nvmf_get_address, -- 2.44.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] nvme-fc: rename free_ctrl callback to match name pattern 2024-04-04 14:41 ` [PATCH v2 2/2] nvme-fc: rename free_ctrl callback to match name pattern Daniel Wagner @ 2024-04-04 14:52 ` Hannes Reinecke 0 siblings, 0 replies; 7+ messages in thread From: Hannes Reinecke @ 2024-04-04 14:52 UTC (permalink / raw) To: Daniel Wagner, James Smart Cc: Keith Busch, Christoph Hellwig, Sagi Grimberg, linux-nvme, linux-kernel On 4/4/24 16:41, Daniel Wagner wrote: > Rename nvme_fc_nvme_ctrl_freed to nvme_fc_free_ctrl to match the name > pattern for the callback. > > Reviewed-by: Christoph Hellwig <hch@lst.de> > Reviewed-by: Sagi Grimberg <sagi@grimberg.me> > Signed-off-by: Daniel Wagner <dwagner@suse.de> > --- > drivers/nvme/host/fc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c > index 68a5d971657b..a5b29e9ad342 100644 > --- a/drivers/nvme/host/fc.c > +++ b/drivers/nvme/host/fc.c > @@ -2428,7 +2428,7 @@ nvme_fc_ctrl_get(struct nvme_fc_ctrl *ctrl) > * controller. Called after last nvme_put_ctrl() call > */ > static void > -nvme_fc_nvme_ctrl_freed(struct nvme_ctrl *nctrl) > +nvme_fc_free_ctrl(struct nvme_ctrl *nctrl) > { > struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl); > > @@ -3384,7 +3384,7 @@ static const struct nvme_ctrl_ops nvme_fc_ctrl_ops = { > .reg_read32 = nvmf_reg_read32, > .reg_read64 = nvmf_reg_read64, > .reg_write32 = nvmf_reg_write32, > - .free_ctrl = nvme_fc_nvme_ctrl_freed, > + .free_ctrl = nvme_fc_free_ctrl, > .submit_async_event = nvme_fc_submit_async_event, > .delete_ctrl = nvme_fc_delete_ctrl, > .get_address = nvmf_get_address, Reviewed-by: Hannes Reinecke <hare@suse.de> Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] nvme(t)-fc: couple of fixes/cleanups 2024-04-04 14:41 [PATCH v2 0/2] nvme(t)-fc: couple of fixes/cleanups Daniel Wagner 2024-04-04 14:41 ` [PATCH v2 1/2] nvmet-fc: move RCU read lock to nvmet_fc_assoc_exists Daniel Wagner 2024-04-04 14:41 ` [PATCH v2 2/2] nvme-fc: rename free_ctrl callback to match name pattern Daniel Wagner @ 2024-04-04 15:57 ` Keith Busch 2 siblings, 0 replies; 7+ messages in thread From: Keith Busch @ 2024-04-04 15:57 UTC (permalink / raw) To: Daniel Wagner Cc: James Smart, Christoph Hellwig, Sagi Grimberg, Hannes Reinecke, linux-nvme, linux-kernel On Thu, Apr 04, 2024 at 04:41:29PM +0200, Daniel Wagner wrote: > Both patches are just a rebased to the current nvme-6.9 head. > > Daniel Wagner (2): > nvmet-fc: move RCU read lock to nvmet_fc_assoc_exists > nvme-fc: rename free_ctrl callback to match name pattern Thanks, applied to nvme-6.9. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-04-05 6:15 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-04-04 14:41 [PATCH v2 0/2] nvme(t)-fc: couple of fixes/cleanups Daniel Wagner 2024-04-04 14:41 ` [PATCH v2 1/2] nvmet-fc: move RCU read lock to nvmet_fc_assoc_exists Daniel Wagner 2024-04-04 14:52 ` Hannes Reinecke 2024-04-05 6:15 ` Christoph Hellwig 2024-04-04 14:41 ` [PATCH v2 2/2] nvme-fc: rename free_ctrl callback to match name pattern Daniel Wagner 2024-04-04 14:52 ` Hannes Reinecke 2024-04-04 15:57 ` [PATCH v2 0/2] nvme(t)-fc: couple of fixes/cleanups Keith Busch
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox