diff mbox series

[1/1] brd: Add an option to disable 512e sector size

Message ID 20190409150844.26270-1-mark.lehrer@wdc.com (mailing list archive)
State New, archived
Headers show
Series [1/1] brd: Add an option to disable 512e sector size | expand

Commit Message

Mark Lehrer April 9, 2019, 3:08 p.m. UTC
From: Mark Lehrer <mark.lehrer@wdc.com>

This patch adds a new option, "disable_512e", which causes the driver to 
set the blk_queue_logical_block_size to 4K to match the 
blk_queue_physical_block_size.  If this option is left at the default, brd
will work the same way it always has so this shouldn't affect anyone 
unexpectedly.


Signed-off-by: Mark Lehrer <mark.lehrer@wdc.com>
---
diff mbox series

Patch

diff -uprN a/drivers/block/brd.c b/drivers/block/brd.c
--- a/drivers/block/brd.c       2019-04-08 09:57:42.016921473 -0600
+++ b/drivers/block/brd.c       2019-04-08 10:20:58.248623425 -0600
@@ -342,6 +342,10 @@  static int max_part = 1;
 module_param(max_part, int, 0444);
 MODULE_PARM_DESC(max_part, "Num Minors to reserve between devices");
 
+static int disable_512e = 0;
+module_param(disable_512e, int, 0444);
+MODULE_PARM_DESC(disable_512e, "Disable Logical 512e sector size");
+
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_BLOCKDEV_MAJOR(RAMDISK_MAJOR);
 MODULE_ALIAS("rd");
@@ -389,6 +393,10 @@  static struct brd_device *brd_alloc(int
          *  is harmless)
          */
         blk_queue_physical_block_size(brd->brd_queue, PAGE_SIZE);
+
+       if (disable_512e)
+               blk_queue_logical_block_size(brd->brd_queue, PAGE_SIZE);
+
         disk = brd->brd_disk = alloc_disk(max_part);
         if (!disk)
                 goto out_free_queue;