All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] nvme: cleanup ida_simple_[get|remove]
@ 2022-02-14  9:07 Sagi Grimberg
  2022-02-14  9:07 ` [PATCH 1/7] nvme-tcp: fix bogus request completion when failing to send AER Sagi Grimberg
                   ` (8 more replies)
  0 siblings, 9 replies; 19+ messages in thread
From: Sagi Grimberg @ 2022-02-14  9:07 UTC (permalink / raw)
  To: linux-nvme, Christoph Hellwig, Keith Busch, Chaitanya Kulkarni

We have the simpler and more convenient idr_[alloc|free], use them
instead.

Sagi Grimberg (7):
  nvme-tcp: fix bogus request completion when failing to send AER
  nvme: replace ida_simple[get|remove] with the simler ida_[alloc|free]
  nvme-fc: replace ida_simple[get|remove] with the simler
    ida_[alloc|free]
  nvmet: replace ida_simple[get|remove] with the simler ida_[alloc|free]
  nvmet-fc: replace ida_simple[get|remove] with the simler
    ida_[alloc|free]
  nvmet-rdma: replace ida_simple[get|remove] with the simler
    ida_[alloc|free]
  nvmet-tcp: replace ida_simple[get|remove] with the simler
    ida_[alloc|free]

 drivers/nvme/host/core.c   | 18 +++++++++---------
 drivers/nvme/host/fc.c     | 16 ++++++++--------
 drivers/nvme/host/tcp.c    | 10 +++++++++-
 drivers/nvme/target/core.c |  4 ++--
 drivers/nvme/target/fc.c   | 12 ++++++------
 drivers/nvme/target/rdma.c |  6 +++---
 drivers/nvme/target/tcp.c  |  6 +++---
 7 files changed, 40 insertions(+), 32 deletions(-)

-- 
2.30.2



^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/7] nvme-tcp: fix bogus request completion when failing to send AER
  2022-02-14  9:07 [PATCH 0/7] nvme: cleanup ida_simple_[get|remove] Sagi Grimberg
@ 2022-02-14  9:07 ` Sagi Grimberg
  2022-02-14 10:52   ` Chaitanya Kulkarni
  2022-02-14  9:07 ` [PATCH 2/7] nvme: replace ida_simple[get|remove] with the simler ida_[alloc|free] Sagi Grimberg
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Sagi Grimberg @ 2022-02-14  9:07 UTC (permalink / raw)
  To: linux-nvme, Christoph Hellwig, Keith Busch, Chaitanya Kulkarni

AER is not backed by a real request, hence we should not incorrectly
assume that when failing to send a nvme command, it is a normal request
but rather check if this is an aer and if so complete the aer (similar
to the normal completion path).

Cc: stable@vger.kernel.org
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 drivers/nvme/host/tcp.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 01e24b5703db..1096a0b0a268 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -913,7 +913,15 @@ static inline void nvme_tcp_done_send_req(struct nvme_tcp_queue *queue)
 
 static void nvme_tcp_fail_request(struct nvme_tcp_request *req)
 {
-	nvme_tcp_end_request(blk_mq_rq_from_pdu(req), NVME_SC_HOST_PATH_ERROR);
+	if (nvme_tcp_async_req(req)) {
+		union nvme_result res = {};
+
+		nvme_complete_async_event(&req->queue->ctrl->ctrl,
+			NVME_SC_HOST_PATH_ERROR, &res);
+	} else {
+		nvme_tcp_end_request(blk_mq_rq_from_pdu(req),
+				NVME_SC_HOST_PATH_ERROR);
+	}
 }
 
 static int nvme_tcp_try_send_data(struct nvme_tcp_request *req)
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/7] nvme: replace ida_simple[get|remove] with the simler ida_[alloc|free]
  2022-02-14  9:07 [PATCH 0/7] nvme: cleanup ida_simple_[get|remove] Sagi Grimberg
  2022-02-14  9:07 ` [PATCH 1/7] nvme-tcp: fix bogus request completion when failing to send AER Sagi Grimberg
@ 2022-02-14  9:07 ` Sagi Grimberg
  2022-02-14  9:07 ` [PATCH 3/7] nvme-fc: " Sagi Grimberg
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 19+ messages in thread
From: Sagi Grimberg @ 2022-02-14  9:07 UTC (permalink / raw)
  To: linux-nvme, Christoph Hellwig, Keith Busch, Chaitanya Kulkarni

ida_simple_[get|remove] are wrappers anyways.

Also, use ida_alloc_min with the ns_ida as namespace
enumeration starts with 1.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 drivers/nvme/host/core.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index c11cd3a814fd..84c5f84d7a8f 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -561,7 +561,7 @@ static void nvme_free_ns_head(struct kref *ref)
 		container_of(ref, struct nvme_ns_head, ref);
 
 	nvme_mpath_remove_disk(head);
-	ida_simple_remove(&head->subsys->ns_ida, head->instance);
+	ida_free(&head->subsys->ns_ida, head->instance);
 	cleanup_srcu_struct(&head->srcu);
 	nvme_put_subsystem(head->subsys);
 	kfree(head);
