]> git.baikalelectronics.ru Git - kernel.git/commitdiff
block: Directly use ida_alloc()/free()
authorBo Liu <liubo03@inspur.com>
Wed, 15 Jun 2022 08:18:16 +0000 (04:18 -0400)
committerJens Axboe <axboe@kernel.dk>
Mon, 27 Jun 2022 12:29:11 +0000 (06:29 -0600)
Use ida_alloc()/ida_free() instead of
ida_simple_get()/ida_simple_remove().
The latter is deprecated and more verbose.

Signed-off-by: Bo Liu <liubo03@inspur.com>
Reviewed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/20220615081816.4342-1-liubo03@inspur.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-core.c
block/blk-sysfs.c

index 27fb1357ad4b81bd5940ede8908a37e56abfa158..c2cec402d01c04157afe44cfd3919d1fecad7636 100644 (file)
@@ -435,7 +435,7 @@ struct request_queue *blk_alloc_queue(int node_id, bool alloc_srcu)
 
        q->last_merge = NULL;
 
-       q->id = ida_simple_get(&blk_queue_ida, 0, 0, GFP_KERNEL);
+       q->id = ida_alloc(&blk_queue_ida, GFP_KERNEL);
        if (q->id < 0)
                goto fail_srcu;
 
@@ -485,7 +485,7 @@ fail_stats:
 fail_split:
        bioset_exit(&q->bio_split);
 fail_id:
-       ida_simple_remove(&blk_queue_ida, q->id);
+       ida_free(&blk_queue_ida, q->id);
 fail_srcu:
        if (alloc_srcu)
                cleanup_srcu_struct(q->srcu);
index ec716ea26b920017dd1c6677b381f83ea3a6fbee..69e53d1a4f0e62c662b6486179e27ed764e2da1c 100644 (file)
@@ -791,7 +791,7 @@ static void blk_release_queue(struct kobject *kobj)
        if (blk_queue_has_srcu(q))
                cleanup_srcu_struct(q->srcu);
 
-       ida_simple_remove(&blk_queue_ida, q->id);
+       ida_free(&blk_queue_ida, q->id);
        call_rcu(&q->rcu_head, blk_free_queue_rcu);
 }