* [PATCH] block: Directly use ida_alloc()/free()
@ 2022-06-15 8:18 Bo Liu
2022-06-15 18:38 ` Christophe JAILLET
2022-06-15 21:30 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Bo Liu @ 2022-06-15 8:18 UTC (permalink / raw)
To: axboe; +Cc: linux-block, linux-kernel, Bo Liu
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>
---
block/blk-core.c | 4 ++--
block/blk-sysfs.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index 06ff5bbfe8f6..eb86c756a7fd 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -448,7 +448,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;
@@ -498,7 +498,7 @@ struct request_queue *blk_alloc_queue(int node_id, bool alloc_srcu)
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);
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 14607565d781..2ed9e7d52b47 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -799,7 +799,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);
}
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] block: Directly use ida_alloc()/free()
2022-06-15 8:18 [PATCH] block: Directly use ida_alloc()/free() Bo Liu
@ 2022-06-15 18:38 ` Christophe JAILLET
2022-06-15 21:30 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Christophe JAILLET @ 2022-06-15 18:38 UTC (permalink / raw)
To: Bo Liu, axboe; +Cc: linux-block, linux-kernel
Le 15/06/2022 à 10:18, Bo Liu a écrit :
> 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>
Hi,
for what it's worth:
Reviewed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> block/blk-core.c | 4 ++--
> block/blk-sysfs.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 06ff5bbfe8f6..eb86c756a7fd 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -448,7 +448,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;
>
> @@ -498,7 +498,7 @@ struct request_queue *blk_alloc_queue(int node_id, bool alloc_srcu)
> 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);
> diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
> index 14607565d781..2ed9e7d52b47 100644
> --- a/block/blk-sysfs.c
> +++ b/block/blk-sysfs.c
> @@ -799,7 +799,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);
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] block: Directly use ida_alloc()/free()
2022-06-15 8:18 [PATCH] block: Directly use ida_alloc()/free() Bo Liu
2022-06-15 18:38 ` Christophe JAILLET
@ 2022-06-15 21:30 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2022-06-15 21:30 UTC (permalink / raw)
To: liubo03; +Cc: linux-block, linux-kernel
On Wed, 15 Jun 2022 04:18:16 -0400, Bo Liu wrote:
> Use ida_alloc()/ida_free() instead of
> ida_simple_get()/ida_simple_remove().
> The latter is deprecated and more verbose.
>
>
Applied, thanks!
[1/1] block: Directly use ida_alloc()/free()
commit: c13794dbe936a62a9b509ece1423a59287b9c80f
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-15 21:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15 8:18 [PATCH] block: Directly use ida_alloc()/free() Bo Liu
2022-06-15 18:38 ` Christophe JAILLET
2022-06-15 21:30 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).