search for: minorbits

Displaying 20 results from an estimated 27 matches for "minorbits".

2011 Jun 01
6
[PATCH 1/1] [virt] virtio-blk: Use ida to allocate disk index
..._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) + return err; + + if (index_to_minor(...
2011 Jun 01
6
[PATCH 1/1] [virt] virtio-blk: Use ida to allocate disk index
..._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) + return err; + + if (index_to_minor(...
2011 Oct 30
2
[PATCHv4] virtio-blk: use ida to allocate disk index
...__devinit virtblk_probe(struct virtio_device *vdev) { struct virtio_blk *vblk; struct request_queue *q; - int err; + int err, index; u64 cap; u32 v, blk_size, sg_elems, opt_io_size; u16 min_io_size; u8 physical_block_exp, alignment_offset; - if (index_to_minor(index) >= 1 << MINORBITS) - return -ENOSPC; + err = ida_simple_get(&vd_index_ida, 0, minor_to_index(1 << MINORBITS), + GFP_KERNEL); + if (err < 0) + goto out; + index = err; /* We need to know how many segments before we allocate. */ err = virtio_config_val(vdev, VIRTIO_BLK_F_SEG_MAX, @@ -365,7...
2011 Oct 30
2
[PATCHv4] virtio-blk: use ida to allocate disk index
...__devinit virtblk_probe(struct virtio_device *vdev) { struct virtio_blk *vblk; struct request_queue *q; - int err; + int err, index; u64 cap; u32 v, blk_size, sg_elems, opt_io_size; u16 min_io_size; u8 physical_block_exp, alignment_offset; - if (index_to_minor(index) >= 1 << MINORBITS) - return -ENOSPC; + err = ida_simple_get(&vd_index_ida, 0, minor_to_index(1 << MINORBITS), + GFP_KERNEL); + if (err < 0) + goto out; + index = err; /* We need to know how many segments before we allocate. */ err = virtio_config_val(vdev, VIRTIO_BLK_F_SEG_MAX, @@ -365,7...
2008 May 27
1
[PATCH/RFC] virtio_blk: check for hardsector size from host
...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_BLK_SIZE, + offsetof(struct virt...
2015 Jan 13
0
[PATCH 2/6] virtio/blk: verify device has config space
...ice *vdev) u16 min_io_size; u8 physical_block_exp, alignment_offset; + if (!vdev->config->get) { + dev_err(&vdev->dev, "%s failure: config access disabled\n", + __func__); + return -EINVAL; + } + err = ida_simple_get(&vd_index_ida, 0, minor_to_index(1 << MINORBITS), GFP_KERNEL); if (err < 0) -- MST
2008 May 27
1
[PATCH/RFC] virtio_blk: check for hardsector size from host
...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_BLK_SIZE, + offsetof(struct virt...
2010 Mar 20
2
[PATCH 4/4] btrfs-convert: split into convert/.
...try->e_value_size; - ret = copy_single_xattr(trans, root, objectid, - entry, data, datalen); - if (ret) - goto out; - entry = EXT2_EXT_ATTR_NEXT(entry); - } -out: - if (buffer != NULL) - free(buffer); - if ((void *)ext2_inode != inode_buf) - free(ext2_inode); - return ret; -} -#define MINORBITS 20 -#define MKDEV(ma, mi) (((ma) << MINORBITS) | (mi)) - -static inline dev_t old_decode_dev(u16 val) -{ - return MKDEV((val >> 8) & 255, val & 255); -} - -static inline dev_t new_decode_dev(u32 dev) -{ - unsigned major = (dev & 0xfff00) >> 8; - unsigned minor = (dev &...
2008 Jan 31
4
[PATCH] virtio_blk: Dont waste major numbers
...9;; +static int major, minor; + struct virtio_blk { spinlock_t lock; @@ -173,10 +176,13 @@ static struct block_device_operations vi static int virtblk_probe(struct virtio_device *vdev) { struct virtio_blk *vblk; - int err, major; + int err; u64 cap; u32 v; + if (minor >= 1 << MINORBITS) + return -ENOSPC; + vdev->priv = vblk = kmalloc(sizeof(*vblk), GFP_KERNEL); if (!vblk) { err = -ENOMEM; @@ -200,17 +206,11 @@ static int virtblk_probe(struct virtio_d goto out_free_vq; } - major = register_blkdev(0, "virtblk"); - if (major < 0) { - err = major; - g...
2008 Jan 31
4
[PATCH] virtio_blk: Dont waste major numbers
...9;; +static int major, minor; + struct virtio_blk { spinlock_t lock; @@ -173,10 +176,13 @@ static struct block_device_operations vi static int virtblk_probe(struct virtio_device *vdev) { struct virtio_blk *vblk; - int err, major; + int err; u64 cap; u32 v; + if (minor >= 1 << MINORBITS) + return -ENOSPC; + vdev->priv = vblk = kmalloc(sizeof(*vblk), GFP_KERNEL); if (!vblk) { err = -ENOMEM; @@ -200,17 +206,11 @@ static int virtblk_probe(struct virtio_d goto out_free_vq; } - major = register_blkdev(0, "virtblk"); - if (major < 0) { - err = major; - g...
2015 Jan 13
8
[PATCH 0/6] virtio: graceful failure with get == NULL
virtio 1.0 says device configuration is optional, but most drivers treat it as mandatory. Even if presented by device, guest bios might disable the BAR holding that configuration, so we can't assume it's there, but we also don't want to fail if not in case drivers can cope with it's absence - such as caif or rng. Add code to drivers to check presence of get callback and fail
2015 Jan 13
8
[PATCH 0/6] virtio: graceful failure with get == NULL
virtio 1.0 says device configuration is optional, but most drivers treat it as mandatory. Even if presented by device, guest bios might disable the BAR holding that configuration, so we can't assume it's there, but we also don't want to fail if not in case drivers can cope with it's absence - such as caif or rng. Add code to drivers to check presence of get callback and fail
2009 May 12
0
[PATCHv4] virtio: find_vqs/del_vqs virtio operations
...o_blk.c +++ b/drivers/block/virtio_blk.c @@ -197,6 +197,8 @@ static int virtblk_probe(struct virtio_device *vdev) u64 cap; u32 v; u32 blk_size, sg_elems; + vq_callback_t *callback[] = { blk_done }; + const char *name[] = { "requests" }; if (index_to_minor(index) >= 1 << MINORBITS) return -ENOSPC; @@ -224,11 +226,9 @@ static int virtblk_probe(struct virtio_device *vdev) sg_init_table(vblk->sg, vblk->sg_elems); /* We expect one virtqueue, for output. */ - vblk->vq = vdev->config->find_vq(vdev, 0, blk_done, "requests"); - if (IS_ERR(vblk->v...
2009 May 12
0
[PATCHv4] virtio: find_vqs/del_vqs virtio operations
...o_blk.c +++ b/drivers/block/virtio_blk.c @@ -197,6 +197,8 @@ static int virtblk_probe(struct virtio_device *vdev) u64 cap; u32 v; u32 blk_size, sg_elems; + vq_callback_t *callback[] = { blk_done }; + const char *name[] = { "requests" }; if (index_to_minor(index) >= 1 << MINORBITS) return -ENOSPC; @@ -224,11 +226,9 @@ static int virtblk_probe(struct virtio_device *vdev) sg_init_table(vblk->sg, vblk->sg_elems); /* We expect one virtqueue, for output. */ - vblk->vq = vdev->config->find_vq(vdev, 0, blk_done, "requests"); - if (IS_ERR(vblk->v...
2009 May 07
6
[PATCH 1/3] virtio: find_vqs/del_vqs virtio operations
...64..7b7435d 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -197,6 +197,7 @@ static int virtblk_probe(struct virtio_device *vdev) u64 cap; u32 v; u32 blk_size, sg_elems; + virtqueue_callback *callback[] = { blk_done }; if (index_to_minor(index) >= 1 << MINORBITS) return -ENOSPC; @@ -224,11 +225,9 @@ static int virtblk_probe(struct virtio_device *vdev) sg_init_table(vblk->sg, vblk->sg_elems); /* We expect one virtqueue, for output. */ - vblk->vq = vdev->config->find_vq(vdev, 0, blk_done); - if (IS_ERR(vblk->vq)) { - err = PTR_ERR...
2009 May 07
6
[PATCH 1/3] virtio: find_vqs/del_vqs virtio operations
...64..7b7435d 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -197,6 +197,7 @@ static int virtblk_probe(struct virtio_device *vdev) u64 cap; u32 v; u32 blk_size, sg_elems; + virtqueue_callback *callback[] = { blk_done }; if (index_to_minor(index) >= 1 << MINORBITS) return -ENOSPC; @@ -224,11 +225,9 @@ static int virtblk_probe(struct virtio_device *vdev) sg_init_table(vblk->sg, vblk->sg_elems); /* We expect one virtqueue, for output. */ - vblk->vq = vdev->config->find_vq(vdev, 0, blk_done); - if (IS_ERR(vblk->vq)) { - err = PTR_ERR...
2016 Aug 17
0
[PATCH 15/15] block: Add FIXME comment to handle device_add_disk error
...mp;brd_devices); } @@ -617,6 +618,7 @@ static int __init brd_init(void) /* point of no return */ list_for_each_entry(brd, &brd_devices, brd_list) + /* FIXME: handle error. */ device_add_disk(NULL, brd->brd_disk, NULL); blk_register_region(MKDEV(RAMDISK_MAJOR, 0), 1UL << MINORBITS, diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index bef9f7f..45eac78 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -1972,6 +1972,7 @@ static int cciss_add_disk(ctlr_info_t *h, struct gendisk *disk, /* allows the interrupt handler to start the queue */ wmb();...
2008 Dec 29
0
[PULL] virtio and lguest tree
...ems); /* If this request fails, stop queue and wait for something to finish to restart it. */ @@ -196,12 +196,22 @@ static int virtblk_probe(struct virtio_device *vdev) int err; u64 cap; u32 v; - u32 blk_size; + u32 blk_size, sg_elems; if (index_to_minor(index) >= 1 << MINORBITS) return -ENOSPC; - vdev->priv = vblk = kmalloc(sizeof(*vblk), GFP_KERNEL); + /* We need to know how many segments before we allocate. */ + err = virtio_config_val(vdev, VIRTIO_BLK_F_SEG_MAX, + offsetof(struct virtio_blk_config, seg_max), + &sg_elems); + if (err) + sg_elems = 1; +...
2008 Dec 29
0
[PULL] virtio and lguest tree
...ems); /* If this request fails, stop queue and wait for something to finish to restart it. */ @@ -196,12 +196,22 @@ static int virtblk_probe(struct virtio_device *vdev) int err; u64 cap; u32 v; - u32 blk_size; + u32 blk_size, sg_elems; if (index_to_minor(index) >= 1 << MINORBITS) return -ENOSPC; - vdev->priv = vblk = kmalloc(sizeof(*vblk), GFP_KERNEL); + /* We need to know how many segments before we allocate. */ + err = virtio_config_val(vdev, VIRTIO_BLK_F_SEG_MAX, + offsetof(struct virtio_blk_config, seg_max), + &sg_elems); + if (err) + sg_elems = 1; +...
2016 Aug 17
20
[PATCH 00/15] Fix issue with KOBJ_ADD uevent versus disk attributes
This is an attempt to fix the issue that some disks' sysfs attributes are not ready at the time its KOBJ_ADD event is sent. The symptom is during device hotplug, udev may fail to find certain attributes, such as serial or wwn, of the disk. As a result the /dev/disk/by-id entries are not created. The cause is device_add_disk emits the uevent before returning, and the callers have to create