search for: index_to_minor

Displaying 20 results from an estimated 33 matches for "index_to_minor".

2011 Jun 01
6
[PATCH 1/1] [virt] virtio-blk: Use ida to allocate disk index
...eqs; @@ -343,12 +348,26 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) struct request_queue *q; int err; u64 cap; - u32 v, blk_size, sg_elems, opt_io_size; + u32 v, blk_size, sg_elems, opt_io_size, index; u16 min_io_size; u8 physical_block_exp, alignment_offset; - if (index_to_minor(index) >= 1 << MINORBITS) - return -ENOSPC; + do { + if (!ida_pre_get(&vd_index_ida, GFP_KERNEL)) + return err; + + spin_lock(&vd_index_lock); + err = ida_get_new(&vd_index_ida, &index); + spin_unlock(&vd_index_lock); + } while (err == -EAGAIN); + + if (err) + r...
2011 Jun 01
6
[PATCH 1/1] [virt] virtio-blk: Use ida to allocate disk index
...eqs; @@ -343,12 +348,26 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) struct request_queue *q; int err; u64 cap; - u32 v, blk_size, sg_elems, opt_io_size; + u32 v, blk_size, sg_elems, opt_io_size, index; u16 min_io_size; u8 physical_block_exp, alignment_offset; - if (index_to_minor(index) >= 1 << MINORBITS) - return -ENOSPC; + do { + if (!ida_pre_get(&vd_index_ida, GFP_KERNEL)) + return err; + + spin_lock(&vd_index_lock); + err = ida_get_new(&vd_index_ida, &index); + spin_unlock(&vd_index_lock); + } while (err == -EAGAIN); + + if (err) + r...
2012 Apr 10
3
[PATCH] virtio_blk: Add help function to format mass of disks
...index % 26; - sprintf(vblk->disk->disk_name, "vd%c%c%c", - 'a' + m1, 'a' + m2, 'a' + m3); - } + virtblk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN); vblk->disk->major = major; vblk->disk->first_minor = index_to_minor(index); -- 1.7.1
2012 Apr 10
3
[PATCH] virtio_blk: Add help function to format mass of disks
...index % 26; - sprintf(vblk->disk->disk_name, "vd%c%c%c", - 'a' + m1, 'a' + m2, 'a' + m3); - } + virtblk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN); vblk->disk->major = major; vblk->disk->first_minor = index_to_minor(index); -- 1.7.1
2010 Jun 18
4
[PATCH 1/2] Add 'serial' attribute to virtio-blk devices
...rtio_blk.c | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 258bc2a..f1ef26f 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -281,6 +281,31 @@ static int index_to_minor(int index) return index << PART_BITS; } +/* Copy serial number from *s to *d. Copy operation terminates on either + * encountering a nul in *s or after n bytes have been copied, whichever + * occurs first. *d is not forcibly nul terminated. Return # of bytes copied. + */ +static inlin...
2010 Jun 18
4
[PATCH 1/2] Add 'serial' attribute to virtio-blk devices
...rtio_blk.c | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 258bc2a..f1ef26f 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -281,6 +281,31 @@ static int index_to_minor(int index) return index << PART_BITS; } +/* Copy serial number from *s to *d. Copy operation terminates on either + * encountering a nul in *s or after n bytes have been copied, whichever + * occurs first. *d is not forcibly nul terminated. Return # of bytes copied. + */ +static inlin...
2011 Oct 30
2
[PATCHv4] virtio-blk: use ida to allocate disk index
...ruct virtio_blk /* What host tells us, plus 2 for header & tailer. */ unsigned int sg_elems; + /* Ida index - used to track minor number allocations. */ + int index; + /* Scatterlist: can be too big for stack. */ struct scatterlist sg[/*sg_elems*/]; }; @@ -276,6 +282,11 @@ static int index_to_minor(int index) return index << PART_BITS; } +static int minor_to_index(int minor) +{ + return minor >> PART_BITS; +} + static ssize_t virtblk_serial_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -341,14 +352,17 @@ static int __devinit virtblk_probe(stru...
2011 Oct 30
2
[PATCHv4] virtio-blk: use ida to allocate disk index
...ruct virtio_blk /* What host tells us, plus 2 for header & tailer. */ unsigned int sg_elems; + /* Ida index - used to track minor number allocations. */ + int index; + /* Scatterlist: can be too big for stack. */ struct scatterlist sg[/*sg_elems*/]; }; @@ -276,6 +282,11 @@ static int index_to_minor(int index) return index << PART_BITS; } +static int minor_to_index(int minor) +{ + return minor >> PART_BITS; +} + static ssize_t virtblk_serial_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -341,14 +352,17 @@ static int __devinit virtblk_probe(stru...
2012 May 03
2
[PATCH 1/2] virtio-blk: Fix hot-unplug race in remove method
...M; goto out_free_vq; @@ -466,6 +471,7 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) virtblk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN); + vblk->req_in_flight = 0; vblk->disk->major = major; vblk->disk->first_minor = index_to_minor(index); vblk->disk->private_data = vblk; @@ -576,22 +582,34 @@ static void __devexit virtblk_remove(struct virtio_device *vdev) { struct virtio_blk *vblk = vdev->priv; int index = vblk->index; + unsigned long flags; + int req_in_flight; /* Prevent config work handler from acc...
2012 May 03
2
[PATCH 1/2] virtio-blk: Fix hot-unplug race in remove method
...M; goto out_free_vq; @@ -466,6 +471,7 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) virtblk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN); + vblk->req_in_flight = 0; vblk->disk->major = major; vblk->disk->first_minor = index_to_minor(index); vblk->disk->private_data = vblk; @@ -576,22 +582,34 @@ static void __devexit virtblk_remove(struct virtio_device *vdev) { struct virtio_blk *vblk = vdev->priv; int index = vblk->index; + unsigned long flags; + int req_in_flight; /* Prevent config work handler from acc...
2014 Mar 14
4
[PATCH] virtio-blk: Initialize blkqueue depth from virtqueue size
virtio-blk set the default queue depth to 64 requests, which was insufficient for high-IOPS devices. Instead set the blk-queue depth to the device's virtqueue depth divided by two (each I/O requires at least two VQ entries). Signed-off-by: Venkatesh Srinivas <venkateshs at google.com> --- drivers/block/virtio_blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git
2014 Mar 14
4
[PATCH] virtio-blk: Initialize blkqueue depth from virtqueue size
virtio-blk set the default queue depth to 64 requests, which was insufficient for high-IOPS devices. Instead set the blk-queue depth to the device's virtqueue depth divided by two (each I/O requires at least two VQ entries). Signed-off-by: Venkatesh Srinivas <venkateshs at google.com> --- drivers/block/virtio_blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git
2012 Apr 11
0
[PATCH v2] virtio_blk: Add help function to format mass of disks
...index % 26; - sprintf(vblk->disk->disk_name, "vd%c%c%c", - 'a' + m1, 'a' + m2, 'a' + m3); - } + virtblk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN); vblk->disk->major = major; vblk->disk->first_minor = index_to_minor(index); -- 1.7.1
2008 May 27
1
[PATCH/RFC] virtio_blk: check for hardsector size from host
...) Index: kvm/drivers/block/virtio_blk.c =================================================================== --- kvm.orig/drivers/block/virtio_blk.c +++ kvm/drivers/block/virtio_blk.c @@ -196,6 +196,7 @@ static int virtblk_probe(struct virtio_d int err; u64 cap; u32 v; + u64 blk_size; if (index_to_minor(index) >= 1 << MINORBITS) return -ENOSPC; @@ -290,6 +291,13 @@ static int virtblk_probe(struct virtio_d if (!err) blk_queue_max_hw_segments(vblk->disk->queue, v); + /* Host can optionally specify the block size of the device */ + err = virtio_config_val(vdev, VIRTIO_BLK_F_B...
2012 Apr 11
0
[PATCH v2] virtio_blk: Add help function to format mass of disks
...index % 26; - sprintf(vblk->disk->disk_name, "vd%c%c%c", - 'a' + m1, 'a' + m2, 'a' + m3); - } + virtblk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN); vblk->disk->major = major; vblk->disk->first_minor = index_to_minor(index); -- 1.7.1
2014 Mar 15
0
[PATCH] virtio-blk: make the queue depth the max supportable by the hypervisor
...p;virtio_mq_reg, vblk); if (!q) { @@ -565,8 +573,6 @@ static int virtblk_probe(struct virtio_device *vdev) q->queuedata = vblk; - virtblk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN); - vblk->disk->major = major; vblk->disk->first_minor = index_to_minor(index); vblk->disk->private_data = vblk; -- 1.9.0
2008 May 27
1
[PATCH/RFC] virtio_blk: check for hardsector size from host
...) Index: kvm/drivers/block/virtio_blk.c =================================================================== --- kvm.orig/drivers/block/virtio_blk.c +++ kvm/drivers/block/virtio_blk.c @@ -196,6 +196,7 @@ static int virtblk_probe(struct virtio_d int err; u64 cap; u32 v; + u64 blk_size; if (index_to_minor(index) >= 1 << MINORBITS) return -ENOSPC; @@ -290,6 +291,13 @@ static int virtblk_probe(struct virtio_d if (!err) blk_queue_max_hw_segments(vblk->disk->queue, v); + /* Host can optionally specify the block size of the device */ + err = virtio_config_val(vdev, VIRTIO_BLK_F_B...
2014 Mar 15
1
[PATCH] virtio-blk: make the queue depth the max supportable by the hypervisor
...@@ -565,8 +573,6 @@ static int virtblk_probe(struct virtio_device >*vdev) > > q->queuedata = vblk; > >- virtblk_name_format("vd", index, vblk->disk->disk_name, >DISK_NAME_LEN); >- > vblk->disk->major = major; > vblk->disk->first_minor = index_to_minor(index); > vblk->disk->private_data = vblk;
2014 Mar 15
1
[PATCH] virtio-blk: make the queue depth the max supportable by the hypervisor
...@@ -565,8 +573,6 @@ static int virtblk_probe(struct virtio_device >*vdev) > > q->queuedata = vblk; > >- virtblk_name_format("vd", index, vblk->disk->disk_name, >DISK_NAME_LEN); >- > vblk->disk->major = major; > vblk->disk->first_minor = index_to_minor(index); > vblk->disk->private_data = vblk;
2012 Mar 30
10
[PATCH 0/4] block: move sd_format_disk_name() into block core as disk_name_format()
This patch series renames "sd_format_disk_name()" to "disk_name_format()" and moves it into block core. So that who needs formatting disk name can use it, instead of duplicating these similar help functions. Ren Mingxin (4): block: add function disk_name_format() into block core scsi: replace sd_format_disk_name() to disk_name_format() block: replace