aboutsummaryrefslogtreecommitdiffstats
path: root/init/do_mounts_md.c
diff options
context:
space:
mode:
Diffstat (limited to 'init/do_mounts_md.c')
-rw-r--r--init/do_mounts_md.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
index 693d24694a6c..48b3fadd83ed 100644
--- a/init/do_mounts_md.c
+++ b/init/do_mounts_md.c
@@ -12,7 +12,12 @@
12 * The code for that is here. 12 * The code for that is here.
13 */ 13 */
14 14
15static int __initdata raid_noautodetect, raid_autopart; 15#ifdef CONFIG_MD_AUTODETECT
16static int __initdata raid_noautodetect;
17#else
18static int __initdata raid_noautodetect=1;
19#endif
20static int __initdata raid_autopart;
16 21
17static struct { 22static struct {
18 int minor; 23 int minor;
@@ -252,6 +257,8 @@ static int __init raid_setup(char *str)
252 257
253 if (!strncmp(str, "noautodetect", wlen)) 258 if (!strncmp(str, "noautodetect", wlen))
254 raid_noautodetect = 1; 259 raid_noautodetect = 1;
260 if (!strncmp(str, "autodetect", wlen))
261 raid_noautodetect = 0;
255 if (strncmp(str, "partitionable", wlen)==0) 262 if (strncmp(str, "partitionable", wlen)==0)
256 raid_autopart = 1; 263 raid_autopart = 1;
257 if (strncmp(str, "part", wlen)==0) 264 if (strncmp(str, "part", wlen)==0)
@@ -264,17 +271,32 @@ static int __init raid_setup(char *str)
264__setup("raid=", raid_setup); 271__setup("raid=", raid_setup);
265__setup("md=", md_setup); 272__setup("md=", md_setup);
266 273
274static void autodetect_raid(void)
275{
276 int fd;
277
278 /*
279 * Since we don't want to detect and use half a raid array, we need to
280 * wait for the known devices to complete their probing
281 */
282 printk(KERN_INFO "md: Waiting for all devices to be available before autodetect\n");
283 printk(KERN_INFO "md: If you don't use raid, use raid=noautodetect\n");
284 while (driver_probe_done() < 0)
285 msleep(100);
286 fd = sys_open("/dev/md0", 0, 0);
287 if (fd >= 0) {
288 sys_ioctl(fd, RAID_AUTORUN, raid_autopart);
289 sys_close(fd);
290 }
291}
292
267void __init md_run_setup(void) 293void __init md_run_setup(void)
268{ 294{
269 create_dev("/dev/md0", MKDEV(MD_MAJOR, 0)); 295 create_dev("/dev/md0", MKDEV(MD_MAJOR, 0));
296
270 if (raid_noautodetect) 297 if (raid_noautodetect)
271 printk(KERN_INFO "md: Skipping autodetection of RAID arrays. (raid=noautodetect)\n"); 298 printk(KERN_INFO "md: Skipping autodetection of RAID arrays. (raid=autodetect will force)\n");
272 else { 299 else
273 int fd = sys_open("/dev/md0", 0, 0); 300 autodetect_raid();
274 if (fd >= 0) {
275 sys_ioctl(fd, RAID_AUTORUN, raid_autopart);
276 sys_close(fd);
277 }
278 }
279 md_setup_drive(); 301 md_setup_drive();
280} 302}