Displaying 20 results from an estimated 42 matches for "blk_queue_logical_block_size".
2020 Jul 22
2
[PATCH 02/10] block: virtio-blk: check logical block size
On Tue, 2020-07-21 at 22:55 -0400, Martin K. Petersen wrote:
> Christoph,
>
> > Hmm, I wonder if we should simply add the check and warning to
> > blk_queue_logical_block_size and add an error in that case. Then
> > drivers only have to check the error return, which might add a lot
> > less boiler plate code.
>
> Yep, I agree.
>
I also agree that this would be cleaner (I actually tried to implement
this the way you suggest), but let me explain my...
2020 Jul 21
2
[PATCH 02/10] block: virtio-blk: check logical block 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);
Hmm, I wonder if we should simply add the check and warning to
blk_queue_logical_block_size and add an error in that case. Then
drivers only have to check the error return, which might add a lot
less boiler plate code.
2020 Jul 21
2
[PATCH 02/10] block: virtio-blk: check logical block 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);
Hmm, I wonder if we should simply add the check and warning to
blk_queue_logical_block_size and add an error in that case. Then
drivers only have to check the error return, which might add a lot
less boiler plate code.
2020 Jul 21
0
[PATCH 01/10] block: introduce blk_is_valid_logical_block_size
...ze <= PAGE_SIZE && !is_power_of_2(size);
Note here a typo, made in last minute change which I didn't test.
It should be without '!'
Best regards,
Maxim Levitsky
> > +}
> > +EXPORT_SYMBOL(blk_is_valid_logical_block_size);
> > +
> > /**
> > * blk_queue_logical_block_size - set logical block size for the queue
> > * @q: the request queue for the device
> > @@ -323,6 +338,8 @@ EXPORT_SYMBOL(blk_queue_max_segment_size);
> > **/
> > void blk_queue_logical_block_size(struct request_queue *q, unsigned int size)
> > {
> > + WARN_...
2020 Jul 21
0
[PATCH 01/10] block: introduce blk_is_valid_logical_block_size
...+ * This function checks if the block layers supports given block size
+ **/
+bool blk_is_valid_logical_block_size(unsigned int size)
+{
+ return size >= SECTOR_SIZE && size <= PAGE_SIZE && !is_power_of_2(size);
+}
+EXPORT_SYMBOL(blk_is_valid_logical_block_size);
+
/**
* blk_queue_logical_block_size - set logical block size for the queue
* @q: the request queue for the device
@@ -323,6 +338,8 @@ EXPORT_SYMBOL(blk_queue_max_segment_size);
**/
void blk_queue_logical_block_size(struct request_queue *q, unsigned int size)
{
+ WARN_ON(!blk_is_valid_logical_block_size(size));
+
q->limits...
2020 Jul 15
3
[PATCH] virtio-blk: check host supplied logical block size
...tio_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
...tio_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
2
[PATCH] virtio-blk: check host supplied logical block size
...f (!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
...f (!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.
>...
2016 Jun 30
1
[PATCH v2 04/12] axonrom: Generate uevent after attribute available
.../arch/powerpc/sysdev/axonram.c
> @@ -238,7 +238,7 @@ static int axon_ram_probe(struct platform_device *device)
> set_capacity(bank->disk, bank->size >> AXON_RAM_SECTOR_SHIFT);
> blk_queue_make_request(bank->disk->queue, axon_ram_make_request);
> blk_queue_logical_block_size(bank->disk->queue, AXON_RAM_SECTOR_SIZE);
> - add_disk(bank->disk, true);
> + add_disk(bank->disk, false);
>
> bank->irq_id = irq_of_parse_and_map(device->dev.of_node, 0);
> if (bank->irq_id == NO_IRQ) {
> @@ -262,6 +262,7 @@ static...
2016 Jun 30
1
[PATCH v2 04/12] axonrom: Generate uevent after attribute available
.../arch/powerpc/sysdev/axonram.c
> @@ -238,7 +238,7 @@ static int axon_ram_probe(struct platform_device *device)
> set_capacity(bank->disk, bank->size >> AXON_RAM_SECTOR_SHIFT);
> blk_queue_make_request(bank->disk->queue, axon_ram_make_request);
> blk_queue_logical_block_size(bank->disk->queue, AXON_RAM_SECTOR_SIZE);
> - add_disk(bank->disk, true);
> + add_disk(bank->disk, false);
>
> bank->irq_id = irq_of_parse_and_map(device->dev.of_node, 0);
> if (bank->irq_id == NO_IRQ) {
> @@ -262,6 +262,7 @@ static...
2013 May 13
22
[PATCH] xen-blk(front|back): Handle large physical sector disks
...ctor_size,
+ unsigned int physical_sector_size)
{
struct request_queue *rq;
struct blkfront_info *info = gd->private_data;
@@ -564,6 +565,7 @@ static int xlvbd_init_blk_queue(struct gendisk *gd, u16
sector_size)
/* Hard sector size and max sectors impersonate the equiv. hardware. */
blk_queue_logical_block_size(rq, sector_size);
+ blk_queue_physical_block_size(rq, physical_sector_size);
blk_queue_max_hw_sectors(rq, 512);
/* Each segment in a request is up to an aligned page in size. */
@@ -667,7 +669,8 @@ static char *encode_disk_name(char *ptr, unsigned int n)
static int xlvbd_alloc_gendisk(blkif_...
2016 Jun 30
0
[PATCH v2 04/12] axonrom: Generate uevent after attribute available
...a/arch/powerpc/sysdev/axonram.c
+++ b/arch/powerpc/sysdev/axonram.c
@@ -238,7 +238,7 @@ static int axon_ram_probe(struct platform_device *device)
set_capacity(bank->disk, bank->size >> AXON_RAM_SECTOR_SHIFT);
blk_queue_make_request(bank->disk->queue, axon_ram_make_request);
blk_queue_logical_block_size(bank->disk->queue, AXON_RAM_SECTOR_SIZE);
- add_disk(bank->disk, true);
+ add_disk(bank->disk, false);
bank->irq_id = irq_of_parse_and_map(device->dev.of_node, 0);
if (bank->irq_id == NO_IRQ) {
@@ -262,6 +262,7 @@ static int axon_ram_probe(struct platform_device *device)...
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
...{
> > > + 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...
2020 Jul 21
0
[PATCH 02/10] block: virtio-blk: check logical block size
..._blk_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...
2020 Jul 22
0
[PATCH 02/10] block: virtio-blk: check logical block size
Christoph,
> Hmm, I wonder if we should simply add the check and warning to
> blk_queue_logical_block_size and add an error in that case. Then
> drivers only have to check the error return, which might add a lot
> less boiler plate code.
Yep, I agree.
--
Martin K. Petersen Oracle Linux Engineering
2011 Sep 01
9
[PATCH V4 0/3] xen-blkfront/blkback discard support
Dear list,
This is the V4 of the trim support for xen-blkfront/blkback,
Now we move BLKIF_OP_TRIM to BLKIF_OP_DISCARD, and dropped all
"trim" stuffs in the patches, and use "discard" instead.
Also we updated the helpers of blkif_x86_{32|64}_request or we
will meet problems using a non-native protocol.
And this patch has been tested with both SSD and raw file,
with SSD we will
2020 Jul 21
17
[PATCH 00/10] RFC: move logical block size checking to the block core
This patch series aims to move the logical block size checking to the
block code.
This was inspired by missing check for valid logical block size in
virtio-blk which causes the kernel to crash in a weird way later on
when it is invalid.
I added blk_is_valid_logical_block_size which returns true iff the
block size is one of supported sizes.
I added this check to virtio-blk, and also converted
2020 Jul 21
17
[PATCH 00/10] RFC: move logical block size checking to the block core
This patch series aims to move the logical block size checking to the
block code.
This was inspired by missing check for valid logical block size in
virtio-blk which causes the kernel to crash in a weird way later on
when it is invalid.
I added blk_is_valid_logical_block_size which returns true iff the
block size is one of supported sizes.
I added this check to virtio-blk, and also converted