* Re: [PATCH] virtio_blk: decrement index when blockdevice is removed
2011-04-05 4:49 ` [PATCH] virtio_blk: decrement index when blockdevice is removed Takuma Umeya
@ 2011-04-05 5:08 ` Jens Axboe
2011-04-05 5:08 ` Jens Axboe
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2011-04-05 5:08 UTC (permalink / raw)
To: Takuma Umeya
Cc: john cooper, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, Tejun Heo,
Christoph Hellwig
On 2011-04-05 06:49, Takuma Umeya wrote:
> When virtio block device is removed, index does not get decremented. When
> another virtio disk is attached it uses the next device letter to the
> one that is suppose to be available.
>
> Signed-off-by: Takuma Umeya <tumeya@redhat.com>
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 6ecf89c..730e7af 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -489,6 +489,7 @@ static void __devexit virtblk_remove(struct virtio_device *vdev)
> mempool_destroy(vblk->pool);
> vdev->config->del_vqs(vdev);
> kfree(vblk);
> + index--;
> }
>
> static const struct virtio_device_id id_table[] = {
What happens when you delete a device that isn't the last one?
--
Jens Axboe
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] virtio_blk: decrement index when blockdevice is removed
2011-04-05 4:49 ` [PATCH] virtio_blk: decrement index when blockdevice is removed Takuma Umeya
2011-04-05 5:08 ` Jens Axboe
@ 2011-04-05 5:08 ` Jens Axboe
2011-04-06 1:32 ` Rusty Russell
2011-04-06 1:32 ` Rusty Russell
2011-04-06 19:17 ` Ryan Harper
2011-04-06 19:17 ` Ryan Harper
3 siblings, 2 replies; 10+ messages in thread
From: Jens Axboe @ 2011-04-05 5:08 UTC (permalink / raw)
To: Takuma Umeya
Cc: virtualization@lists.linux-foundation.org, Rusty Russell,
Christoph Hellwig, john cooper, Tejun Heo,
linux-kernel@vger.kernel.org
On 2011-04-05 06:49, Takuma Umeya wrote:
> When virtio block device is removed, index does not get decremented. When
> another virtio disk is attached it uses the next device letter to the
> one that is suppose to be available.
>
> Signed-off-by: Takuma Umeya <tumeya@redhat.com>
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 6ecf89c..730e7af 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -489,6 +489,7 @@ static void __devexit virtblk_remove(struct virtio_device *vdev)
> mempool_destroy(vblk->pool);
> vdev->config->del_vqs(vdev);
> kfree(vblk);
> + index--;
> }
>
> static const struct virtio_device_id id_table[] = {
What happens when you delete a device that isn't the last one?
--
Jens Axboe
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] virtio_blk: decrement index when blockdevice is removed
2011-04-05 5:08 ` Jens Axboe
@ 2011-04-06 1:32 ` Rusty Russell
2011-04-06 3:05 ` Jens Axboe
2011-04-06 3:05 ` Jens Axboe
2011-04-06 1:32 ` Rusty Russell
1 sibling, 2 replies; 10+ messages in thread
From: Rusty Russell @ 2011-04-06 1:32 UTC (permalink / raw)
To: Jens Axboe, Takuma Umeya
Cc: virtualization@lists.linux-foundation.org, Christoph Hellwig,
john cooper, Tejun Heo, linux-kernel@vger.kernel.org
On Tue, 05 Apr 2011 07:08:12 +0200, Jens Axboe <jaxboe@fusionio.com> wrote:
> On 2011-04-05 06:49, Takuma Umeya wrote:
> > When virtio block device is removed, index does not get decremented. When
> > another virtio disk is attached it uses the next device letter to the
> > one that is suppose to be available.
> >
> > Signed-off-by: Takuma Umeya <tumeya@redhat.com>
> >
> > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> > index 6ecf89c..730e7af 100644
> > --- a/drivers/block/virtio_blk.c
> > +++ b/drivers/block/virtio_blk.c
> > @@ -489,6 +489,7 @@ static void __devexit virtblk_remove(struct virtio_device *vdev)
> > mempool_destroy(vblk->pool);
> > vdev->config->del_vqs(vdev);
> > kfree(vblk);
> > + index--;
> > }
> >
> > static const struct virtio_device_id id_table[] = {
>
> What happens when you delete a device that isn't the last one?
Obviously we should do something cleverer for assigning drives.
It might be a cute if genhd gave us a function to get the next free
index for a given major number, and format it for us, like so:
/* Return the next available minor for a given @major, at least
* @spacing after the previous and, and append appropriate letters
* to @name if it's not NULL. -ve errno on fail (-ENOSPC?). */
int disk_next_minor(int major, unsigned spacing, char *name);
A trivial optimization would be to remember the last major and max minor
(resetting that if any disks are removed).
This could clean up other code, too.
Cheers,
Rusty.
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] virtio_blk: decrement index when blockdevice is removed
2011-04-06 1:32 ` Rusty Russell
@ 2011-04-06 3:05 ` Jens Axboe
2011-04-06 3:05 ` Jens Axboe
1 sibling, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2011-04-06 3:05 UTC (permalink / raw)
To: Rusty Russell
Cc: Takuma Umeya, virtualization@lists.linux-foundation.org,
Christoph Hellwig, john cooper, Tejun Heo,
linux-kernel@vger.kernel.org
On 2011-04-06 03:32, Rusty Russell wrote:
> On Tue, 05 Apr 2011 07:08:12 +0200, Jens Axboe <jaxboe@fusionio.com> wrote:
>> On 2011-04-05 06:49, Takuma Umeya wrote:
>>> When virtio block device is removed, index does not get decremented. When
>>> another virtio disk is attached it uses the next device letter to the
>>> one that is suppose to be available.
>>>
>>> Signed-off-by: Takuma Umeya <tumeya@redhat.com>
>>>
>>> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
>>> index 6ecf89c..730e7af 100644
>>> --- a/drivers/block/virtio_blk.c
>>> +++ b/drivers/block/virtio_blk.c
>>> @@ -489,6 +489,7 @@ static void __devexit virtblk_remove(struct virtio_device *vdev)
>>> mempool_destroy(vblk->pool);
>>> vdev->config->del_vqs(vdev);
>>> kfree(vblk);
>>> + index--;
>>> }
>>>
>>> static const struct virtio_device_id id_table[] = {
>>
>> What happens when you delete a device that isn't the last one?
>
> Obviously we should do something cleverer for assigning drives.
>
> It might be a cute if genhd gave us a function to get the next free
> index for a given major number, and format it for us, like so:
>
> /* Return the next available minor for a given @major, at least
> * @spacing after the previous and, and append appropriate letters
> * to @name if it's not NULL. -ve errno on fail (-ENOSPC?). */
> int disk_next_minor(int major, unsigned spacing, char *name);
>
> A trivial optimization would be to remember the last major and max minor
> (resetting that if any disks are removed).
>
> This could clean up other code, too.
Something like idr would be a good fit for this. But yes, adding some
helpers for this might not hurt...
--
Jens Axboe
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] virtio_blk: decrement index when blockdevice is removed
2011-04-06 1:32 ` Rusty Russell
2011-04-06 3:05 ` Jens Axboe
@ 2011-04-06 3:05 ` Jens Axboe
1 sibling, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2011-04-06 3:05 UTC (permalink / raw)
To: Rusty Russell
Cc: john cooper, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, Tejun Heo,
Christoph Hellwig
On 2011-04-06 03:32, Rusty Russell wrote:
> On Tue, 05 Apr 2011 07:08:12 +0200, Jens Axboe <jaxboe@fusionio.com> wrote:
>> On 2011-04-05 06:49, Takuma Umeya wrote:
>>> When virtio block device is removed, index does not get decremented. When
>>> another virtio disk is attached it uses the next device letter to the
>>> one that is suppose to be available.
>>>
>>> Signed-off-by: Takuma Umeya <tumeya@redhat.com>
>>>
>>> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
>>> index 6ecf89c..730e7af 100644
>>> --- a/drivers/block/virtio_blk.c
>>> +++ b/drivers/block/virtio_blk.c
>>> @@ -489,6 +489,7 @@ static void __devexit virtblk_remove(struct virtio_device *vdev)
>>> mempool_destroy(vblk->pool);
>>> vdev->config->del_vqs(vdev);
>>> kfree(vblk);
>>> + index--;
>>> }
>>>
>>> static const struct virtio_device_id id_table[] = {
>>
>> What happens when you delete a device that isn't the last one?
>
> Obviously we should do something cleverer for assigning drives.
>
> It might be a cute if genhd gave us a function to get the next free
> index for a given major number, and format it for us, like so:
>
> /* Return the next available minor for a given @major, at least
> * @spacing after the previous and, and append appropriate letters
> * to @name if it's not NULL. -ve errno on fail (-ENOSPC?). */
> int disk_next_minor(int major, unsigned spacing, char *name);
>
> A trivial optimization would be to remember the last major and max minor
> (resetting that if any disks are removed).
>
> This could clean up other code, too.
Something like idr would be a good fit for this. But yes, adding some
helpers for this might not hurt...
--
Jens Axboe
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] virtio_blk: decrement index when blockdevice is removed
2011-04-05 5:08 ` Jens Axboe
2011-04-06 1:32 ` Rusty Russell
@ 2011-04-06 1:32 ` Rusty Russell
1 sibling, 0 replies; 10+ messages in thread
From: Rusty Russell @ 2011-04-06 1:32 UTC (permalink / raw)
To: Jens Axboe, Takuma Umeya
Cc: john cooper, Tejun Heo, Christoph Hellwig,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org
On Tue, 05 Apr 2011 07:08:12 +0200, Jens Axboe <jaxboe@fusionio.com> wrote:
> On 2011-04-05 06:49, Takuma Umeya wrote:
> > When virtio block device is removed, index does not get decremented. When
> > another virtio disk is attached it uses the next device letter to the
> > one that is suppose to be available.
> >
> > Signed-off-by: Takuma Umeya <tumeya@redhat.com>
> >
> > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> > index 6ecf89c..730e7af 100644
> > --- a/drivers/block/virtio_blk.c
> > +++ b/drivers/block/virtio_blk.c
> > @@ -489,6 +489,7 @@ static void __devexit virtblk_remove(struct virtio_device *vdev)
> > mempool_destroy(vblk->pool);
> > vdev->config->del_vqs(vdev);
> > kfree(vblk);
> > + index--;
> > }
> >
> > static const struct virtio_device_id id_table[] = {
>
> What happens when you delete a device that isn't the last one?
Obviously we should do something cleverer for assigning drives.
It might be a cute if genhd gave us a function to get the next free
index for a given major number, and format it for us, like so:
/* Return the next available minor for a given @major, at least
* @spacing after the previous and, and append appropriate letters
* to @name if it's not NULL. -ve errno on fail (-ENOSPC?). */
int disk_next_minor(int major, unsigned spacing, char *name);
A trivial optimization would be to remember the last major and max minor
(resetting that if any disks are removed).
This could clean up other code, too.
Cheers,
Rusty.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] virtio_blk: decrement index when blockdevice is removed
2011-04-05 4:49 ` [PATCH] virtio_blk: decrement index when blockdevice is removed Takuma Umeya
2011-04-05 5:08 ` Jens Axboe
2011-04-05 5:08 ` Jens Axboe
@ 2011-04-06 19:17 ` Ryan Harper
2011-04-06 19:17 ` Ryan Harper
3 siblings, 0 replies; 10+ messages in thread
From: Ryan Harper @ 2011-04-06 19:17 UTC (permalink / raw)
To: Takuma Umeya
Cc: john cooper, Jens Axboe, linux-kernel, virtualization, Tejun Heo,
Christoph Hellwig
* Takuma Umeya <tumeya@redhat.com> [2011-04-05 00:00]:
> When virtio block device is removed, index does not get decremented. When
> another virtio disk is attached it uses the next device letter to the
> one that is suppose to be available.
>
> Signed-off-by: Takuma Umeya <tumeya@redhat.com>
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 6ecf89c..730e7af 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -489,6 +489,7 @@ static void __devexit virtblk_remove(struct virtio_device *vdev)
> mempool_destroy(vblk->pool);
> vdev->config->del_vqs(vdev);
> kfree(vblk);
> + index--;
> }
What about referencing /dev/disk/by-id and using drive serial numbers?
How much do we care about re-using minor numbers? IIRC, virtio-blk can
go out to vdxxx; that's a lot of disks or add/removes.
>
> static const struct virtio_device_id id_table[] = {
>
> --
> Umeya, Takuma
> Technical Account Manager
> Red Hat GSS APAC
> +81.3.5798.8584 (direct)
> tumeya@redhat.com
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/virtualization
--
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
ryanh@us.ibm.com
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] virtio_blk: decrement index when blockdevice is removed
2011-04-05 4:49 ` [PATCH] virtio_blk: decrement index when blockdevice is removed Takuma Umeya
` (2 preceding siblings ...)
2011-04-06 19:17 ` Ryan Harper
@ 2011-04-06 19:17 ` Ryan Harper
3 siblings, 0 replies; 10+ messages in thread
From: Ryan Harper @ 2011-04-06 19:17 UTC (permalink / raw)
To: Takuma Umeya
Cc: virtualization, john cooper, Jens Axboe, linux-kernel, Tejun Heo,
Christoph Hellwig
* Takuma Umeya <tumeya@redhat.com> [2011-04-05 00:00]:
> When virtio block device is removed, index does not get decremented. When
> another virtio disk is attached it uses the next device letter to the
> one that is suppose to be available.
>
> Signed-off-by: Takuma Umeya <tumeya@redhat.com>
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 6ecf89c..730e7af 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -489,6 +489,7 @@ static void __devexit virtblk_remove(struct virtio_device *vdev)
> mempool_destroy(vblk->pool);
> vdev->config->del_vqs(vdev);
> kfree(vblk);
> + index--;
> }
What about referencing /dev/disk/by-id and using drive serial numbers?
How much do we care about re-using minor numbers? IIRC, virtio-blk can
go out to vdxxx; that's a lot of disks or add/removes.
>
> static const struct virtio_device_id id_table[] = {
>
> --
> Umeya, Takuma
> Technical Account Manager
> Red Hat GSS APAC
> +81.3.5798.8584 (direct)
> tumeya@redhat.com
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/virtualization
--
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
ryanh@us.ibm.com
^ permalink raw reply [flat|nested] 10+ messages in thread