@@ -2565,7 +2565,7 @@ static void nvme_release_subsystem(struct device *dev)
 		container_of(dev, struct nvme_subsystem, dev);
 
 	if (subsys->instance >= 0)
-		ida_simple_remove(&nvme_instance_ida, subsys->instance);
+		ida_free(&nvme_instance_ida, subsys->instance);
 	kfree(subsys);
 }
 
@@ -3616,7 +3616,7 @@ static int __nvme_check_ids(struct nvme_subsystem *subsys,
 
 static void nvme_cdev_rel(struct device *dev)
 {
-	ida_simple_remove(&nvme_ns_chr_minor_ida, MINOR(dev->devt));
+	ida_free(&nvme_ns_chr_minor_ida, MINOR(dev->devt));
 }
 
 void nvme_cdev_del(struct cdev *cdev, struct device *cdev_device)
@@ -3630,7 +3630,7 @@ int nvme_cdev_add(struct cdev *cdev, struct device *cdev_device,
 {
 	int minor, ret;
 
-	minor = ida_simple_get(&nvme_ns_chr_minor_ida, 0, 0, GFP_KERNEL);
+	minor = ida_alloc(&nvme_ns_chr_minor_ida, GFP_KERNEL);
 	if (minor < 0)
 		return minor;
 	cdev_device->devt = MKDEV(MAJOR(nvme_ns_chr_devt), minor);
@@ -3693,7 +3693,7 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl,
 	head = kzalloc(size, GFP_KERNEL);
 	if (!head)
 		goto out;
-	ret = ida_simple_get(&ctrl->subsys->ns_ida, 1, 0, GFP_KERNEL);
+	ret = ida_alloc_min(&ctrl->subsys->ns_ida, 1, GFP_KERNEL);
 	if (ret < 0)
 		goto out_free_head;
 	head->instance = ret;
@@ -3732,7 +3732,7 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl,
 out_cleanup_srcu:
 	cleanup_srcu_struct(&head->srcu);
 out_ida_remove:
-	ida_simple_remove(&ctrl->subsys->ns_ida, head->instance);
+	ida_free(&ctrl->subsys->ns_ida, head->instance);
 out_free_head:
 	kfree(head);
 out:
@@ -4431,7 +4431,7 @@ static void nvme_free_ctrl(struct device *dev)
 	struct nvme_subsystem *subsys = ctrl->subsys;
 
 	if (!subsys || ctrl->instance != subsys->instance)
-		ida_simple_remove(&nvme_instance_ida, ctrl->instance);
+		ida_free(&nvme_instance_ida, ctrl->instance);
 
 	nvme_free_cels(ctrl);
 	nvme_mpath_uninit(ctrl);
@@ -4490,7 +4490,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev,
 		goto out;
 	}
 
-	ret = ida_simple_get(&nvme_instance_ida, 0, 0, GFP_KERNEL);
+	ret = ida_alloc(&nvme_instance_ida, GFP_KERNEL);
 	if (ret < 0)
 		goto out;
 	ctrl->instance = ret;
@@ -4531,7 +4531,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev,
 	nvme_put_ctrl(ctrl);
 	kfree_const(ctrl->device->kobj.name);
 out_release_instance:
-	ida_simple_remove(&nvme_instance_ida, ctrl->instance);
+	ida_free(&nvme_instance_ida, ctrl->instance);
 out:
 	if (ctrl->discard_page)
 		__free_page(ctrl->discard_page);
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 3/7] nvme-fc: replace ida_simple[get|remove] with the simler ida_[alloc|free]
  2022-02-14  9:07 [PATCH 0/7] nvme: cleanup ida_simple_[get|remove] Sagi Grimberg
  2022-02-14  9:07 ` [PATCH 1/7] nvme-tcp: fix bogus request completion when failing to send AER Sagi Grimberg
  2022-02-14  9:07 ` [PATCH 2/7] nvme: replace ida_simple[get|remove] with the simler ida_[alloc|free] Sagi Grimberg
@ 2022-02-14  9:07 ` Sagi Grimberg
  2022-02-14  9:07 ` [PATCH 4/7] nvmet: " Sagi Grimberg
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 19+ messages in thread
From: Sagi Grimberg @ 2022-02-14  9:07 UTC (permalink / raw)
  To: linux-nvme, Christoph Hellwig, Keith Busch, Chaitanya Kulkarni

ida_simple_[get|remove] are wrappers anyways.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 drivers/nvme/host/fc.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 71b3108c22f0..96a5d7fc36f7 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -259,7 +259,7 @@ nvme_fc_free_lport(struct kref *ref)
 		complete(&nvme_fc_unload_proceed);
 	spin_unlock_irqrestore(&nvme_fc_lock, flags);
 
-	ida_simple_remove(&nvme_fc_local_port_cnt, lport->localport.port_num);
+	ida_free(&nvme_fc_local_port_cnt, lport->localport.port_num);
 	ida_destroy(&lport->endp_cnt);
 
 	put_device(lport->dev);
@@ -399,7 +399,7 @@ nvme_fc_register_localport(struct nvme_fc_port_info *pinfo,
 		goto out_reghost_failed;
 	}
 
-	idx = ida_simple_get(&nvme_fc_local_port_cnt, 0, 0, GFP_KERNEL);
+	idx = ida_alloc(&nvme_fc_local_port_cnt, GFP_KERNEL);
 	if (idx < 0) {
 		ret = -ENOSPC;
 		goto out_fail_kfree;
@@ -439,7 +439,7 @@ nvme_fc_register_localport(struct nvme_fc_port_info *pinfo,
 	return 0;
 
 out_ida_put:
-	ida_simple_remove(&nvme_fc_local_port_cnt, idx);
+	ida_free(&nvme_fc_local_port_cnt, idx);
 out_fail_kfree:
 	kfree(newrec);
 out_reghost_failed:
@@ -535,7 +535,7 @@ nvme_fc_free_rport(struct kref *ref)
 	spin_unlock_irqrestore(&nvme_fc_lock, flags);
 
 	WARN_ON(!list_empty(&rport->disc_list));
-	ida_simple_remove(&lport->endp_cnt, rport->remoteport.port_num);
+	ida_free(&lport->endp_cnt, rport->remoteport.port_num);
 
 	kfree(rport);
 
@@ -713,7 +713,7 @@ nvme_fc_register_remoteport(struct nvme_fc_local_port *localport,
 		goto out_lport_put;
 	}
 
-	idx = ida_simple_get(&lport->endp_cnt, 0, 0, GFP_KERNEL);
+	idx = ida_alloc(&lport->endp_cnt, GFP_KERNEL);
 	if (idx < 0) {
 		ret = -ENOSPC;
 		goto out_kfree_rport;
@@ -2393,7 +2393,7 @@ nvme_fc_ctrl_free(struct kref *ref)
 	put_device(ctrl->dev);
 	nvme_fc_rport_put(ctrl->rport);
 
-	ida_simple_remove(&nvme_fc_ctrl_cnt, ctrl->cnum);
+	ida_free(&nvme_fc_ctrl_cnt, ctrl->cnum);
 	if (ctrl->ctrl.opts)
 		nvmf_free_options(ctrl->ctrl.opts);
 	kfree(ctrl);
@@ -3472,7 +3472,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
 		goto out_fail;
 	}
 
-	idx = ida_simple_get(&nvme_fc_ctrl_cnt, 0, 0, GFP_KERNEL);
+	idx = ida_alloc(&nvme_fc_ctrl_cnt, GFP_KERNEL);
 	if (idx < 0) {
 		ret = -ENOSPC;
 		goto out_free_ctrl;
@@ -3635,7 +3635,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
 	kfree(ctrl->queues);
 out_free_ida:
 	put_device(ctrl->dev);
-	ida_simple_remove(&nvme_fc_ctrl_cnt, ctrl->cnum);
+	ida_free(&nvme_fc_ctrl_cnt, ctrl->cnum);
 out_free_ctrl:
 	kfree(ctrl);
 out_fail:
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 4/7] nvmet: replace ida_simple[get|remove] with the simler ida_[alloc|free]
  2022-02-14  9:07 [PATCH 0/7] nvme: cleanup ida_simple_[get|remove] Sagi Grimberg
                   ` (2 preceding siblings ...)
  2022-02-14  9:07 ` [PATCH 3/7] nvme-fc: " Sagi Grimberg
@ 2022-02-14  9:07 ` Sagi Grimberg
  2022-02-14  9:07 ` [PATCH 5/7] nvmet-fc: " Sagi Grimberg
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 19+ messages in thread
From: Sagi Grimberg @ 2022-02-14  9:07 UTC (permalink / raw)
  To: linux-nvme, Christoph Hellwig, Keith Busch, Chaitanya Kulkarni

ida_simple_[get|remove] are wrappers anyways.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 drivers/nvme/target/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 5119c687de68..724a6d373340 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -1400,7 +1400,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
 	if (subsys->cntlid_min > subsys->cntlid_max)
 		goto out_free_sqs;
 
-	ret = ida_simple_get(&cntlid_ida,
+	ret = ida_alloc_range(&cntlid_ida,
 			     subsys->cntlid_min, subsys->cntlid_max,
 			     GFP_KERNEL);
 	if (ret < 0) {
@@ -1459,7 +1459,7 @@ static void nvmet_ctrl_free(struct kref *ref)
 	flush_work(&ctrl->async_event_work);
 	cancel_work_sync(&ctrl->fatal_err_work);
 
-	ida_simple_remove(&cntlid_ida, ctrl->cntlid);
+	ida_free(&cntlid_ida, ctrl->cntlid);
 
 	nvmet_async_events_free(ctrl);
 	kfree(ctrl->sqs);
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 5/7] nvmet-fc: replace ida_simple[get|remove] with the simler ida_[alloc|free]
  2022-02-14  9:07 [PATCH 0/7] nvme: cleanup ida_simple_[get|remove] Sagi Grimberg
                   ` (3 preceding siblings ...)
  2022-02-14  9:07 ` [PATCH 4/7] nvmet: " Sagi Grimberg
@ 2022-02-14  9:07 ` Sagi Grimberg
  2022-02-14  9:07 ` [PATCH 6/7] nvmet-rdma: " Sagi Grimberg
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 19+ messages in thread
From: Sagi Grimberg @ 2022-02-14  9:07 UTC (permalink / raw)
  To: linux-nvme, Christoph Hellwig, Keith Busch, Chaitanya Kulkarni

ida_simple_[get|remove] are wrappers anyways.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 drivers/nvme/target/fc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index 22b5108168a6..cb013516784c 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -1115,7 +1115,7 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
 	if (!assoc)
 		return NULL;
 
-	idx = ida_simple_get(&tgtport->assoc_cnt, 0, 0, GFP_KERNEL);
+	idx = ida_alloc(&tgtport->assoc_cnt, GFP_KERNEL);
 	if (idx < 0)
 		goto out_free_assoc;
 
@@ -1157,7 +1157,7 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
 out_put:
 	nvmet_fc_tgtport_put(tgtport);
 out_ida:
-	ida_simple_remove(&tgtport->assoc_cnt, idx);
+	ida_free(&tgtport->assoc_cnt, idx);
 out_free_assoc:
 	kfree(assoc);
 	return NULL;
@@ -1183,7 +1183,7 @@ nvmet_fc_target_assoc_free(struct kref *ref)
 	/* if pending Rcv Disconnect Association LS, send rsp now */
 	if (oldls)
 		nvmet_fc_xmt_ls_rsp(tgtport, oldls);
-	ida_simple_remove(&tgtport->assoc_cnt, assoc->a_id);
+	ida_free(&tgtport->assoc_cnt, assoc->a_id);
 	dev_info(tgtport->dev,
 		"{%d:%d} Association freed\n",
 		tgtport->fc_target_port.port_num, assoc->a_id);
@@ -1383,7 +1383,7 @@ nvmet_fc_register_targetport(struct nvmet_fc_port_info *pinfo,
 		goto out_regtgt_failed;
 	}
 
-	idx = ida_simple_get(&nvmet_fc_tgtport_cnt, 0, 0, GFP_KERNEL);
+	idx = ida_alloc(&nvmet_fc_tgtport_cnt, GFP_KERNEL);
 	if (idx < 0) {
 		ret = -ENOSPC;
 		goto out_fail_kfree;
@@ -1433,7 +1433,7 @@ nvmet_fc_register_targetport(struct nvmet_fc_port_info *pinfo,
 out_free_newrec:
 	put_device(dev);
 out_ida_put:
-	ida_simple_remove(&nvmet_fc_tgtport_cnt, idx);
+	ida_free(&nvmet_fc_tgtport_cnt, idx);
 out_fail_kfree:
 	kfree(newrec);
 out_regtgt_failed:
@@ -1460,7 +1460,7 @@ nvmet_fc_free_tgtport(struct kref *ref)
 	/* let the LLDD know we've finished tearing it down */
 	tgtport->ops->targetport_delete(&tgtport->fc_target_port);
 
-	ida_simple_remove(&nvmet_fc_tgtport_cnt,
+	ida_free(&nvmet_fc_tgtport_cnt,
 			tgtport->fc_target_port.port_num);
 
 	ida_destroy(&tgtport->assoc_cnt);
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 6/7] nvmet-rdma: replace ida_simple[get|remove] with the simler ida_[alloc|free]
  2022-02-14  9:07 [PATCH 0/7] nvme: cleanup ida_simple_[get|remove] Sagi Grimberg
                   ` (4 preceding siblings ...)
  2022-02-14  9:07 ` [PATCH 5/7] nvmet-fc: " Sagi Grimberg
@ 2022-02-14  9:07 ` Sagi Grimberg
  2022-02-14  9:07 ` [PATCH 7/7] nvmet-tcp: " Sagi Grimberg
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 19+ messages in thread
From: Sagi Grimberg @ 2022-02-14  9:07 UTC (permalink / raw)
  To: linux-nvme, Christoph Hellwig, Keith Busch, Chaitanya Kulkarni

ida_simple_[get|remove] are wrappers anyways.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 drivers/nvme/target/rdma.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 1deb4043e242..00656754e331 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -1356,7 +1356,7 @@ static void nvmet_rdma_free_queue(struct nvmet_rdma_queue *queue)
 				!queue->host_qid);
 	}
 	nvmet_rdma_free_rsps(queue);
-	ida_simple_remove(&nvmet_rdma_queue_ida, queue->idx);
+	ida_free(&nvmet_rdma_queue_ida, queue->idx);
 	kfree(queue);
 }
 
@@ -1459,7 +1459,7 @@ nvmet_rdma_alloc_queue(struct nvmet_rdma_device *ndev,
 	spin_lock_init(&queue->rsps_lock);
 	INIT_LIST_HEAD(&queue->queue_list);
 
-	queue->idx = ida_simple_get(&nvmet_rdma_queue_ida, 0, 0, GFP_KERNEL);
+	queue->idx = ida_alloc(&nvmet_rdma_queue_ida, GFP_KERNEL);
 	if (queue->idx < 0) {
 		ret = NVME_RDMA_CM_NO_RSC;
 		goto out_destroy_sq;
@@ -1510,7 +1510,7 @@ nvmet_rdma_alloc_queue(struct nvmet_rdma_device *ndev,
 out_free_responses:
 	nvmet_rdma_free_rsps(queue);
 out_ida_remove:
-	ida_simple_remove(&nvmet_rdma_queue_ida, queue->idx);
+	ida_free(&nvmet_rdma_queue_ida, queue->idx);
 out_destroy_sq:
 	nvmet_sq_destroy(&queue->nvme_sq);
 out_free_queue:
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 7/7] nvmet-tcp: replace ida_simple[get|remove] with the simler ida_[alloc|free]
  2022-02-14  9:07 [PATCH 0/7] nvme: cleanup ida_simple_[get|remove] Sagi Grimberg
                   ` (5 preceding siblings ...)
  2022-02-14  9:07 ` [PATCH 6/7] nvmet-rdma: " Sagi Grimberg
@ 2022-02-14  9:07 ` Sagi Grimberg
  2022-02-14 10:03 ` [PATCH 0/7] nvme: cleanup ida_simple_[get|remove] Chaitanya Kulkarni
  2022-02-16  8:02 ` Christoph Hellwig
  8 siblings, 0 replies; 19+ messages in thread
From: Sagi Grimberg @ 2022-02-14  9:07 UTC (permalink / raw)
  To: linux-nvme, Christoph Hellwig, Keith Busch, Chaitanya Kulkarni

ida_simple_[get|remove] are wrappers anyways.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 drivers/nvme/target/tcp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index 7c1c43ce466b..83ca577f72be 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -1473,7 +1473,7 @@ static void nvmet_tcp_release_queue_work(struct work_struct *w)
 	nvmet_tcp_free_cmds(queue);
 	if (queue->hdr_digest || queue->data_digest)
 		nvmet_tcp_free_crypto(queue);
-	ida_simple_remove(&nvmet_tcp_queue_ida, queue->idx);
+	ida_free(&nvmet_tcp_queue_ida, queue->idx);
 
 	page = virt_to_head_page(queue->pf_cache.va);
 	__page_frag_cache_drain(page, queue->pf_cache.pagecnt_bias);
@@ -1613,7 +1613,7 @@ static int nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port,
 	init_llist_head(&queue->resp_list);
 	INIT_LIST_HEAD(&queue->resp_send_list);
 
-	queue->idx = ida_simple_get(&nvmet_tcp_queue_ida, 0, 0, GFP_KERNEL);
+	queue->idx = ida_alloc(&nvmet_tcp_queue_ida, GFP_KERNEL);
 	if (queue->idx < 0) {
 		ret = queue->idx;
 		goto out_free_queue;
@@ -1646,7 +1646,7 @@ static int nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port,
 out_free_connect:
 	nvmet_tcp_free_cmd(&queue->connect);
 out_ida_remove:
-	ida_simple_remove(&nvmet_tcp_queue_ida, queue->idx);
+	ida_free(&nvmet_tcp_queue_ida, queue->idx);
 out_free_queue:
 	kfree(queue);
 	return ret;
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 0/7] nvme: cleanup ida_simple_[get|remove]
  2022-02-14  9:07 [PATCH 0/7] nvme: cleanup ida_simple_[get|remove] Sagi Grimberg
                   ` (6 preceding siblings ...)
  2022-02-14  9:07 ` [PATCH 7/7] nvmet-tcp: " Sagi Grimberg
@ 2022-02-14 10:03 ` Chaitanya Kulkarni
  2022-02-14 10:22   ` Sagi Grimberg
  2022-02-16  8:02 ` Christoph Hellwig
  8 siblings, 1 reply; 19+ messages in thread
From: Chaitanya Kulkarni @ 2022-02-14 10:03 UTC (permalink / raw)
  To: Sagi Grimberg
  Cc: Keith Busch, linux-nvme, Christoph Hellwig, Chaitanya Kulkarni

On 2/14/22 1:07 AM, Sagi Grimberg wrote:
> We have the simpler and more convenient idr_[alloc|free], use them
> instead.
> 

you sent the same series :) either ways seems like a useful cleanup..





^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 0/7] nvme: cleanup ida_simple_[get|remove]
  2022-02-14 10:03 ` [PATCH 0/7] nvme: cleanup ida_simple_[get|remove] Chaitanya Kulkarni
@ 2022-02-14 10:22   ` Sagi Grimberg
  2022-02-14 10:44     ` Chaitanya Kulkarni
  0 siblings, 1 reply; 19+ messages in thread
From: Sagi Grimberg @ 2022-02-14 10:22 UTC (permalink / raw)
  To: Chaitanya Kulkarni
  Cc: Keith Busch, linux-nvme, Christoph Hellwig, Chaitanya Kulkarni


>> We have the simpler and more convenient idr_[alloc|free], use them
>> instead.
>>
> 
> you sent the same series :) either ways seems like a useful cleanup..

Didn't see yours for some reason... Did you CC me? Can you point me to
it?



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 0/7] nvme: cleanup ida_simple_[get|remove]
  2022-02-14 10:22   ` Sagi Grimberg
@ 2022-02-14 10:44     ` Chaitanya Kulkarni
  2022-02-14 10:59       ` Sagi Grimberg
  0 siblings, 1 reply; 19+ messages in thread
From: Chaitanya Kulkarni @ 2022-02-14 10:44 UTC (permalink / raw)
  To: Sagi Grimberg
  Cc: Keith Busch, linux-nvme, Christoph Hellwig, Chaitanya Kulkarni

On 2/14/22 02:22, Sagi Grimberg wrote:
> 
>>> We have the simpler and more convenient idr_[alloc|free], use them
>>> instead.
>>>
>>
>> you sent the same series :) either ways seems like a useful cleanup..
> 
> Didn't see yours for some reason... Did you CC me? Can you point me to
> it?
> 

I did cc you, here is the link, somehow it takes a while to appear
on the mailing list than it appears in my mail box :-

http://lists.infradead.org/pipermail/linux-nvme/2022-February/029954.html

-ck



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/7] nvme-tcp: fix bogus request completion when failing to send AER
  2022-02-14  9:07 ` [PATCH 1/7] nvme-tcp: fix bogus request completion when failing to send AER Sagi Grimberg
@ 2022-02-14 10:52   ` Chaitanya Kulkarni
  2022-02-14 10:59     ` Sagi Grimberg
  0 siblings, 1 reply; 19+ messages in thread
From: Chaitanya Kulkarni @ 2022-02-14 10:52 UTC (permalink / raw)
  To: Sagi Grimberg; +Cc: linux-nvme, Keith Busch, Christoph Hellwig

On 2/14/22 01:07, Sagi Grimberg wrote:
> AER is not backed by a real request, hence we should not incorrectly
> assume that when failing to send a nvme command, it is a normal request
> but rather check if this is an aer and if so complete the aer (similar
> to the normal completion path).
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>


I think same patch is already present in the nvme-5.17 see [1]:-

root@dev nvme (nvme-5.17) # grep "void nvme_tcp_fail_request" -A 15 
host/tcp.c
static void nvme_tcp_fail_request(struct nvme_tcp_request *req)
{
	if (nvme_tcp_async_req(req)) {
		union nvme_result res = {};

		nvme_complete_async_event(&req->queue->ctrl->ctrl,
				cpu_to_le16(NVME_SC_HOST_PATH_ERROR), &res);
	} else {
		nvme_tcp_end_request(blk_mq_rq_from_pdu(req),
				NVME_SC_HOST_PATH_ERROR);
	}
}

static int nvme_tcp_try_send_data(struct nvme_tcp_request *req)
{
	struct nvme_tcp_queue *queue = req->queue;



[1] 
http://lists.infradead.org/pipermail/linux-nvme/2022-February/029803.html

commit 63573807b27e0faf8065a28b1bbe1cbfb23c0130 (tag: 
nvme-5.17-2022-02-10, origin/nvme-5.17)
Author: Sagi Grimberg <sagi@grimberg.me>
Date:   Mon Feb 7 00:40:13 2022 +0200

     nvme-tcp: fix bogus request completion when failing to send AER

     AER is not backed by a real request, hence we should not incorrectly
     assume that when failing to send a nvme command, it is a normal request
     but rather check if this is an aer and if so complete the aer (similar
     to the normal completion path).

     Cc: stable@vger.kernel.org
     Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
     Reviewed-by: Hannes Reinecke <hare@suse.de>
     Signed-off-by: Christoph Hellwig <hch@lst.de>


-ck



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/7] nvme-tcp: fix bogus request completion when failing to send AER
  2022-02-14 10:52   ` Chaitanya Kulkarni
@ 2022-02-14 10:59     ` Sagi Grimberg
  0 siblings, 0 replies; 19+ messages in thread
From: Sagi Grimberg @ 2022-02-14 10:59 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: linux-nvme, Keith Busch, Christoph Hellwig


>> AER is not backed by a real request, hence we should not incorrectly
>> assume that when failing to send a nvme command, it is a normal request
>> but rather check if this is an aer and if so complete the aer (similar
>> to the normal completion path).
>>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
> 
> 
> I think same patch is already present in the nvme-5.17 see [1]:-

Needs to be disregard, it sneaked in as it existed on the same branch...


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 0/7] nvme: cleanup ida_simple_[get|remove]
  2022-02-14 10:44     ` Chaitanya Kulkarni
@ 2022-02-14 10:59       ` Sagi Grimberg
  2022-02-15 18:42         ` Christoph Hellwig
  0 siblings, 1 reply; 19+ messages in thread
From: Sagi Grimberg @ 2022-02-14 10:59 UTC (permalink / raw)
  To: Chaitanya Kulkarni
  Cc: Keith Busch, linux-nvme, Christoph Hellwig, Chaitanya Kulkarni


>>>> We have the simpler and more convenient idr_[alloc|free], use them
>>>> instead.
>>>>
>>>
>>> you sent the same series :) either ways seems like a useful cleanup..
>>
>> Didn't see yours for some reason... Did you CC me? Can you point me to
>> it?
>>
> 
> I did cc you, here is the link, somehow it takes a while to appear
> on the mailing list than it appears in my mail box :-

