Linux block layer
 help / color / mirror / Atom feed
* [PATCH] virtio-blk: replace ida_simple[get|remove] with ida_[alloc_range|free]
       [not found] <CGME20221130123126eucas1p2cd3287ee4e5c03642f1847c50af0e4f2@eucas1p2.samsung.com>
@ 2022-11-30 12:30 ` Pankaj Raghav
  2022-11-30 20:51   ` Stefan Hajnoczi
  2022-11-30 21:24   ` Jens Axboe
  0 siblings, 2 replies; 4+ messages in thread
From: Pankaj Raghav @ 2022-11-30 12:30 UTC (permalink / raw)
  To: stefanha, pbonzini
  Cc: jasowang, mst, gost.dev, Pankaj Raghav, axboe, virtualization,
	linux-block, Pankaj Raghav

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(-)

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;
 }
-- 
2.35.1


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

* Re: [PATCH] virtio-blk: replace ida_simple[get|remove] with ida_[alloc_range|free]
  2022-11-30 12:30 ` [PATCH] virtio-blk: replace ida_simple[get|remove] with ida_[alloc_range|free] Pankaj Raghav
@ 2022-11-30 20:51   ` Stefan Hajnoczi
  2022-11-30 23:21     ` Chaitanya Kulkarni
  2022-11-30 21:24   ` Jens Axboe
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2022-11-30 20:51 UTC (permalink / raw)
  To: Pankaj Raghav
  Cc: pbonzini, jasowang, mst, gost.dev, Pankaj Raghav, axboe,
	virtualization, linux-block, Chaitanya Kulkarni

[-- Attachment #1: Type: text/plain, Size: 660 bytes --]

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>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] virtio-blk: replace ida_simple[get|remove] with ida_[alloc_range|free]
  2022-11-30 12:30 ` [PATCH] virtio-blk: replace ida_simple[get|remove] with ida_[alloc_range|free] Pankaj Raghav
  2022-11-30 20:51   ` Stefan Hajnoczi
@ 2022-11-30 21:24   ` Jens Axboe
  1 sibling, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2022-11-30 21:24 UTC (permalink / raw)
  To: pbonzini, Pankaj Raghav, stefanha
  Cc: Pankaj Raghav, gost.dev, mst, linux-block, virtualization,
	jasowang

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,
-- 
Jens Axboe



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

* Re: [PATCH] virtio-blk: replace ida_simple[get|remove] with ida_[alloc_range|free]
  2022-11-30 20:51   ` Stefan Hajnoczi
@ 2022-11-30 23:21     ` Chaitanya Kulkarni
  0 siblings, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2022-11-30 23:21 UTC (permalink / raw)
  To: Stefan Hajnoczi, Pankaj Raghav
  Cc: pbonzini@redhat.com, jasowang@redhat.com, mst@redhat.com,
	gost.dev@samsung.com, Pankaj Raghav, axboe@kernel.dk,
	virtualization@lists.linux-foundation.org,
	linux-block@vger.kernel.org, Chaitanya Kulkarni

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


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

end of thread, other threads:[~2022-11-30 23:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20221130123126eucas1p2cd3287ee4e5c03642f1847c50af0e4f2@eucas1p2.samsung.com>
2022-11-30 12:30 ` [PATCH] virtio-blk: replace ida_simple[get|remove] with ida_[alloc_range|free] Pankaj Raghav
2022-11-30 20:51   ` Stefan Hajnoczi
2022-11-30 23:21     ` Chaitanya Kulkarni
2022-11-30 21:24   ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox