Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Song Liu <song@kernel.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>

+25 -13
+3
drivers/md/Makefile
··· 43 43 obj-$(CONFIG_MD_CLUSTER) += md-cluster.o 44 44 obj-$(CONFIG_BCACHE) += bcache/ 45 45 obj-$(CONFIG_BLK_DEV_MD) += md-mod.o 46 + ifeq ($(CONFIG_BLK_DEV_MD),y) 47 + obj-y += md-autodetect.o 48 + endif 46 49 obj-$(CONFIG_BLK_DEV_DM) += dm-mod.o 47 50 obj-$(CONFIG_BLK_DEV_DM_BUILTIN) += dm-builtin.o 48 51 obj-$(CONFIG_DM_UNSTRIPED) += dm-unstripe.o
+8
include/linux/raid/detect.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 2 3 3 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
-1
init/Makefile
··· 18 18 mounts-y := do_mounts.o 19 19 mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o 20 20 mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o 21 - mounts-$(CONFIG_BLK_DEV_MD) += do_mounts_md.o 22 21 23 22 # dependencies on generated files need to be listed explicitly 24 23 $(obj)/version.o: include/generated/compile.h
+1
init/do_mounts.c
··· 23 23 #include <linux/nfs_fs.h> 24 24 #include <linux/nfs_fs_sb.h> 25 25 #include <linux/nfs_mount.h> 26 + #include <linux/raid/detect.h> 26 27 #include <uapi/linux/mount.h> 27 28 28 29 #include "do_mounts.h"
-10
init/do_mounts.h
··· 41 41 static inline bool initrd_load(void) { return false; } 42 42 43 43 #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
+13 -2
init/do_mounts_md.c drivers/md/md-autodetect.c
··· 1 1 // 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> 2 8 #include <linux/delay.h> 9 + #include <linux/raid/detect.h> 3 10 #include <linux/raid/md_u.h> 4 11 #include <linux/raid/md_p.h> 5 - 6 - #include "do_mounts.h" 7 12 8 13 /* 9 14 * When md (and any require personalities) are compiled into the kernel ··· 117 112 md_setup_args[ent].minor = minor; 118 113 119 114 return 1; 115 + } 116 + 117 + static inline int create_dev(char *name, dev_t dev) 118 + { 119 + ksys_unlink(name); 120 + return ksys_mknod(name, S_IFBLK|0600, new_encode_dev(dev)); 120 121 } 121 122 122 123 static void __init md_setup_drive(void)