Commit 4f5b246b authored by Christoph Hellwig's avatar Christoph Hellwig

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: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarSong Liu <song@kernel.org>
Acked-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 881627f3
...@@ -43,6 +43,9 @@ obj-$(CONFIG_MD_FAULTY) += faulty.o ...@@ -43,6 +43,9 @@ obj-$(CONFIG_MD_FAULTY) += faulty.o
obj-$(CONFIG_MD_CLUSTER) += md-cluster.o obj-$(CONFIG_MD_CLUSTER) += md-cluster.o
obj-$(CONFIG_BCACHE) += bcache/ obj-$(CONFIG_BCACHE) += bcache/
obj-$(CONFIG_BLK_DEV_MD) += md-mod.o obj-$(CONFIG_BLK_DEV_MD) += md-mod.o
ifeq ($(CONFIG_BLK_DEV_MD),y)
obj-y += md-autodetect.o
endif
obj-$(CONFIG_BLK_DEV_DM) += dm-mod.o obj-$(CONFIG_BLK_DEV_DM) += dm-mod.o
obj-$(CONFIG_BLK_DEV_DM_BUILTIN) += dm-builtin.o obj-$(CONFIG_BLK_DEV_DM_BUILTIN) += dm-builtin.o
obj-$(CONFIG_DM_UNSTRIPED) += dm-unstripe.o obj-$(CONFIG_DM_UNSTRIPED) += dm-unstripe.o
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include <linux/kernel.h>
#include <linux/blkdev.h>
#include <linux/init.h>
#include <linux/syscalls.h>
#include <linux/mount.h>
#include <linux/major.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/raid/detect.h>
#include <linux/raid/md_u.h> #include <linux/raid/md_u.h>
#include <linux/raid/md_p.h> #include <linux/raid/md_p.h>
#include "do_mounts.h"
/* /*
* When md (and any require personalities) are compiled into the kernel * When md (and any require personalities) are compiled into the kernel
* (not a module), arrays can be assembles are boot time using with AUTODETECT * (not a module), arrays can be assembles are boot time using with AUTODETECT
...@@ -114,6 +119,12 @@ static int __init md_setup(char *str) ...@@ -114,6 +119,12 @@ static int __init md_setup(char *str)
return 1; return 1;
} }
static inline int create_dev(char *name, dev_t dev)
{
ksys_unlink(name);
return ksys_mknod(name, S_IFBLK|0600, new_encode_dev(dev));
}
static void __init md_setup_drive(void) static void __init md_setup_drive(void)
{ {
int minor, i, ent, partitioned; int minor, i, ent, partitioned;
......
/* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: GPL-2.0 */
void md_autodetect_dev(dev_t dev); void md_autodetect_dev(dev_t dev);
#ifdef CONFIG_BLK_DEV_MD
void md_run_setup(void);
#else
static inline void md_run_setup(void)
{
}
#endif
...@@ -18,7 +18,6 @@ obj-y += init_task.o ...@@ -18,7 +18,6 @@ obj-y += init_task.o
mounts-y := do_mounts.o mounts-y := do_mounts.o
mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o
mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o
mounts-$(CONFIG_BLK_DEV_MD) += do_mounts_md.o
# dependencies on generated files need to be listed explicitly # dependencies on generated files need to be listed explicitly
$(obj)/version.o: include/generated/compile.h $(obj)/version.o: include/generated/compile.h
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/nfs_fs.h> #include <linux/nfs_fs.h>
#include <linux/nfs_fs_sb.h> #include <linux/nfs_fs_sb.h>
#include <linux/nfs_mount.h> #include <linux/nfs_mount.h>
#include <linux/raid/detect.h>
#include <uapi/linux/mount.h> #include <uapi/linux/mount.h>
#include "do_mounts.h" #include "do_mounts.h"
......
...@@ -41,13 +41,3 @@ bool __init initrd_load(void); ...@@ -41,13 +41,3 @@ bool __init initrd_load(void);
static inline bool initrd_load(void) { return false; } static inline bool initrd_load(void) { return false; }
#endif #endif
#ifdef CONFIG_BLK_DEV_MD
void md_run_setup(void);
#else
static inline void md_run_setup(void) {}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment