nvme: remove deprecated ida_simple_XX()
Subsystems (3)
Chaitanya Kulkarni
maintainercover nvme: remove deprecated ida_simple_XX()
Hi,
Remove deprecetd ida_simple_get() and ida_simple_remove() calls and use ida_alloc() and ida_free().
-ck
Chaitanya Kulkarni (6):
nvme-core: use non-deprecated ida_simple_xxx APIs
nvme-fc: use non-deprecated ida_simple_xxx APIs
nvmet: use non-deprecated ida_simple_xxx APIs
nvmet-fc: use non-deprecated ida_simple_xxx APIs
nvmet-rdma: use non-deprecated ida_simple_xxx APIs
nvmet-tcp: use non-deprecated ida_simple_xxx APIs
drivers/nvme/host/core.c | 18 +++++++++--------- drivers/nvme/host/fc.c | 16 ++++++++-------- drivers/nvme/target/core.c | 6 +++--- drivers/nvme/target/fc.c | 13 ++++++------- drivers/nvme/target/rdma.c | 6 +++--- drivers/nvme/target/tcp.c | 6 +++--- 6 files changed, 32 insertions(+), 33 deletions(-)
Signature · 1 line
2.29.0
Chaitanya Kulkarni
maintainerPATCH 1/6 nvme-core: use non-deprecated ida_simple_xxx APIs
As per the documentation present in the file include/linux/idr.h ida_simple_get() and ida_simple_remove() are deprecated and we should be using ida_alloc() and ida_free() instead respectively.
--- drivers/nvme/host/core.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/nvme/host/core.c +9 -9
@@ -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:
@@ -4429,7 +4429,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);
@@ -4488,7 +4488,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;
@@ -4529,7 +4529,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);
Signature · 1 line
2.29.0
Chaitanya Kulkarni
maintainerPATCH 2/6 nvme-fc: use non-deprecated ida_simple_xxx APIs
In reply to Chaitanya KulkarniAs per the documentation present in the file include/linux/idr.h ida_simple_get() and ida_simple_remove() are deprecated and we should be using ida_alloc() and ida_free() instead respectively.
--- drivers/nvme/host/fc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/nvme/host/fc.c +8 -8
@@ -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);
@@ -3470,7 +3470,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;
@@ -3633,7 +3633,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:
Signature · 1 line
2.29.0
Chaitanya Kulkarni
maintainerPATCH 3/6 nvmet: use non-deprecated ida_simple_xxx APIs
In reply to Chaitanya KulkarniAs per the documentation present in the file include/linux/idr.h ida_simple_get() and ida_simple_remove() are deprecated and we should be using ida_alloc() and ida_free() instead respectively.
--- drivers/nvme/target/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvme/target/core.c +3 -3
@@ -1400,8 +1400,8 @@ 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, - subsys->cntlid_min, subsys->cntlid_max, + ret =ida_alloc_range (&cntlid_ida, + subsys->cntlid_min, subsys->cntlid_max -1 ,GFP_KERNEL );if (ret <0 ) { status =NVME_SC_CONNECT_CTRL_BUSY |NVME_SC_DNR ;
@@ -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);
Signature · 1 line
2.29.0
Chaitanya Kulkarni
maintainerPATCH 4/6 nvmet-fc: use non-deprecated ida_simple_xxx APIs
In reply to Chaitanya KulkarniAs per the documentation present in the file include/linux/idr.h ida_simple_get() and ida_simple_remove() are deprecated and we should be using ida_alloc() and ida_free() instead respectively.
--- drivers/nvme/target/fc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/nvme/target/fc.c +6 -7
@@ -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,8 +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, - tgtport->fc_target_port.port_num); +ida_free (&nvmet_fc_tgtport_cnt, tgtport->fc_target_port.port_num);ida_destroy (&tgtport->assoc_cnt);
Signature · 1 line
2.29.0
Chaitanya Kulkarni
maintainerPATCH 5/6 nvmet-rdma: use non-deprecated ida_simple_xxx APIs
In reply to Chaitanya KulkarniAs per the documentation present in the file include/linux/idr.h ida_simple_get() and ida_simple_remove() are deprecated and we should be using ida_alloc() and ida_free() instead respectively.
--- drivers/nvme/target/rdma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvme/target/rdma.c +3 -3
@@ -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:
Signature · 1 line
2.29.0
Chaitanya Kulkarni
maintainerPATCH 6/6 nvmet-tcp: use non-deprecated ida_simple_xxx APIs
In reply to Chaitanya KulkarniAs per the documentation present in the file include/linux/idr.h ida_simple_get() and ida_simple_remove() are deprecated and we should be using ida_alloc() and ida_free() instead respectively.
--- drivers/nvme/target/tcp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvme/target/tcp.c +3 -3
@@ -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;
Signature · 1 line
2.29.0