lkml.org 
[lkml]   [2001]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch] raid-B1, 2.4.1-pre11, fixes, cleanups

On Tue, 30 Jan 2001, Neil Brown wrote:

> > -#define MAX_MD_BOOT_DEVS 8
> > +#define MAX_MD_BOOT_DEVS MAX_MD_DEVS

> Actually, this is not fine. Check the code that says:

indeed - it will work only up to 32 devices.

i've fixed the code to not have this assumption - it's init-time code only
anyway. There are also a few other cleanups in raid-2.4.1-B1:

- CONFIG_MD_BOOT gone. __init thing and people actually use it.

- CONFIG_AUTODETECT_RAID gone. __init thing, and can be turned off via
command-line. Needs special partition ID to be activated anyway.

- static-init cleanups (no need to initialize to zero)

- new RAID_AUTORUN ioctrl for initrd kernels to be able to start up
autostart arrays.

code is cleaner and simpler now. The patch removes a total of 7 lines,
while adding a new feature :-)

Dave, does this patch do the trick for you? (raid-2.4.1-B1 is against the
2.4.1-pre11 kernel.)

Ingo
--- linux/fs/partitions/msdos.c.orig Wed Jul 19 08:29:16 2000
+++ linux/fs/partitions/msdos.c Mon Jan 29 23:41:53 2001
@@ -36,7 +36,7 @@
#include "check.h"
#include "msdos.h"

-#if CONFIG_BLK_DEV_MD && CONFIG_AUTODETECT_RAID
+#if CONFIG_BLK_DEV_MD
extern void md_autodetect_dev(kdev_t dev);
#endif

@@ -136,7 +136,7 @@
add_gd_partition(hd, current_minor,
this_sector+START_SECT(p)*sector_size,
NR_SECTS(p)*sector_size);
-#if CONFIG_BLK_DEV_MD && CONFIG_AUTODETECT_RAID
+#if CONFIG_BLK_DEV_MD
if (SYS_IND(p) == LINUX_RAID_PARTITION) {
md_autodetect_dev(MKDEV(hd->major,current_minor));
}
@@ -448,7 +448,7 @@
continue;
add_gd_partition(hd, minor, first_sector+START_SECT(p)*sector_size,
NR_SECTS(p)*sector_size);
-#if CONFIG_BLK_DEV_MD && CONFIG_AUTODETECT_RAID
+#if CONFIG_BLK_DEV_MD
if (SYS_IND(p) == LINUX_RAID_PARTITION) {
md_autodetect_dev(MKDEV(hd->major,minor));
}
--- linux/include/linux/raid/md_u.h.orig Tue Nov 14 22:16:37 2000
+++ linux/include/linux/raid/md_u.h Mon Jan 29 23:41:53 2001
@@ -22,6 +22,7 @@
#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13)
+#define RAID_AUTORUN _IO (MD_MAJOR, 0x14)

/* configuration */
#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20)
--- linux/drivers/md/md.c.orig Mon Dec 11 22:19:35 2000
+++ linux/drivers/md/md.c Mon Jan 29 23:42:53 2001
@@ -2033,68 +2033,65 @@
struct {
int set;
int noautodetect;
+} raid_setup_args md__initdata;

-} raid_setup_args md__initdata = { 0, 0 };
-
-void md_setup_drive(void) md__init;
+void md_setup_drive (void) md__init;

/*
* Searches all registered partitions for autorun RAID arrays
* at boot time.
*/
-#ifdef CONFIG_AUTODETECT_RAID
-static int detected_devices[128] md__initdata = { 0, };
-static int dev_cnt=0;
+static int detected_devices[128] md__initdata;
+static int dev_cnt;
+
void md_autodetect_dev(kdev_t dev)
{
if (dev_cnt >= 0 && dev_cnt < 127)
detected_devices[dev_cnt++] = dev;
}
-#endif