Yea, got it, just a tad late...


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 0/7] nvme: cleanup ida_simple_[get|remove]
  2022-02-14 10:59       ` Sagi Grimberg
@ 2022-02-15 18:42         ` Christoph Hellwig
  2022-02-15 19:15           ` Chaitanya Kulkarni
  2022-02-15 19:27           ` Keith Busch
  0 siblings, 2 replies; 19+ messages in thread
From: Christoph Hellwig @ 2022-02-15 18:42 UTC (permalink / raw)
  To: Sagi Grimberg
  Cc: Chaitanya Kulkarni, Keith Busch, linux-nvme, Christoph Hellwig,
	Chaitanya Kulkarni

On Mon, Feb 14, 2022 at 12:59:49PM +0200, Sagi Grimberg wrote:
>> I did cc you, here is the link, somehow it takes a while to appear
>> on the mailing list than it appears in my mail box :-
>
> Yea, got it, just a tad late...

So which of the two versions should we go with?  Either one will need
reviews :)


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 0/7] nvme: cleanup ida_simple_[get|remove]
  2022-02-15 18:42         ` Christoph Hellwig
@ 2022-02-15 19:15           ` Chaitanya Kulkarni
  2022-02-15 19:27           ` Keith Busch
  1 sibling, 0 replies; 19+ messages in thread
From: Chaitanya Kulkarni @ 2022-02-15 19:15 UTC (permalink / raw)
  To: Christoph Hellwig, Sagi Grimberg
  Cc: Keith Busch, linux-nvme, Chaitanya Kulkarni

On 2/15/22 10:42, Christoph Hellwig wrote:
> On Mon, Feb 14, 2022 at 12:59:49PM +0200, Sagi Grimberg wrote:
>>> I did cc you, here is the link, somehow it takes a while to appear
>>> on the mailing list than it appears in my mail box :-
>>
>> Yea, got it, just a tad late...
> 
> So which of the two versions should we go with?  Either one will need
> reviews :)
> 

I'm fine with anything, if you can add my signoff then ignore my
review by, in case we can't do that then here my tag :-

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



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 0/7] nvme: cleanup ida_simple_[get|remove]
  2022-02-15 18:42         ` Christoph Hellwig
  2022-02-15 19:15           ` Chaitanya Kulkarni
@ 2022-02-15 19:27           ` Keith Busch
  2022-02-15 20:01             ` Chaitanya Kulkarni
  1 sibling, 1 reply; 19+ messages in thread
From: Keith Busch @ 2022-02-15 19:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Sagi Grimberg, Chaitanya Kulkarni, linux-nvme, Chaitanya Kulkarni

On Tue, Feb 15, 2022 at 07:42:21PM +0100, Christoph Hellwig wrote:
> On Mon, Feb 14, 2022 at 12:59:49PM +0200, Sagi Grimberg wrote:
> >> I did cc you, here is the link, somehow it takes a while to appear
> >> on the mailing list than it appears in my mail box :-
> >
> > Yea, got it, just a tad late...
> 
> So which of the two versions should we go with?  Either one will need
> reviews :)

With the exception of 1/7 that sneaked in Sagi's set, the patches are
identical (including the file ordering despite no dependency!), and both
look fine to me. Sagi's was posted first by a slim margin, so I guess
use that one unless you prefer Chaitanya's changelogs.

Reviewed-by: Keith Busch <kbusch@kernel.org>


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 0/7] nvme: cleanup ida_simple_[get|remove]
  2022-02-15 19:27           ` Keith Busch
