All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] null_blk: Fix an error handling path in null_add_dev()
@ 2022-03-27 18:48 Christophe JAILLET
  2022-03-27 18:48 ` [PATCH 2/2] null_blk: Update ida_simple_get()/ida_simple_remove() to the newer ida API Christophe JAILLET
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe JAILLET @ 2022-03-27 18:48 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-block

In case of error, call to ida_simple_get() must be undone in the error
handling path.

Fixes: a0725ab0c753 ("Merge branch 'for-4.14/block' of git://git.kernel.dk/linux-block")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/block/null_blk/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 05b1120e6623..a330a118659d 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -2074,6 +2074,7 @@ static int null_add_dev(struct nullb_device *dev)
 	return 0;
 out_cleanup_zone:
 	null_free_zoned_dev(dev);
+	ida_free(&nullb_indexes, nullb->index);
 out_cleanup_disk:
 	blk_cleanup_disk(nullb->disk);
 out_cleanup_tags:
-- 
2.32.0


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

* [PATCH 2/2] null_blk: Update ida_simple_get()/ida_simple_remove() to the newer ida API
  2022-03-27 18:48 [PATCH 1/2] null_blk: Fix an error handling path in null_add_dev() Christophe JAILLET
@ 2022-03-27 18:48 ` Christophe JAILLET
  2022-03-28  3:00   ` Chaitanya Kulkarni
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe JAILLET @ 2022-03-27 18:48 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-block

ida_simple_get() and ida_simple_remove() are deprecated. Use ida_alloc()
and ida_free() instead. It is less verbose.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/block/null_blk/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index a330a118659d..6b4248cc310a 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -1724,7 +1724,7 @@ static void null_del_dev(struct nullb *nullb)
 
 	dev = nullb->dev;
 
-	ida_simple_remove(&nullb_indexes, nullb->index);
+	ida_free(&nullb_indexes, nullb->index);
 
 	list_del_init(&nullb->list);
 
@@ -2044,7 +2044,7 @@ static int null_add_dev(struct nullb_device *dev)
 	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, nullb->q);
 
 	mutex_lock(&lock);
-	nullb->index = ida_simple_get(&nullb_indexes, 0, 0, GFP_KERNEL);
+	nullb->index = ida_alloc(&nullb_indexes, GFP_KERNEL);
 	dev->index = nullb->index;
 	mutex_unlock(&lock);
 
-- 
2.32.0


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

* Re: [PATCH 2/2] null_blk: Update ida_simple_get()/ida_simple_remove() to the newer ida API
  2022-03-27 18:48 ` [PATCH 2/2] null_blk: Update ida_simple_get()/ida_simple_remove() to the newer ida API Christophe JAILLET
@ 2022-03-28  3:00   ` Chaitanya Kulkarni
  2022-03-28 18:08     ` Christophe JAILLET
  0 siblings, 1 reply; 4+ messages in thread
From: Chaitanya Kulkarni @ 2022-03-28  3:00 UTC (permalink / raw)
  To: Christophe JAILLET; +Cc: Jens Axboe, linux-kernel, kernel-janitors, linux-block


> On Mar 27, 2022, at 11:48 AM, Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> 
> ida_simple_get() and ida_simple_remove() are deprecated. Use ida_alloc()
> and ida_free() instead. It is less verbose.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 

I have alredy sent out patch for this....



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

* Re: [PATCH 2/2] null_blk: Update ida_simple_get()/ida_simple_remove() to the newer ida API
  2022-03-28  3:00   ` Chaitanya Kulkarni
@ 2022-03-28 18:08     ` Christophe JAILLET
  0 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2022-03-28 18:08 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: Jens Axboe, linux-kernel, kernel-janitors, linux-block

Le 28/03/2022 à 05:00, Chaitanya Kulkarni a écrit :
> 
>> On Mar 27, 2022, at 11:48 AM, Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
>>
>> ida_simple_get() and ida_simple_remove() are deprecated. Use ida_alloc()
>> and ida_free() instead. It is less verbose.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>>
> 
> I have alredy sent out patch for this....
> 
> 
Hi,

I was not aware of it...

Do you plan to send patches for all ida_xxx() changes that are needed 
all over the kernel or is it only limited to 
'drivers/block/null_blk/main.c'?

(read: should I spend time on it, or is the phasing out of this 
deprecated API is already on the todo list of someone)

CJ

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

end of thread, other threads:[~2022-03-28 18:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-27 18:48 [PATCH 1/2] null_blk: Fix an error handling path in null_add_dev() Christophe JAILLET
2022-03-27 18:48 ` [PATCH 2/2] null_blk: Update ida_simple_get()/ida_simple_remove() to the newer ida API Christophe JAILLET
2022-03-28  3:00   ` Chaitanya Kulkarni
2022-03-28 18:08     ` Christophe JAILLET

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.