diff mbox series

virtio-blk: replace ida_simple[get|remove] with ida_[alloc_range|free]

Message ID 20221130123001.25473-1-p.raghav@samsung.com (mailing list archive)
State New, archived
Headers show
Series virtio-blk: replace ida_simple[get|remove] with ida_[alloc_range|free] | expand

Commit Message

Pankaj Raghav Nov. 30, 2022, 12:30 p.m. UTC
ida_simple[get|remove] are deprecated, and are just wrappers to
ida_[alloc_range|free]. Replace ida_simple[get|remove] with their
corresponding counterparts.

No functional changes.

Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
---
 drivers/block/virtio_blk.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Stefan Hajnoczi Nov. 30, 2022, 8:51 p.m. UTC | #1
On Wed, Nov 30, 2022 at 01:30:03PM +0100, Pankaj Raghav wrote:
> ida_simple[get|remove] are deprecated, and are just wrappers to
> ida_[alloc_range|free]. Replace ida_simple[get|remove] with their
> corresponding counterparts.
> 
> No functional changes.
> 
> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
> ---
>  drivers/block/virtio_blk.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Chaitanya proposed a similar patch in the past:
https://lore.kernel.org/all/20220420041053.7927-5-kch@nvidia.com/

Your patch calculates the max argument correctly. Looks good.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Jens Axboe Nov. 30, 2022, 9:24 p.m. UTC | #2
On Wed, 30 Nov 2022 13:30:03 +0100, Pankaj Raghav wrote:
> ida_simple[get|remove] are deprecated, and are just wrappers to
> ida_[alloc_range|free]. Replace ida_simple[get|remove] with their
> corresponding counterparts.
> 
> No functional changes.
> 
> 
> [...]

Applied, thanks!

[1/1] virtio-blk: replace ida_simple[get|remove] with ida_[alloc_range|free]
      commit: 92a34c461719eb4a3f95353bb7b27a3238eb7478

Best regards,
Chaitanya Kulkarni Nov. 30, 2022, 11:21 p.m. UTC | #3
On 11/30/22 12:51, Stefan Hajnoczi wrote:
> On Wed, Nov 30, 2022 at 01:30:03PM +0100, Pankaj Raghav wrote:
>> ida_simple[get|remove] are deprecated, and are just wrappers to
>> ida_[alloc_range|free]. Replace ida_simple[get|remove] with their
>> corresponding counterparts.
>>
>> No functional changes.
>>
>> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
>> ---
>>   drivers/block/virtio_blk.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> Chaitanya proposed a similar patch in the past:
> https://lore.kernel.org/all/20220420041053.7927-5-kch@nvidia.com/
> 
> Your patch calculates the max argument correctly. Looks good.
> 
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

Ughhh I completely forgot about this, thanks a lot for fixing
this Pankaj.

-ck
diff mbox series

Patch

diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 19da5defd734..68bd2f7961b3 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -512,7 +512,7 @@  static void virtblk_free_disk(struct gendisk *disk)
 {
 	struct virtio_blk *vblk = disk->private_data;
 
-	ida_simple_remove(&vd_index_ida, vblk->index);
+	ida_free(&vd_index_ida, vblk->index);
 	mutex_destroy(&vblk->vdev_mutex);
 	kfree(vblk);
 }
@@ -902,8 +902,8 @@  static int virtblk_probe(struct virtio_device *vdev)
 		return -EINVAL;
 	}
 
-	err = ida_simple_get(&vd_index_ida, 0, minor_to_index(1 << MINORBITS),
-			     GFP_KERNEL);
+	err = ida_alloc_range(&vd_index_ida, 0,
+			      minor_to_index(1 << MINORBITS) - 1, GFP_KERNEL);
 	if (err < 0)
 		goto out;
 	index = err;
@@ -1163,7 +1163,7 @@  static int virtblk_probe(struct virtio_device *vdev)
 out_free_vblk:
 	kfree(vblk);
 out_free_index:
-	ida_simple_remove(&vd_index_ida, index);
+	ida_free(&vd_index_ida, index);
 out:
 	return err;
 }