@ 2022-02-15 20:01             ` Chaitanya Kulkarni
  0 siblings, 0 replies; 19+ messages in thread
From: Chaitanya Kulkarni @ 2022-02-15 20:01 UTC (permalink / raw)
  To: Keith Busch; +Cc: Sagi Grimberg, linux-nvme, Christoph Hellwig

On 2/15/22 11:27, Keith Busch wrote:
> On Tue, Feb 15, 2022 at 07:42:21PM +0100, Christoph Hellwig wrote:
>> On Mon, Feb 14, 2022 at 12:59:49PM +0200, Sagi Grimberg wrote:
>>>> I did cc you, here is the link, somehow it takes a while to appear
>>>> on the mailing list than it appears in my mail box :-
>>>
>>> Yea, got it, just a tad late...
>>
>> So which of the two versions should we go with?  Either one will need
>> reviews :)
> 
> With the exception of 1/7 that sneaked in Sagi's set, the patches are
> identical (including the file ordering despite no dependency!), and both

he he I did notice that too. I had those patches sitting in my tree from
last Wednesday [1] was waiting for any re-base from sunday ..

> look fine to me. Sagi's was posted first by a slim margin, so I guess
> use that one unless you prefer Chaitanya's changelogs.
> 
> Reviewed-by: Keith Busch <kbusch@kernel.org>
> 

[1]
==> 0001-nvme-core-use-non-deprecated-ida_simple_xxx-APIs.patch <==
 From 1947100055819548f45a29243a480118877a6f2a Mon Sep 17 00:00:00 2001
From: Chaitanya Kulkarni <kch@nvidia.com>
Date: Wed, 9 Feb 2022 00:02:58 -0800
Subject: [PATCH 1/6] nvme-core: use non-deprecated ida_simple_xxx APIs


==> 0002-nvme-fc-use-non-deprecated-ida_simple_xxx-APIs.patch <==
 From 433da9015cff89b0defcc070a3cc7ebe0dde3bf9 Mon Sep 17 00:00:00 2001
From: Chaitanya Kulkarni <kch@nvidia.com>
Date: Wed, 9 Feb 2022 00:03:34 -0800
Subject: [PATCH 2/6] nvme-fc: use non-deprecated ida_simple_xxx APIs


==> 0003-nvmet-use-non-deprecated-ida_simple_xxx-APIs.patch <==
 From 6a1310fdb15be3aa080aee58fca511665c464e88 Mon Sep 17 00:00:00 2001
From: Chaitanya Kulkarni <kch@nvidia.com>
Date: Wed, 9 Feb 2022 00:03:56 -0800
Subject: [PATCH 3/6] nvmet: use non-deprecated ida_simple_xxx APIs


==> 0004-nvmet-fc-use-non-deprecated-ida_simple_xxx-APIs.patch <==
 From 91f89b972f95ab43f56e8a166ed05fae02df1e7a Mon Sep 17 00:00:00 2001
From: Chaitanya Kulkarni <kch@nvidia.com>
Date: Wed, 9 Feb 2022 00:04:27 -0800
Subject: [PATCH 4/6] nvmet-fc: use non-deprecated ida_simple_xxx APIs


==> 0005-nvmet-rdma-use-non-deprecated-ida_simple_xxx-APIs.patch <==
 From c74c2a302f50c3b6a41c43d3f6c23f3969695f98 Mon Sep 17 00:00:00 2001
From: Chaitanya Kulkarni <kch@nvidia.com>
Date: Wed, 9 Feb 2022 00:04:49 -0800
Subject: [PATCH 5/6] nvmet-rdma: use non-deprecated ida_simple_xxx APIs


==> 0006-nvmet-tcp-use-non-deprecated-ida_simple_xxx-APIs.patch <==
 From e16abc2c99fcd7e7bd5eeb23780e5b967ed2df3b Mon Sep 17 00:00:00 2001
From: Chaitanya Kulkarni <kch@nvidia.com>
Date: Wed, 9 Feb 2022 00:05:17 -0800
Subject: [PATCH 6/6] nvmet-tcp: use non-deprecated ida_simple_xxx APIs



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 0/7] nvme: cleanup ida_simple_[get|remove]
  2022-02-14  9:07 [PATCH 0/7] nvme: cleanup ida_simple_[get|remove] Sagi Grimberg
                   ` (7 preceding siblings ...)
  2022-02-14 10:03 ` [PATCH 0/7] nvme: cleanup ida_simple_[get|remove] Chaitanya Kulkarni
@ 2022-02-16  8:02 ` Christoph Hellwig
  8 siblings, 0 replies; 19+ messages in thread
