History

md: move the early init autodetect code to drivers/md/

Just like the NFS and CIFS root code this better lives with the driver it is tightly integrated with.

Christoph Hellwig committed 6 years ago

Commit 4f5b2461 parent 881627f6 files · +25 −13Browse files

Unified · Split

6 files
  1. drivers/md/Makefile +3 −0
  2. drivers/md/md-autodetect.c +13 −2
  3. include/linux/raid/detect.h +8 −0
  4. init/Makefile +0 −1
  5. init/do_mounts.c +1 −0
  6. init/do_mounts.h +0 −10
drivers/md/Makefile+3−0
@@ -43,6 +43,9 @@ obj-$(CONFIG_MD_FAULTY) += faulty.o · 42 unmodified lines
4343 obj-$(CONFIG_MD_CLUSTER) += md-cluster.o
4444 obj-$(CONFIG_BCACHE) += bcache/
4545 obj-$(CONFIG_BLK_DEV_MD) += md-mod.o
46+ifeq ($(CONFIG_BLK_DEV_MD),y)
47+obj-y += md-autodetect.o
48+endif
4649 obj-$(CONFIG_BLK_DEV_DM) += dm-mod.o
4750 obj-$(CONFIG_BLK_DEV_DM_BUILTIN) += dm-builtin.o
4851 obj-$(CONFIG_DM_UNSTRIPED) += dm-unstripe.o
drivers/md/md-autodetect.crenamed from init/do_mounts_md.c+13−2
@@ -1,10 +1,15 @@
11 // SPDX-License-Identifier: GPL-2.0
2+#include <linux/kernel.h>
3+#include <linux/blkdev.h>
4+#include <linux/init.h>
5+#include <linux/syscalls.h>
6+#include <linux/mount.h>
7+#include <linux/major.h>
28 #include <linux/delay.h>
9+#include <linux/raid/detect.h>
310 #include <linux/raid/md_u.h>
411 #include <linux/raid/md_p.h>
512
6−#include "do_mounts.h"
7−
813 /*
914 * When md (and any require personalities) are compiled into the kernel
1015 * (not a module), arrays can be assembles are boot time using with AUTODETECT
@@ -114,6 +119,12 @@ static int __init md_setup(char *str) · 103 unmodified lines
114119 return 1;
115120 }
116121
122+static inline int create_dev(char *name, dev_t dev)
123+{
124+ ksys_unlink(name);
125+ return ksys_mknod(name, S_IFBLK|0600, new_encode_dev(dev));
126+}
127+
117128 static void __init md_setup_drive(void)
118129 {
119130 int minor, i, ent, partitioned;
include/linux/raid/detect.h+8−0
@@ -1,3 +1,11 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22
33 void md_autodetect_dev(dev_t dev);
4+
5+#ifdef CONFIG_BLK_DEV_MD
6+void md_run_setup(void);
7+#else
8+static inline void md_run_setup(void)
9+{
10+}
11+#endif
init/Makefile+0−1
@@ -18,7 +18,6 @@ obj-y += init_task.o · 17 unmodified lines
1818 mounts-y := do_mounts.o
1919 mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o
2020 mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o
21−mounts-$(CONFIG_BLK_DEV_MD) += do_mounts_md.o
2221
2322 # dependencies on generated files need to be listed explicitly
2423 $(obj)/version.o: include/generated/compile.h
init/do_mounts.c+1−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 #include <linux/nfs_fs.h>
2424 #include <linux/nfs_fs_sb.h>
2525 #include <linux/nfs_mount.h>
26+#include <linux/raid/detect.h>
2627 #include <uapi/linux/mount.h>
2728
2829 #include "do_mounts.h"
init/do_mounts.h+0−10
@@ -41,13 +41,3 @@ bool __init initrd_load(void); · 40 unmodified lines
4141 static inline bool initrd_load(void) { return false; }
4242
4343 #endif
44−
45−#ifdef CONFIG_BLK_DEV_MD
46−
47−void md_run_setup(void);
48−
49−#else
50−
51−static inline void md_run_setup(void) {}
52−
53−#endif