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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mark Lehrer <mark.lehrer@xxxxxxx>

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@xxxxxxx>
---

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;





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux