* Re: [PATCH 4/4] virtio-blk: remove deprecated ida_simple_XXX()
@ 2022-05-27 8:04 Christophe JAILLET
2022-05-27 10:19 ` Michael S. Tsirkin
0 siblings, 1 reply; 6+ messages in thread
From: Christophe JAILLET @ 2022-05-27 8:04 UTC (permalink / raw)
To: kch
Cc: jasowang, linux-block, mst, pbonzini, stefanha, virtualization,
keliu, linux-kernel
(Resend, my email client sent it as HTML. So sorry for the duplicate)
Hi,
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 74c3a48cd1e5..e05748337dd1 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -720,8 +720,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_max(&vd_index_ida, minor_to_index(1 << MINORBITS),
>+ GFP_KERNEL);
> if (err < 0)
> goto out;
> index = err;
this patch, already applied to -next, is wrong.
The upper bound of ida_simple_get() is exlcusive, while the one of
ida_alloc_max() is inclusive.
So, 'minor_to_index(1 << MINORBITS)' should be 'minor_to_index(1 <<
MINORBITS) - 1' here.
(adding keliu in cc: because he is proposing the same kind of patches,
so he will see how to to these changes that are slighly tricky)
CJ
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 4/4] virtio-blk: remove deprecated ida_simple_XXX()
2022-05-27 8:04 [PATCH 4/4] virtio-blk: remove deprecated ida_simple_XXX() Christophe JAILLET
@ 2022-05-27 10:19 ` Michael S. Tsirkin
0 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2022-05-27 10:19 UTC (permalink / raw)
To: Christophe JAILLET
Cc: kch, jasowang, linux-block, pbonzini, stefanha, virtualization,
keliu, linux-kernel
On Fri, May 27, 2022 at 10:04:46AM +0200, Christophe JAILLET wrote:
> (Resend, my email client sent it as HTML. So sorry for the duplicate)
>
>
> Hi,
>
> > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> > index 74c3a48cd1e5..e05748337dd1 100644
> > --- a/drivers/block/virtio_blk.c
> > +++ b/drivers/block/virtio_blk.c
> > @@ -720,8 +720,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_max(&vd_index_ida, minor_to_index(1 << MINORBITS),
> >+ GFP_KERNEL);
> > if (err < 0)
> > goto out;
> > index = err;
>
>
> this patch, already applied to -next, is wrong.
>
>
> The upper bound of ida_simple_get() is exlcusive, while the one of
> ida_alloc_max() is inclusive.
>
> So, 'minor_to_index(1 << MINORBITS)' should be 'minor_to_index(1 <<
> MINORBITS) - 1' here.
>
>
> (adding keliu in cc: because he is proposing the same kind of patches, so he
> will see how to to these changes that are slighly tricky)
>
>
> CJ
I will drop this for now, please resend with either
a corrected version or a comment explaining why it's correct.
Thanks!
--
MST
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 4/4] virtio-blk: remove deprecated ida_simple_XXX()
@ 2022-05-27 10:19 ` Michael S. Tsirkin
0 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2022-05-27 10:19 UTC (permalink / raw)
To: Christophe JAILLET
Cc: keliu, linux-kernel, virtualization, linux-block, stefanha, pbonzini
On Fri, May 27, 2022 at 10:04:46AM +0200, Christophe JAILLET wrote:
> (Resend, my email client sent it as HTML. So sorry for the duplicate)
>
>
> Hi,
>
> > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> > index 74c3a48cd1e5..e05748337dd1 100644
> > --- a/drivers/block/virtio_blk.c
> > +++ b/drivers/block/virtio_blk.c
> > @@ -720,8 +720,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_max(&vd_index_ida, minor_to_index(1 << MINORBITS),
> >+ GFP_KERNEL);
> > if (err < 0)
> > goto out;
> > index = err;
>
>
> this patch, already applied to -next, is wrong.
>
>
> The upper bound of ida_simple_get() is exlcusive, while the one of
> ida_alloc_max() is inclusive.
>
> So, 'minor_to_index(1 << MINORBITS)' should be 'minor_to_index(1 <<
> MINORBITS) - 1' here.
>
>
> (adding keliu in cc: because he is proposing the same kind of patches, so he
> will see how to to these changes that are slighly tricky)
>
>
> CJ
I will drop this for now, please resend with either
a corrected version or a comment explaining why it's correct.
Thanks!
--
MST
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 0/4] virtio-blk: small cleanup
@ 2022-04-20 4:10 Chaitanya Kulkarni
2022-04-20 4:10 ` [PATCH 4/4] virtio-blk: remove deprecated ida_simple_XXX() Chaitanya Kulkarni
0 siblings, 1 reply; 6+ messages in thread
From: Chaitanya Kulkarni @ 2022-04-20 4:10 UTC (permalink / raw)
To: mst, jasowang, pbonzini, stefanha
Cc: virtualization, linux-block, Chaitanya Kulkarni
Hi,
This has some nit fixes and code cleanups along with removing
deprecated API fir ida_simple_XXX().
-ck
Chaitanya Kulkarni (4):
virtio-blk: remove additional check in fast path
virtio-blk: don't add a new line
virtio-blk: avoid function call in the fast path
virtio-blk: remove deprecated ida_simple_XXX()
drivers/block/virtio_blk.c | 38 +++++++++++++++++---------------------
1 file changed, 17 insertions(+), 21 deletions(-)
--
2.29.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/4] virtio-blk: remove deprecated ida_simple_XXX()
2022-04-20 4:10 [PATCH 0/4] virtio-blk: small cleanup Chaitanya Kulkarni
@ 2022-04-20 4:10 ` Chaitanya Kulkarni
2022-04-20 15:19 ` Stefan Hajnoczi
0 siblings, 1 reply; 6+ messages in thread
From: Chaitanya Kulkarni @ 2022-04-20 4:10 UTC (permalink / raw)
To: mst, jasowang, pbonzini, stefanha
Cc: virtualization, linux-block, Chaitanya Kulkarni
Replace deprecated ida_simple_get() and ida_simple_remove() with
ida_alloc_max() and ida_free().
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.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 74c3a48cd1e5..e05748337dd1 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -411,7 +411,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);
}
@@ -720,8 +720,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_max(&vd_index_ida, minor_to_index(1 << MINORBITS),
+ GFP_KERNEL);
if (err < 0)
goto out;
index = err;
@@ -911,7 +911,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.29.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 4/4] virtio-blk: remove deprecated ida_simple_XXX()
2022-04-20 4:10 ` [PATCH 4/4] virtio-blk: remove deprecated ida_simple_XXX() Chaitanya Kulkarni
@ 2022-04-20 15:19 ` Stefan Hajnoczi
0 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2022-04-20 15:19 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: linux-block, pbonzini, virtualization, mst
[-- Attachment #1.1: Type: text/plain, Size: 387 bytes --]
On Tue, Apr 19, 2022 at 09:10:53PM -0700, Chaitanya Kulkarni wrote:
> Replace deprecated ida_simple_get() and ida_simple_remove() with
> ida_alloc_max() and ida_free().
>
> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
> ---
> drivers/block/virtio_blk.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 183 bytes --]
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 4/4] virtio-blk: remove deprecated ida_simple_XXX()
@ 2022-04-20 15:19 ` Stefan Hajnoczi
0 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2022-04-20 15:19 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: mst, jasowang, pbonzini, virtualization, linux-block
[-- Attachment #1: Type: text/plain, Size: 387 bytes --]
On Tue, Apr 19, 2022 at 09:10:53PM -0700, Chaitanya Kulkarni wrote:
> Replace deprecated ida_simple_get() and ida_simple_remove() with
> ida_alloc_max() and ida_free().
>
> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
> ---
> drivers/block/virtio_blk.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-05-27 10:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-27 8:04 [PATCH 4/4] virtio-blk: remove deprecated ida_simple_XXX() Christophe JAILLET
2022-05-27 10:19 ` Michael S. Tsirkin
2022-05-27 10:19 ` Michael S. Tsirkin
-- strict thread matches above, loose matches on Subject: below --
2022-04-20 4:10 [PATCH 0/4] virtio-blk: small cleanup Chaitanya Kulkarni
2022-04-20 4:10 ` [PATCH 4/4] virtio-blk: remove deprecated ida_simple_XXX() Chaitanya Kulkarni
2022-04-20 15:19 ` Stefan Hajnoczi
2022-04-20 15:19 ` Stefan Hajnoczi
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.