Skip to content

Commit 4f5b246

Browse files
author
Christoph Hellwig
committed
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>
1 parent 881627f commit 4f5b246

6 files changed

Lines changed: 25 additions & 13 deletions

File tree

‎drivers/md/Makefile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ obj-$(CONFIG_MD_FAULTY) += faulty.o
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
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
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‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ obj-y += init_task.o
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‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
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‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,3 @@ bool __init initrd_load(void);
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

0 commit comments

Comments
 (0)