search for: virtio_blk_id_bytes

Displaying 20 results from an estimated 31 matches for "virtio_blk_id_bytes".

2009 Sep 29
0
[PATCH 3/4] virtio_blk: implement a request-based ID command, VIRTIO_BLK_T_GET_ID
...T_ID; + vbr->out_hdr.sector = 0; + vbr->out_hdr.ioprio = req_get_ioprio(vbr->req); + break; case REQ_TYPE_LINUX_BLOCK: if (req->cmd[0] == REQ_LB_OP_FLUSH) { vbr->out_hdr.type = VIRTIO_BLK_T_FLUSH; @@ -201,29 +208,59 @@ struct virtio_blk_config_deprecated { __u8 identify[VIRTIO_BLK_ID_BYTES]; } __attribute__((packed)); -static int virtblk_identify(struct gendisk *disk, void *argp) +static int virtblk_identify_deprecated(struct virtio_blk *vblk, void *opaque) +{ + return virtio_config_buf(vblk->vdev, VIRTIO_BLK_F_IDENTIFY, + offsetof(struct virtio_blk_config_deprecated, identify...
2009 Sep 29
0
[PATCH 3/4] virtio_blk: implement a request-based ID command, VIRTIO_BLK_T_GET_ID
...T_ID; + vbr->out_hdr.sector = 0; + vbr->out_hdr.ioprio = req_get_ioprio(vbr->req); + break; case REQ_TYPE_LINUX_BLOCK: if (req->cmd[0] == REQ_LB_OP_FLUSH) { vbr->out_hdr.type = VIRTIO_BLK_T_FLUSH; @@ -201,29 +208,59 @@ struct virtio_blk_config_deprecated { __u8 identify[VIRTIO_BLK_ID_BYTES]; } __attribute__((packed)); -static int virtblk_identify(struct gendisk *disk, void *argp) +static int virtblk_identify_deprecated(struct virtio_blk *vblk, void *opaque) +{ + return virtio_config_buf(vblk->vdev, VIRTIO_BLK_F_IDENTIFY, + offsetof(struct virtio_blk_config_deprecated, identify...
2010 Jun 18
4
[PATCH 1/2] Add 'serial' attribute to virtio-blk devices
...inline int serial_sysfs(char *d, char *s, int n) +{ + char *di = d; + + while (*s && n--) + *d++ = *s++; + return d - di; +} + +static ssize_t virtblk_serial_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct gendisk *disk = dev_to_disk(dev); + char id_str[VIRTIO_BLK_ID_BYTES]; + + if (IS_ERR(virtblk_get_id(disk, id_str))) + return 0; + return serial_sysfs(buf, id_str, min(VIRTIO_BLK_ID_BYTES, PAGE_SIZE)); +} +DEVICE_ATTR(serial, S_IRUGO, virtblk_serial_show, NULL); + static int __devinit virtblk_probe(struct virtio_device *vdev) { struct virtio_blk *vblk; @@ -445,...
2010 Jun 18
4
[PATCH 1/2] Add 'serial' attribute to virtio-blk devices
...inline int serial_sysfs(char *d, char *s, int n) +{ + char *di = d; + + while (*s && n--) + *d++ = *s++; + return d - di; +} + +static ssize_t virtblk_serial_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct gendisk *disk = dev_to_disk(dev); + char id_str[VIRTIO_BLK_ID_BYTES]; + + if (IS_ERR(virtblk_get_id(disk, id_str))) + return 0; + return serial_sysfs(buf, id_str, min(VIRTIO_BLK_ID_BYTES, PAGE_SIZE)); +} +DEVICE_ATTR(serial, S_IRUGO, virtblk_serial_show, NULL); + static int __devinit virtblk_probe(struct virtio_device *vdev) { struct virtio_blk *vblk; @@ -445,...
2009 Sep 29
1
[PATCH 1/4] virtio_blk: deprecate the 1024-byte ID field.
..._F_SIZE_MAX) */ + __u32 size_max; + /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ + __u32 seg_max; + /* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */ + struct virtio_blk_geometry geometry; + /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ + __u32 blk_size; + __u8 identify[VIRTIO_BLK_ID_BYTES]; +} __attribute__((packed)); + static int virtblk_identify(struct gendisk *disk, void *argp) { struct virtio_blk *vblk = disk->private_data; @@ -196,7 +212,7 @@ static int virtblk_identify(struct gendi goto out; err = virtio_config_buf(vblk->vdev, VIRTIO_BLK_F_IDENTIFY, - offseto...
2009 Sep 29
1
[PATCH 1/4] virtio_blk: deprecate the 1024-byte ID field.
..._F_SIZE_MAX) */ + __u32 size_max; + /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ + __u32 seg_max; + /* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */ + struct virtio_blk_geometry geometry; + /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ + __u32 blk_size; + __u8 identify[VIRTIO_BLK_ID_BYTES]; +} __attribute__((packed)); + static int virtblk_identify(struct gendisk *disk, void *argp) { struct virtio_blk *vblk = disk->private_data; @@ -196,7 +212,7 @@ static int virtblk_identify(struct gendi goto out; err = virtio_config_buf(vblk->vdev, VIRTIO_BLK_F_IDENTIFY, - offseto...
2010 Jun 24
3
[PATCH 0/2] v2: Add 'serial' attribute to virtio-blk devices
Using Rusty's suggestion I've respun the patch removing the special copy function. I've tested this patch in a guest kernel with and without qemu supplying serial numbers for the block devices and it's working as expected. When qemu supplies serial numbers, the correct value is supplied to /sys/block/vdX/serial and can be used by udev for generating disk/by-id paths (without
2010 Jun 24
3
[PATCH 0/2] v2: Add 'serial' attribute to virtio-blk devices
Using Rusty's suggestion I've respun the patch removing the special copy function. I've tested this patch in a guest kernel with and without qemu supplying serial numbers for the block devices and it's working as expected. When qemu supplies serial numbers, the correct value is supplied to /sys/block/vdX/serial and can be used by udev for generating disk/by-id paths (without
2016 Oct 03
1
[PATCH 4/4] virtio_blk: Rename a jump label in virtblk_get_id()
...k/virtio_blk.c b/drivers/block/virtio_blk.c > index 696f452..fef2bd0 100644 > --- a/drivers/block/virtio_blk.c > +++ b/drivers/block/virtio_blk.c > @@ -247,10 +247,10 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) > > err = blk_rq_map_kern(q, req, id_str, VIRTIO_BLK_ID_BYTES, GFP_KERNEL); > if (err) > - goto out; > + goto put_request; > > err = blk_execute_rq(vblk->disk->queue, vblk->disk, req, false); > -out: > + put_request: I checked Documentation/CodingStyle and see no reason to rename the l...
2016 Oct 03
1
[PATCH 4/4] virtio_blk: Rename a jump label in virtblk_get_id()
...k/virtio_blk.c b/drivers/block/virtio_blk.c > index 696f452..fef2bd0 100644 > --- a/drivers/block/virtio_blk.c > +++ b/drivers/block/virtio_blk.c > @@ -247,10 +247,10 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) > > err = blk_rq_map_kern(q, req, id_str, VIRTIO_BLK_ID_BYTES, GFP_KERNEL); > if (err) > - goto out; > + goto put_request; > > err = blk_execute_rq(vblk->disk->queue, vblk->disk, req, false); > -out: > + put_request: I checked Documentation/CodingStyle and see no reason to rename the l...
2012 Oct 15
2
[PATCH 1/1] vhost-blk: Add vhost-blk support v4
...t = vhost_blk_req_submit(req, file); + break; + case VIRTIO_BLK_T_IN: + req->write = READ; + ret = vhost_blk_req_submit(req, file); + break; + case VIRTIO_BLK_T_FLUSH: + req->write = WRITE_FLUSH; + ret = vhost_blk_req_submit(req, file); + break; + case VIRTIO_BLK_T_GET_ID: { + char id[VIRTIO_BLK_ID_BYTES]; + int len; + + ret = snprintf(id, VIRTIO_BLK_ID_BYTES, + "vhost-blk%d", blk->index); + if (ret < 0) + break; + len = ret; + ret = __copy_to_user(req->iov[0].iov_base, id, len); + status = ret < 0 ? VIRTIO_BLK_S_IOERR : VIRTIO_BLK_S_OK; + ret = vhost_blk_set...
2012 Oct 15
2
[PATCH 1/1] vhost-blk: Add vhost-blk support v4
...t = vhost_blk_req_submit(req, file); + break; + case VIRTIO_BLK_T_IN: + req->write = READ; + ret = vhost_blk_req_submit(req, file); + break; + case VIRTIO_BLK_T_FLUSH: + req->write = WRITE_FLUSH; + ret = vhost_blk_req_submit(req, file); + break; + case VIRTIO_BLK_T_GET_ID: { + char id[VIRTIO_BLK_ID_BYTES]; + int len; + + ret = snprintf(id, VIRTIO_BLK_ID_BYTES, + "vhost-blk%d", blk->index); + if (ret < 0) + break; + len = ret; + ret = __copy_to_user(req->iov[0].iov_base, id, len); + status = ret < 0 ? VIRTIO_BLK_S_IOERR : VIRTIO_BLK_S_OK; + ret = vhost_blk_set...
2016 Oct 09
1
[PATCH 4/4] virtio_blk: Rename a jump label in virtblk_get_id()
...block/virtio_blk.c b/drivers/block/virtio_blk.c > index 696f452..fef2bd0 100644 > --- a/drivers/block/virtio_blk.c > +++ b/drivers/block/virtio_blk.c > @@ -247,10 +247,10 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) > > err = blk_rq_map_kern(q, req, id_str, VIRTIO_BLK_ID_BYTES, GFP_KERNEL); > if (err) > - goto out; > + goto put_request; > > err = blk_execute_rq(vblk->disk->queue, vblk->disk, req, false); > -out: > + put_request: > blk_put_request(req); > return err; > } > -- > 2.10.0
2016 Oct 09
1
[PATCH 4/4] virtio_blk: Rename a jump label in virtblk_get_id()
...block/virtio_blk.c b/drivers/block/virtio_blk.c > index 696f452..fef2bd0 100644 > --- a/drivers/block/virtio_blk.c > +++ b/drivers/block/virtio_blk.c > @@ -247,10 +247,10 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) > > err = blk_rq_map_kern(q, req, id_str, VIRTIO_BLK_ID_BYTES, GFP_KERNEL); > if (err) > - goto out; > + goto put_request; > > err = blk_execute_rq(vblk->disk->queue, vblk->disk, req, false); > -out: > + put_request: > blk_put_request(req); > return err; > } > -- > 2.10.0
2023 Apr 07
2
[PATCH 0/2] vdpa_sim_blk: support shared backend
This series is mainly for testing live migration between 2 vdpa_sim_blk devices. The first patch is preparation and moves the buffer allocation into devices, the second patch adds the `shared_buffer_mutex` parameter to vdpa_sim_blk to use the same ramdisk for all devices. Tested with QEMU v8.0.0-rc2 in this way: modprobe vhost_vdpa modprobe vdpa_sim_blk shared_backend=true vdpa dev add mgmtdev
2012 Nov 19
1
[PATCH] vhost-blk: Add vhost-blk support v5
...; + + *file = f; +} + +/* Handle guest request */ +static int vhost_blk_req_handle(struct vhost_virtqueue *vq, + struct virtio_blk_outhdr *hdr, + u16 head, u16 out, u16 in, + struct file *file) +{ + struct vhost_blk *blk = container_of(vq->dev, struct vhost_blk, dev); + unsigned char id[VIRTIO_BLK_ID_BYTES]; + struct vhost_blk_req *req; + int ret, len; + u8 status; + + req = &blk->reqs[head]; + req->head = head; + req->blk = blk; + req->sector = hdr->sector; + req->iov = blk->iov; + + req->len = iov_length(vq->iov, out + in) - sizeof(status); + req->iov_nr = move_io...
2012 Nov 19
1
[PATCH] vhost-blk: Add vhost-blk support v5
...; + + *file = f; +} + +/* Handle guest request */ +static int vhost_blk_req_handle(struct vhost_virtqueue *vq, + struct virtio_blk_outhdr *hdr, + u16 head, u16 out, u16 in, + struct file *file) +{ + struct vhost_blk *blk = container_of(vq->dev, struct vhost_blk, dev); + unsigned char id[VIRTIO_BLK_ID_BYTES]; + struct vhost_blk_req *req; + int ret, len; + u8 status; + + req = &blk->reqs[head]; + req->head = head; + req->blk = blk; + req->sector = hdr->sector; + req->iov = blk->iov; + + req->len = iov_length(vq->iov, out + in) - sizeof(status); + req->iov_nr = move_io...
2011 Aug 16
1
[PATCH] virtio-blk: Add stats VQ to collect information about devices
...39,6 +39,7 @@ #define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ #define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */ #define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */ +#define VIRTIO_BLK_F_STATS_VQ 11 /* Optional stats vq is available */ #define VIRTIO_BLK_ID_BYTES 20 /* ID string length */ @@ -119,4 +120,23 @@ struct virtio_scsi_inhdr { #define VIRTIO_BLK_S_OK 0 #define VIRTIO_BLK_S_IOERR 1 #define VIRTIO_BLK_S_UNSUPP 2 + +#define VIRTIO_BLK_S_READ_IO 0 +#define VIRTIO_BLK_S_READ_MERGES 1 +#define VIRTIO_BLK_S_READ_SECTORS 2 +#define VIRTIO_BLK_S_READ...
2011 Aug 16
1
[PATCH] virtio-blk: Add stats VQ to collect information about devices
...39,6 +39,7 @@ #define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ #define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */ #define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */ +#define VIRTIO_BLK_F_STATS_VQ 11 /* Optional stats vq is available */ #define VIRTIO_BLK_ID_BYTES 20 /* ID string length */ @@ -119,4 +120,23 @@ struct virtio_scsi_inhdr { #define VIRTIO_BLK_S_OK 0 #define VIRTIO_BLK_S_IOERR 1 #define VIRTIO_BLK_S_UNSUPP 2 + +#define VIRTIO_BLK_S_READ_IO 0 +#define VIRTIO_BLK_S_READ_MERGES 1 +#define VIRTIO_BLK_S_READ_SECTORS 2 +#define VIRTIO_BLK_S_READ...
2012 Jul 04
1
[PATCH] virtio-blk: allow toggling host cache between writeback and writethrough
...F_FLUSH 9 /* Cache flush command support */ > +#define VIRTIO_BLK_F_WCE 9 /* Writeback mode enabled after reset */ > #define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */ > +#define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in config */ > > #define VIRTIO_BLK_ID_BYTES 20 /* ID string length */ > > @@ -69,6 +70,8 @@ struct virtio_blk_config { > /* optimal sustained I/O size in logical blocks. */ > __u32 opt_io_size; > > + /* writeback mode (if VIRTIO_BLK_F_CONFIG_WCE) */ > + __u8 wce; > } __attribute__((packed)); &gt...