2019-05-11 09:23:56 +00:00
|
|
|
From e6678551bfaed27e7c22877afd15a542c1d5d13f Mon Sep 17 00:00:00 2001
|
2016-07-12 17:56:21 +00:00
|
|
|
From: Rusty Bird <rustybird@openmailbox.org>
|
|
|
|
Date: Mon, 11 Jul 2016 13:05:38 +0000
|
|
|
|
Subject: [PATCH] block: add no_part_scan module parameter
|
|
|
|
|
|
|
|
Define a boolean module parameter named "no_part_scan" defaulting to N,
|
|
|
|
which, if set to Y, always causes the GENHD_FL_NO_PART_SCAN flag to be
|
|
|
|
added to subsequently created block devices, thereby disabling the
|
|
|
|
kernel's various partition table parsers for them.
|
|
|
|
|
|
|
|
The parameter's current value can be changed at any time by writing to
|
|
|
|
the /sys/module/block/parameters/no_part_scan file.
|
|
|
|
---
|
|
|
|
block/genhd.c | 12 ++++++++++++
|
|
|
|
1 file changed, 12 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/block/genhd.c b/block/genhd.c
|
2019-05-11 09:23:56 +00:00
|
|
|
index 703267865f14..d23df3adf080 100644
|
2016-07-12 17:56:21 +00:00
|
|
|
--- a/block/genhd.c
|
|
|
|
+++ b/block/genhd.c
|
2019-05-11 09:23:56 +00:00
|
|
|
@@ -663,6 +663,15 @@ static void register_disk(struct device *parent, struct gendisk *disk,
|
|
|
|
}
|
2016-07-12 17:56:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+/* copied (not moved) from far down below, to have fewer patch hunks */
|
|
|
|
+#undef MODULE_PARAM_PREFIX
|
|
|
|
+#define MODULE_PARAM_PREFIX "block."
|
|
|
|
+
|
|
|
|
+/* partition scanning policy */
|
|
|
|
+static bool disk_no_part_scan = 0;
|
|
|
|
+module_param_named(no_part_scan, disk_no_part_scan, bool, S_IRUGO|S_IWUSR);
|
|
|
|
+MODULE_PARM_DESC(no_part_scan, "When adding block devices, always mark them as not to be scanned for partitions");
|
|
|
|
+
|
|
|
|
/**
|
2018-04-12 21:32:59 +00:00
|
|
|
* __device_add_disk - add disk information to kernel list
|
2016-11-11 13:28:22 +00:00
|
|
|
* @parent: parent device for the disk
|
2019-05-11 09:23:56 +00:00
|
|
|
@@ -682,6 +691,9 @@ static void __device_add_disk(struct device *parent, struct gendisk *disk,
|
2016-07-12 17:56:21 +00:00
|
|
|
dev_t devt;
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
+ if (disk_no_part_scan)
|
|
|
|
+ disk->flags |= GENHD_FL_NO_PART_SCAN;
|
|
|
|
+
|
|
|
|
/* minors == 0 indicates to use ext devt from part0 and should
|
|
|
|
* be accompanied with EXT_DEVT flag. Make sure all
|
|
|
|
* parameters make sense.
|
|
|
|
--
|
2019-03-15 21:28:57 +00:00
|
|
|
2.20.1
|
2016-07-12 17:56:21 +00:00
|
|
|
|