-int md__init md_run_setup(void)
+
+static void autostart_arrays (void)
{
-#ifdef CONFIG_AUTODETECT_RAID
mdk_rdev_t *rdev;
int i;

- if (raid_setup_args.noautodetect)
- printk(KERN_INFO "skipping autodetection of RAID arrays\n");
- else {
-
- printk(KERN_INFO "autodetecting RAID arrays\n");
+ printk(KERN_INFO "autodetecting RAID arrays\n");

- for (i=0; i<dev_cnt; i++) {
- kdev_t dev = detected_devices[i];
+ for (i=0; i<dev_cnt; i++) {
+ kdev_t dev = detected_devices[i];

- if (md_import_device(dev,1)) {
- printk(KERN_ALERT "could not import %s!\n",
- partition_name(dev));
- continue;
- }
- /*
- * Sanity checks:
- */
- rdev = find_rdev_all(dev);
- if (!rdev) {
- MD_BUG();
- continue;
- }
- if (rdev->faulty) {
- MD_BUG();
- continue;
- }
- md_list_add(&rdev->pending, &pending_raid_disks);
+ if (md_import_device(dev,1)) {
+ printk(KERN_ALERT "could not import %s!\n",
+ partition_name(dev));
+ continue;
}
-
- autorun_devices(-1);
+ /*
+ * Sanity checks:
+ */
+ rdev = find_rdev_all(dev);
+ if (!rdev) {
+ MD_BUG();
+ continue;
+ }
+ if (rdev->faulty) {
+ MD_BUG();
+ continue;
+ }
+ md_list_add(&rdev->pending, &pending_raid_disks);
}

+ autorun_devices(-1);
+}
+
+int md__init md_run_setup(void)
+{
+ if (raid_setup_args.noautodetect)
+ 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 */
-#endif
-#ifdef CONFIG_MD_BOOT
md_setup_drive();
-#endif
return 0;
}

@@ -2558,6 +2555,11 @@
md_print_devices();
goto done_unlock;

+ case RAID_AUTORUN:
+ err = 0;
+ autostart_arrays();
+ goto done;
+
case BLKGETSIZE: /* Return device size */
if (!arg) {
err = -EINVAL;
@@ -3639,14 +3641,12 @@
return (0);
}

-#ifdef CONFIG_MD_BOOT
-#define MAX_MD_BOOT_DEVS 8
-struct {
- unsigned long set;
- int pers[MAX_MD_BOOT_DEVS];
- int chunk[MAX_MD_BOOT_DEVS];
- kdev_t devices[MAX_MD_BOOT_DEVS][MD_SB_DISKS];
-} md_setup_args md__initdata = { 0, };
+static struct {
+ char device_set [MAX_MD_DEVS];
+ int pers[MAX_MD_DEVS];
+ int chunk[MAX_MD_DEVS];
+ kdev_t devices[MAX_MD_DEVS][MD_SB_DISKS];
+} md_setup_args md__initdata;

/*
* Parse the command-line parameters given our kernel, but do not
@@ -3676,10 +3676,10 @@
printk("md: Too few arguments supplied to md=.\n");
return 0;
}
- if (minor >= MAX_MD_BOOT_DEVS) {
+ if (minor >= MAX_MD_DEVS) {
printk ("md: Minor device number too high.\n");
return 0;
- } else if (md_setup_args.set & (1 << minor)) {
+ } else if (md_setup_args.device_set[minor]) {
printk ("md: Warning - md=%d,... has been specified twice;\n"
" will discard the first definition.\n", minor);
}
@@ -3737,7 +3737,7 @@
printk ("md: Will configure md%d (%s) from %s, below.\n",
minor, pername, devnames);
md_setup_args.devices[minor][i] = (kdev_t) 0;
- md_setup_args.set |= (1 << minor);
+ md_setup_args.device_set[minor] = 1;
return 1;
}

@@ -3747,10 +3747,11 @@
kdev_t dev;
mddev_t*mddev;

- for (minor = 0; minor < MAX_MD_BOOT_DEVS; minor++) {
+ for (minor = 0; minor < MAX_MD_DEVS; minor++) {
mdu_disk_info_t dinfo;
- int err=0;
- if (!(md_setup_args.set & (1 << minor)))
+
+ int err = 0;
+ if (!md_setup_args.device_set[minor])
continue;
printk("md: Loading md%d.\n", minor);
if (mddev_map[minor].mddev) {
@@ -3776,7 +3777,7 @@
ainfo.layout = 0;
ainfo.chunk_size = md_setup_args.chunk[minor];
err = set_array_info(mddev, &ainfo);
- for (i=0; !err && (dev = md_setup_args.devices[minor][i]); i++) {
+ for (i = 0; !err && (dev = md_setup_args.devices[minor][i]); i++) {
dinfo.number = i;
dinfo.raid_disk = i;
dinfo.state = (1<<MD_DISK_ACTIVE)|(1<<MD_DISK_SYNC);
@@ -3807,7 +3808,6 @@
}

__setup("md=", md_setup);
-#endif

#ifdef MODULE
int init_module (void)
@@ -3859,9 +3859,7 @@
#endif

__initcall(md_init);
-#if defined(CONFIG_AUTODETECT_RAID) || defined(CONFIG_MD_BOOT)
__initcall(md_run_setup);
-#endif

MD_EXPORT_SYMBOL(md_size);
MD_EXPORT_SYMBOL(register_md_personality);
--- linux/drivers/md/Config.in.orig Mon Oct 2 21:00:07 2000
+++ linux/drivers/md/Config.in Mon Jan 29 23:41:53 2001
@@ -11,10 +11,6 @@
dep_tristate ' RAID-0 (striping) mode' CONFIG_MD_RAID0 $CONFIG_BLK_DEV_MD
dep_tristate ' RAID-1 (mirroring) mode' CONFIG_MD_RAID1 $CONFIG_BLK_DEV_MD
dep_tristate ' RAID-4/RAID-5 mode' CONFIG_MD_RAID5 $CONFIG_BLK_DEV_MD
-if [ "$CONFIG_MD_LINEAR" = "y" -o "$CONFIG_MD_RAID0" = "y" -o "$CONFIG_MD_RAID1" = "y" -o "$CONFIG_MD_RAID5" = "y" ]; then
- bool ' Boot support' CONFIG_MD_BOOT
- bool ' Auto Detect support' CONFIG_AUTODETECT_RAID
-fi

dep_tristate ' Logical volume manager (LVM) support' CONFIG_BLK_DEV_LVM $CONFIG_MD
dep_mbool ' LVM information in proc filesystem' CONFIG_LVM_PROC_FS $CONFIG_BLK_DEV_LVM
--- linux/Documentation/Configure.help.orig Mon Jan 29 23:43:55 2001
+++ linux/Documentation/Configure.help Mon Jan 29 23:44:02 2001
@@ -1565,20 +1565,6 @@

If unsure, say Y.

-RAID Boot support
-CONFIG_MD_BOOT
- To boot with an initial raid volume (any type) you can select
- autodetect, or answer Y here and appropriate options to the kernel
- at boot time.
- For lilo and loadlin options see the file Documentation/md.txt.
-
-RAID AutoDetect support
-CONFIG_AUTODETECT_RAID
- An alternative to "Raid Boot support" is autodetect support.
- With this selected, any partitons of type 0xFD will be considered for
- inclusion in a RAID array. Information in the RAID-superblock on
- the partition will determine how it is included.
-
Support for Acer PICA 1 chipset
CONFIG_ACER_PICA_61
This is a machine with a R4400 133/150 MHz CPU. To compile a Linux
--- linux/mo.debug.orig Mon Jan 29 23:44:29 2001
+++ linux/mo.debug Mon Jan 29 23:44:29 2001
@@ -0,0 +1 @@
+
--- linux/mo.orig Mon Jan 29 23:44:29 2001
+++ linux/mo Mon Jan 29 23:44:29 2001
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+(time make -j10 modules 2>&1 | tee e)
+if [ "$?" = "0" ]; then
+ echo no compilation errors ...
+#su -c ./d
+else
+ echo 'compilation ERRORS!'
+fi
+cat e >> .e.log
\
 
 \ /
  Last update: 2005-03-22 13:25    [from the cache]
©2003-2011 Jasper Spaans