patch-2.4.3 linux/drivers/md/md.c
Next file: linux/drivers/media/radio/Config.in
Previous file: linux/drivers/isdn/sc/interrupt.c
Back to the patch index
Back to the overall index
- Lines: 101
- Date:
Mon Mar 12 18:13:28 2001
- Orig file:
v2.4.2/linux/drivers/md/md.c
- Orig date:
Wed Feb 21 18:20:24 2001
diff -u --recursive --new-file v2.4.2/linux/drivers/md/md.c linux/drivers/md/md.c
@@ -682,6 +682,8 @@
rdev->bdev = NULL;
}
+void md_autodetect_dev (kdev_t dev);
+
static void export_rdev (mdk_rdev_t * rdev)
{
printk("export_rdev(%s)\n",partition_name(rdev->dev));
@@ -696,6 +698,9 @@
md_list_del(&rdev->pending);
MD_INIT_LIST_HEAD(&rdev->pending);
}
+#ifndef MODULE
+ md_autodetect_dev(rdev->dev);
+#endif
rdev->dev = 0;
rdev->faulty = 0;
kfree(rdev);
@@ -3525,6 +3530,7 @@
int md__init md_init (void)
{
static char * name = "mdrecoveryd";
+ int minor;
printk (KERN_INFO "md driver %d.%d.%d MAX_MD_DEVS=%d, MD_SB_DISKS=%d\n",
MD_MAJOR_VERSION, MD_MINOR_VERSION,
@@ -3536,9 +3542,14 @@
return (-1);
}
devfs_handle = devfs_mk_dir (NULL, "md", NULL);
- devfs_register_series (devfs_handle, "%u",MAX_MD_DEVS,DEVFS_FL_DEFAULT,
- MAJOR_NR, 0, S_IFBLK | S_IRUSR | S_IWUSR,
- &md_fops, NULL);
+ /* we don't use devfs_register_series because we want to fill md_hd_struct */
+ for (minor=0; minor < MAX_MD_DEVS; ++minor) {
+ char devname[128];
+ sprintf (devname, "%u", minor);
+ md_hd_struct[minor].de = devfs_register (devfs_handle,
+ devname, DEVFS_FL_DEFAULT, MAJOR_NR, minor,
+ S_IFBLK | S_IRUSR | S_IWUSR, &md_fops, NULL);
+ }
/* forward all md request to md_make_request */
blk_queue_make_request(BLK_DEFAULT_QUEUE(MAJOR_NR), md_make_request);
@@ -3581,10 +3592,10 @@
* Searches all registered partitions for autorun RAID arrays
* at boot time.
*/
-static int detected_devices[128] md__initdata;
+static int detected_devices[128];
static int dev_cnt;
-void md_autodetect_dev(kdev_t dev)
+void md_autodetect_dev (kdev_t dev)
{
if (dev_cnt >= 0 && dev_cnt < 127)
detected_devices[dev_cnt++] = dev;
@@ -3598,7 +3609,7 @@
printk(KERN_INFO "autodetecting RAID arrays\n");
- for (i=0; i<dev_cnt; i++) {
+ for (i = 0; i < dev_cnt; i++) {
kdev_t dev = detected_devices[i];
if (md_import_device(dev,1)) {
@@ -3620,6 +3631,7 @@
}
md_list_add(&rdev->pending, &pending_raid_disks);
}
+ dev_cnt = 0;
autorun_devices(-1);
}
@@ -3656,7 +3668,7 @@
kdev_t device;
char *devnames, *pername = "";
- if(get_option(&str, &minor) != 2) { /* MD Number */
+ if (get_option(&str, &minor) != 2) { /* MD Number */
printk("md: Too few arguments supplied to md=.\n");
return 0;
}
@@ -3667,7 +3679,7 @@
printk ("md: Warning - md=%d,... has been specified twice;\n"
" will discard the first definition.\n", minor);
}
- switch(get_option(&str, &level)) { /* RAID Personality */
+ switch (get_option(&str, &level)) { /* RAID Personality */
case 2: /* could be 0 or -1.. */
if (level == 0 || level == -1) {
if (get_option(&str, &factor) != 2 || /* Chunk Size */
@@ -3820,7 +3832,6 @@
printk(KERN_INFO "skipping autodetection of RAID arrays\n");
else
autostart_arrays();
- dev_cnt = -1; /* make sure further calls to md_autodetect_dev are ignored */
md_setup_drive();
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)