Displaying 20 results from an estimated 31 matches for "queue_logical_block_size".
2017 Jul 26
2
[PATCH] virtio_blk: fix incorrect message when disk is resized
...[10];
char *envp[] = { "RESIZE=1", NULL };
+ unsigned long long nblocks;
u64 capacity;
/* Host must always specify the capacity. */
@@ -393,16 +394,19 @@ static void virtblk_config_changed_work(struct work_struct *work)
capacity = (sector_t)-1;
}
- string_get_size(capacity, queue_logical_block_size(q),
+ nblocks = DIV_ROUND_UP_ULL(capacity, queue_logical_block_size(q) >> 9);
+
+ string_get_size(nblocks, queue_logical_block_size(q),
STRING_UNITS_2, cap_str_2, sizeof(cap_str_2));
- string_get_size(capacity, queue_logical_block_size(q),
+ string_get_size(nblocks, queue_logical_block_si...
2017 Jul 26
2
[PATCH] virtio_blk: fix incorrect message when disk is resized
...[10];
char *envp[] = { "RESIZE=1", NULL };
+ unsigned long long nblocks;
u64 capacity;
/* Host must always specify the capacity. */
@@ -393,16 +394,19 @@ static void virtblk_config_changed_work(struct work_struct *work)
capacity = (sector_t)-1;
}
- string_get_size(capacity, queue_logical_block_size(q),
+ nblocks = DIV_ROUND_UP_ULL(capacity, queue_logical_block_size(q) >> 9);
+
+ string_get_size(nblocks, queue_logical_block_size(q),
STRING_UNITS_2, cap_str_2, sizeof(cap_str_2));
- string_get_size(capacity, queue_logical_block_size(q),
+ string_get_size(nblocks, queue_logical_block_si...
2017 Aug 04
0
[PATCH] virtio_blk: fix incorrect message when disk is resized
..., NULL };
> + unsigned long long nblocks;
> u64 capacity;
>
> /* Host must always specify the capacity. */
> @@ -393,16 +394,19 @@ static void virtblk_config_changed_work(struct work_struct *work)
> capacity = (sector_t)-1;
> }
>
> - string_get_size(capacity, queue_logical_block_size(q),
> + nblocks = DIV_ROUND_UP_ULL(capacity, queue_logical_block_size(q) >> 9);
> +
> + string_get_size(nblocks, queue_logical_block_size(q),
> STRING_UNITS_2, cap_str_2, sizeof(cap_str_2));
> - string_get_size(capacity, queue_logical_block_size(q),
> + string_get_size(n...
2020 Jul 15
2
[PATCH] virtio-blk: check host supplied logical block size
...virtblk_valid_block_size(blk_size)) {
> > + dev_err(&vdev->dev,
> > + "%s failure: unsupported logical block
> > size %d\n",
> > + __func__, blk_size);
> > + err = -EINVAL;
> > + goto out_cleanup_queue;
> > + }
> > blk_queue_logical_block_size(q, blk_size);
> > - else
> > + } else
> > blk_size = queue_logical_block_size(q);
> >
> > /* Use topology information if available */
>
> OK so if we are doing this pls add {} around blk_size =
> queue_logical_block_size(q);
> too.
Will do.
>...
2020 Jul 15
2
[PATCH] virtio-blk: check host supplied logical block size
...virtblk_valid_block_size(blk_size)) {
> > + dev_err(&vdev->dev,
> > + "%s failure: unsupported logical block
> > size %d\n",
> > + __func__, blk_size);
> > + err = -EINVAL;
> > + goto out_cleanup_queue;
> > + }
> > blk_queue_logical_block_size(q, blk_size);
> > - else
> > + } else
> > blk_size = queue_logical_block_size(q);
> >
> > /* Use topology information if available */
>
> OK so if we are doing this pls add {} around blk_size =
> queue_logical_block_size(q);
> too.
Will do.
>...
2020 Jul 15
3
[PATCH] virtio-blk: check host supplied logical block size
...blk_config, blk_size,
&blk_size);
- if (!err)
+ if (!err) {
+ if (!virtblk_valid_block_size(blk_size)) {
+ dev_err(&vdev->dev,
+ "%s failure: unsupported logical block size %d\n",
+ __func__, blk_size);
+ err = -EINVAL;
+ goto out_cleanup_queue;
+ }
blk_queue_logical_block_size(q, blk_size);
- else
+ } else
blk_size = queue_logical_block_size(q);
/* Use topology information if available */
@@ -872,6 +885,9 @@ static int virtblk_probe(struct virtio_device *vdev)
device_add_disk(&vdev->dev, vblk->disk, virtblk_attr_groups);
return 0;
+out_cleanup_queu...
2020 Jul 15
3
[PATCH] virtio-blk: check host supplied logical block size
...blk_config, blk_size,
&blk_size);
- if (!err)
+ if (!err) {
+ if (!virtblk_valid_block_size(blk_size)) {
+ dev_err(&vdev->dev,
+ "%s failure: unsupported logical block size %d\n",
+ __func__, blk_size);
+ err = -EINVAL;
+ goto out_cleanup_queue;
+ }
blk_queue_logical_block_size(q, blk_size);
- else
+ } else
blk_size = queue_logical_block_size(q);
/* Use topology information if available */
@@ -872,6 +885,9 @@ static int virtblk_probe(struct virtio_device *vdev)
device_add_disk(&vdev->dev, vblk->disk, virtblk_attr_groups);
return 0;
+out_cleanup_queu...
2020 Jul 15
0
[PATCH] virtio-blk: check host supplied logical block size
...- if (!err)
> + if (!err) {
> + if (!virtblk_valid_block_size(blk_size)) {
> + dev_err(&vdev->dev,
> + "%s failure: unsupported logical block size %d\n",
> + __func__, blk_size);
> + err = -EINVAL;
> + goto out_cleanup_queue;
> + }
> blk_queue_logical_block_size(q, blk_size);
> - else
> + } else
> blk_size = queue_logical_block_size(q);
>
> /* Use topology information if available */
OK so if we are doing this pls add {} around blk_size = queue_logical_block_size(q);
too.
> @@ -872,6 +885,9 @@ static int virtblk_probe(struct vir...
2020 Jul 15
0
[PATCH] virtio-blk: check host supplied logical block size
...t; > > + dev_err(&vdev->dev,
> > > + "%s failure: unsupported logical block
> > > size %d\n",
> > > + __func__, blk_size);
> > > + err = -EINVAL;
> > > + goto out_cleanup_queue;
> > > + }
> > > blk_queue_logical_block_size(q, blk_size);
> > > - else
> > > + } else
> > > blk_size = queue_logical_block_size(q);
> > >
> > > /* Use topology information if available */
> >
> > OK so if we are doing this pls add {} around blk_size =
> > queue_logical_b...
2015 Mar 13
0
[PATCH] sd, mmc, virtio_blk, string_helpers: fix block size units
...s specify the capacity. */
> virtio_cread(vdev, struct virtio_blk_config, capacity, &capacity);
> @@ -356,9 +356,10 @@ static void virtblk_config_changed_work(struct work_struct *work)
> capacity = (sector_t)-1;
> }
>
> - size = capacity * queue_logical_block_size(q);
> - string_get_size(size, STRING_UNITS_2, cap_str_2, sizeof(cap_str_2));
> - string_get_size(size, STRING_UNITS_10, cap_str_10, sizeof(cap_str_10));
> + string_get_size(capacity, queue_logical_block_size(q),
> + STRING_UNITS_2, cap_str_2, size...
2015 Mar 13
0
[PATCH] sd, mmc, virtio_blk, string_helpers: fix block size units
...s specify the capacity. */
> virtio_cread(vdev, struct virtio_blk_config, capacity, &capacity);
> @@ -356,9 +356,10 @@ static void virtblk_config_changed_work(struct work_struct *work)
> capacity = (sector_t)-1;
> }
>
> - size = capacity * queue_logical_block_size(q);
> - string_get_size(size, STRING_UNITS_2, cap_str_2, sizeof(cap_str_2));
> - string_get_size(size, STRING_UNITS_10, cap_str_10, sizeof(cap_str_10));
> + string_get_size(capacity, queue_logical_block_size(q),
> + STRING_UNITS_2, cap_str_2, size...
2011 Jan 27
1
[PATCH] virtio_blk: allow re-reading config space at runtime
.../* If capacity is too big, truncate with warning. */
> + if ((sector_t)capacity != capacity) {
> + dev_warn(&vdev->dev, "Capacity %llu too large: truncating\n",
> + (unsigned long long)capacity);
> + capacity = (sector_t)-1;
> + }
> +
> + size = capacity * queue_logical_block_size(q);
> + string_get_size(size, STRING_UNITS_2, cap_str_2, sizeof(cap_str_2));
> + string_get_size(size, STRING_UNITS_10, cap_str_10, sizeof(cap_str_10));
> +
> + dev_notice(&vdev->dev,
> + "new size: %llu %d-byte logical blocks (%s/%s)\n",
> + (unsigned long...
2011 Jan 27
1
[PATCH] virtio_blk: allow re-reading config space at runtime
.../* If capacity is too big, truncate with warning. */
> + if ((sector_t)capacity != capacity) {
> + dev_warn(&vdev->dev, "Capacity %llu too large: truncating\n",
> + (unsigned long long)capacity);
> + capacity = (sector_t)-1;
> + }
> +
> + size = capacity * queue_logical_block_size(q);
> + string_get_size(size, STRING_UNITS_2, cap_str_2, sizeof(cap_str_2));
> + string_get_size(size, STRING_UNITS_10, cap_str_10, sizeof(cap_str_10));
> +
> + dev_notice(&vdev->dev,
> + "new size: %llu %d-byte logical blocks (%s/%s)\n",
> + (unsigned long...
2018 Jan 03
1
[PATCH] virtio_blk: print capacity at probe time
...10, sizeof(cap_str_10));
dev_notice(&vdev->dev,
- "new size: %llu %d-byte logical blocks (%s/%s)\n",
+ "[%s] %s%llu %d-byte logical blocks (%s/%s)\n",
+ vblk->disk->disk_name,
+ resize ? "new size: " : "",
nblocks,
queue_logical_block_size(q),
cap_str_10,
cap_str_2);
set_capacity(vblk->disk, capacity);
+}
+
+static void virtblk_config_changed_work(struct work_struct *work)
+{
+ struct virtio_blk *vblk =
+ container_of(work, struct virtio_blk, config_work);
+ char *envp[] = { "RESIZE=1", NULL };
+
+ virtb...
2017 Jul 05
3
[PATCH v2] virtio-blk: add DISCARD support to virtio-blk driver
...atic int virtblk_add_req(struct virtqueue *vq, struct virtblk_req *vbr,
return virtqueue_add_sgs(vq, sgs, num_out, num_in, vbr, GFP_ATOMIC);
}
+static inline int virtblk_setup_discard(struct request *req)
+{
+ unsigned short segments = blk_rq_nr_discard_segments(req), n = 0;
+ u32 block_size = queue_logical_block_size(req->q);
+ struct virtio_blk_discard *range;
+ struct bio *bio;
+
+ if (block_size < 512 || !block_size)
+ return -1;
+
+ range = kmalloc_array(segments, sizeof(*range), GFP_ATOMIC);
+ if (!range)
+ return -1;
+
+ __rq_for_each_bio(bio, req) {
+ u64 slba = (bio->bi_iter.bi_sector <&l...
2017 Jul 05
3
[PATCH v2] virtio-blk: add DISCARD support to virtio-blk driver
...atic int virtblk_add_req(struct virtqueue *vq, struct virtblk_req *vbr,
return virtqueue_add_sgs(vq, sgs, num_out, num_in, vbr, GFP_ATOMIC);
}
+static inline int virtblk_setup_discard(struct request *req)
+{
+ unsigned short segments = blk_rq_nr_discard_segments(req), n = 0;
+ u32 block_size = queue_logical_block_size(req->q);
+ struct virtio_blk_discard *range;
+ struct bio *bio;
+
+ if (block_size < 512 || !block_size)
+ return -1;
+
+ range = kmalloc_array(segments, sizeof(*range), GFP_ATOMIC);
+ if (!range)
+ return -1;
+
+ __rq_for_each_bio(bio, req) {
+ u64 slba = (bio->bi_iter.bi_sector <&l...
2020 Jul 21
0
[PATCH 02/10] block: virtio-blk: check logical block size
..._config, blk_size,
&blk_size);
- if (!err)
+ if (!err) {
+ if (!blk_is_valid_logical_block_size(blk_size)) {
+ dev_err(&vdev->dev,
+ "%s failure: invalid logical block size %d\n",
+ __func__, blk_size);
+ err = -EINVAL;
+ goto out_cleanup_queue;
+ }
blk_queue_logical_block_size(q, blk_size);
- else
+ } else {
blk_size = queue_logical_block_size(q);
+ }
/* Use topology information if available */
err = virtio_cread_feature(vdev, VIRTIO_BLK_F_TOPOLOGY,
@@ -872,6 +880,9 @@ static int virtblk_probe(struct virtio_device *vdev)
device_add_disk(&vdev->dev, vblk...
2018 Mar 30
2
[PATCH v3] virtio_blk: add DISCARD and WRIET ZEROES command support
...struct virtqueue *vq, struct virtblk_req *vbr,
return virtqueue_add_sgs(vq, sgs, num_out, num_in, vbr, GFP_ATOMIC);
}
+static inline int virtblk_setup_discard_write_zeroes(struct request *req, bool unmap)
+{
+ unsigned short segments = blk_rq_nr_discard_segments(req), n = 0;
+ u32 block_size = queue_logical_block_size(req->q);
+ struct virtio_blk_discard_write_zeroes *range;
+ struct bio *bio;
+
+ if (block_size < 512 || !block_size)
+ return -1;
+
+ range = kmalloc_array(segments, sizeof(*range), GFP_ATOMIC);
+ if (!range)
+ return -1;
+
+ __rq_for_each_bio(bio, req) {
+ u64 sector = bio->bi_iter.bi...
2018 Mar 30
2
[PATCH v3] virtio_blk: add DISCARD and WRIET ZEROES command support
...struct virtqueue *vq, struct virtblk_req *vbr,
return virtqueue_add_sgs(vq, sgs, num_out, num_in, vbr, GFP_ATOMIC);
}
+static inline int virtblk_setup_discard_write_zeroes(struct request *req, bool unmap)
+{
+ unsigned short segments = blk_rq_nr_discard_segments(req), n = 0;
+ u32 block_size = queue_logical_block_size(req->q);
+ struct virtio_blk_discard_write_zeroes *range;
+ struct bio *bio;
+
+ if (block_size < 512 || !block_size)
+ return -1;
+
+ range = kmalloc_array(segments, sizeof(*range), GFP_ATOMIC);
+ if (!range)
+ return -1;
+
+ __rq_for_each_bio(bio, req) {
+ u64 sector = bio->bi_iter.bi...
2017 Jul 04
0
[PATCH v2] virtio-blk: add DISCARD support to virtio-blk driver
...tqueue *vq, struct virtblk_req *vbr,
> return virtqueue_add_sgs(vq, sgs, num_out, num_in, vbr, GFP_ATOMIC);
> }
>
> +static inline int virtblk_setup_discard(struct request *req)
> +{
> + unsigned short segments = blk_rq_nr_discard_segments(req), n = 0;
> + u32 block_size = queue_logical_block_size(req->q);
> + struct virtio_blk_discard *range;
> + struct bio *bio;
> +
> + if (block_size < 512 || !block_size)
> + return -1;
> +
> + range = kmalloc_array(segments, sizeof(*range), GFP_ATOMIC);
> + if (!range)
> + return -1;
> +
> + __rq_for_each_bio(bio,...