Skip to content

Commit cd30e8b

Browse files
tititiou36idryomov
authored andcommitted
rbd: remove usage of the deprecated ida_simple_*() API
ida_alloc() and ida_free() should be preferred to the deprecated ida_simple_get() and ida_simple_remove(). Note that the upper limit of ida_simple_get() is exclusive, while that of ida_alloc_max() is inclusive, so 1 has been subtracted. [ idryomov: tweak changelog ] Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Ilya Dryomov <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent 6613476 commit cd30e8b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/block/rbd.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5326,7 +5326,7 @@ static void rbd_dev_release(struct device *dev)
53265326

53275327
if (need_put) {
53285328
destroy_workqueue(rbd_dev->task_wq);
5329-
ida_simple_remove(&rbd_dev_id_ida, rbd_dev->dev_id);
5329+
ida_free(&rbd_dev_id_ida, rbd_dev->dev_id);
53305330
}
53315331

53325332
rbd_dev_free(rbd_dev);
@@ -5402,9 +5402,9 @@ static struct rbd_device *rbd_dev_create(struct rbd_client *rbdc,
54025402
return NULL;
54035403

54045404
/* get an id and fill in device name */
5405-
rbd_dev->dev_id = ida_simple_get(&rbd_dev_id_ida, 0,
5406-
minor_to_rbd_dev_id(1 << MINORBITS),
5407-
GFP_KERNEL);
5405+
rbd_dev->dev_id = ida_alloc_max(&rbd_dev_id_ida,
5406+
minor_to_rbd_dev_id(1 << MINORBITS) - 1,
5407+
GFP_KERNEL);
54085408
if (rbd_dev->dev_id < 0)
54095409
goto fail_rbd_dev;
54105410

@@ -5425,7 +5425,7 @@ static struct rbd_device *rbd_dev_create(struct rbd_client *rbdc,
54255425
return rbd_dev;
54265426

54275427
fail_dev_id:
5428-
ida_simple_remove(&rbd_dev_id_ida, rbd_dev->dev_id);
5428+
ida_free(&rbd_dev_id_ida, rbd_dev->dev_id);
54295429
fail_rbd_dev:
54305430
rbd_dev_free(rbd_dev);
54315431
return NULL;

0 commit comments

Comments
 (0)