From: Christoph Hellwig @ 2022-02-16  8:02 UTC (permalink / raw)
  To: Sagi Grimberg
  Cc: linux-nvme, Christoph Hellwig, Keith Busch, Chaitanya Kulkarni

Thanks,

applied to nvme-5.18.


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2022-02-16  8:02 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-14  9:07 [PATCH 0/7] nvme: cleanup ida_simple_[get|remove] Sagi Grimberg
2022-02-14  9:07 ` [PATCH 1/7] nvme-tcp: fix bogus request completion when failing to send AER Sagi Grimberg
2022-02-14 10:52   ` Chaitanya Kulkarni
2022-02-14 10:59     ` Sagi Grimberg
2022-02-14  9:07 ` [PATCH 2/7] nvme: replace ida_simple[get|remove] with the simler ida_[alloc|free] Sagi Grimberg
2022-02-14  9:07 ` [PATCH 3/7] nvme-fc: " Sagi Grimberg
2022-02-14  9:07 ` [PATCH 4/7] nvmet: " Sagi Grimberg
2022-02-14  9:07 ` [PATCH 5/7] nvmet-fc: " Sagi Grimberg
2022-02-14  9:07 ` [PATCH 6/7] nvmet-rdma: " Sagi Grimberg
2022-02-14  9:07 ` [PATCH 7/7] nvmet-tcp: " Sagi Grimberg
2022-02-14 10:03 ` [PATCH 0/7] nvme: cleanup ida_simple_[get|remove] Chaitanya Kulkarni
2022-02-14 10:22   ` Sagi Grimberg
2022-02-14 10:44     ` Chaitanya Kulkarni
2022-02-14 10:59       ` Sagi Grimberg
2022-02-15 18:42         ` Christoph Hellwig
2022-02-15 19:15           ` Chaitanya Kulkarni
2022-02-15 19:27           ` Keith Busch
2022-02-15 20:01             ` Chaitanya Kulkarni
2022-02-16  8:02 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.