]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm-1.2.0 mdadm-1.2.0
authorNeil Brown <neilb@suse.de>
Wed, 12 Mar 2003 22:24:39 +0000 (22:24 +0000)
committerNeil Brown <neilb@suse.de>
Wed, 12 Mar 2003 22:24:39 +0000 (22:24 +0000)
13 files changed:
ANNOUNCE-1.2.0 [new file with mode: 0644]
Assemble.c
ChangeLog
Monitor.c
Query.c
ReadMe.c
TODO
makedist
mdadm.8
mdadm.c
mdadm.conf.5
mdadm.h
mdadm.spec

diff --git a/ANNOUNCE-1.2.0 b/ANNOUNCE-1.2.0
new file mode 100644 (file)
index 0000000..c3bad8d
--- /dev/null
@@ -0,0 +1,36 @@
+Subject: ANNOUNCE: mdadm 1.2.0 - A tool for managing Soft RAID under Linux
+
+
+I am pleased to announce the availability of 
+   mdadm version 1.2.0
+It is available at
+   http://www.cse.unsw.edu.au/~neilb/source/mdadm/
+and
+   http://www.{countrycode}.kernel.org/pub/utils/raid/mdadm/
+
+as a source tar-ball and (at the first site) as an SRPM, and as an RPM for i386.
+
+mdadm is a tool for creating, managing and monitoring
+device arrays using the "md" driver in Linux, also
+known as Software RAID arrays.
+
+Release 1.2.0 is a bug-fix release over 1.1.0.
+
+    -   Fix bug where --daemonise required an argument.
+    -   In --assemble --verbose, print appropriate message if device is
+        not in devices= list
+    -   Updated mdadm.conf.5 to reflect fact that device= takes wildcards
+    -   Typos:  componenet -> component
+    -   Reduce size of "--help" message put excess into "--help-options"
+    -   Fix bug introduced when MD_SB_DISKS dependancy removed, and which
+        caused spares not be assembled properly.
+    -   Print appropriate message if --monitor --scan decides not to
+       monitor anything.  
+
+
+Development of mdadm is sponsored by CSE@UNSW: 
+  The School of Computer Science and Engineering
+at
+  The University of New South Wales
+
+NeilBrown  13/03/03
index 4a747ca3f722b0db1546523ec698a515dcf290c3..96e9ebe840b726965b485243328b5cc8a2caaad7 100644 (file)
@@ -106,7 +106,8 @@ int Assemble(char *mddev, int mdfd,
                int state;
                int raid_disk;
        } *devices;
-       int *best; /* indexed by raid_disk */
+       int *best = NULL; /* indexed by raid_disk */
+       int bestcnt = 0;
        int devcnt = 0, okcnt, sparecnt;
        int i;
        int most_recent = 0;
@@ -184,8 +185,11 @@ int Assemble(char *mddev, int mdfd,
                devlist = devlist->next;
 
                if (ident->devices &&
-                   !match_oneof(ident->devices, devname))
+                   !match_oneof(ident->devices, devname)) {
+                       if (inargv || verbose)
+                               fprintf(stderr, Name ": %s is not one of %s\n", devname, ident->devices);
                        continue;
+               }
                
                dfd = open(devname, O_RDONLY, 0);
                if (dfd < 0) {
@@ -322,11 +326,24 @@ int Assemble(char *mddev, int mdfd,
                        i = devcnt;
                else
                        i = devices[devcnt].raid_disk;
-               if (i>=0 && i < num_devs)
+               if (i>=0 && i < 10000) {
+                       if (i >= bestcnt) {
+                               int newbestcnt = i+10;
+                               int *newbest = malloc(sizeof(int)*newbestcnt);
+                               int c;
+                               for (c=0; c < newbestcnt; c++)
+                                       if (c < bestcnt)
+                                               newbest[c] = best[c];
+                                       else
+                                               newbest[c] = -1;
+                               if (best)free(best);
+                               best = newbest;
+                               bestcnt = newbestcnt;
+                       }
                        if (best[i] == -1
                            || devices[best[i]].events < devices[devcnt].events)
                                best[i] = devcnt;
-
+               }
                devcnt++;
        }
 
@@ -340,7 +357,7 @@ int Assemble(char *mddev, int mdfd,
         */
        okcnt = 0;
        sparecnt=0;
-       for (i=0; i< num_devs ;i++) {
+       for (i=0; i< bestcnt ;i++) {
                int j = best[i];
                int event_margin = !force;
                if (j < 0) continue;
@@ -366,7 +383,7 @@ int Assemble(char *mddev, int mdfd,
                 */
                int fd;
                chosen_drive = -1;
-               for (i=0; i<first_super.raid_disks; i++) {
+               for (i=0; i<first_super.raid_disks && i < bestcnt; i++) {
                        int j = best[i];
                        if (j>=0 &&
                            !devices[j].uptodate &&
@@ -422,7 +439,7 @@ int Assemble(char *mddev, int mdfd,
         * superblock.
         */
        chosen_drive = -1;
-       for (i=0; chosen_drive < 0 && i<num_devs; i++) {
+       for (i=0; chosen_drive < 0 && i<bestcnt; i++) {
                int j = best[i];
                int fd;
                if (j<0)
@@ -444,7 +461,7 @@ int Assemble(char *mddev, int mdfd,
                close(fd);
        }
 
-       for (i=0; i<num_devs; i++) {
+       for (i=0; i<bestcnt; i++) {
                int j = best[i];
                int desired_state;
 
@@ -526,16 +543,16 @@ This doesnt work yet
                        return 1;
                }
                /* First, add the raid disks, but add the chosen one last */
-               for (i=0; i<= num_devs; i++) {
+               for (i=0; i<= bestcnt; i++) {
                        int j;
-                       if (i < num_devs) {
+                       if (i < bestcnt) {
                                j = best[i];
                                if (j == chosen_drive)
                                        continue;
                        } else
                                j = chosen_drive;
 
-                       if (j >= 0 && devices[j].uptodate) {
+                       if (j >= 0 /* && devices[j].uptodate */) {
                                mdu_disk_info_t disk;
                                memset(&disk, 0, sizeof(disk));
                                disk.major = devices[j].major;
index 49021003d070d179017043ff26c118ce31704a5d..e455eeff2405d61f1ea90b6c5903de8fdb5efff5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Changes Prior to 1.2.0 release
+    -   Fix bug where --daemonise required an argument.
+    -   In --assemble --verbose, print appropriate message if device is
+        not in devices= list
+    -   Updated mdadm.conf.5 to reflect fact that device= takes wildcards
+    -   Typos:  componenet -> component
+    -   Reduce size of "--help" message put excess into "--help-options"
+    -   Fix bug introduced when MD_SB_DISKS dependancy removed, and which
+        caused spares not be assembled properly.
+    -   Print appropriate message if --monitor --scan decides not to
+       monitor anything.  
 Changes Prior to 1.1.0 release
     -   add --deamonise flag for --monitor - forks and prints pid to stdout
     -   Fix bug so we REALLY clear dirty flag with -Af
index 282593c69f89c3db6b0e4997019dbce8ac814d15..da73af6f3a7a5b18718771421b64336f530d8e55 100644 (file)
--- a/Monitor.c
+++ b/Monitor.c
@@ -108,17 +108,19 @@ int Monitor(mddev_dev_t devlist,
        if (!mailaddr) {
                mailaddr = conf_get_mailaddr(config);
                if (mailaddr && ! scan)
-                       printf("mdadm: Monitor using email address \"%s\" from config file\n",
+                       fprintf(stderr, Name ": Monitor using email address \"%s\" from config file\n",
                               mailaddr);
        }
        if (!alert_cmd) {
                alert_cmd = conf_get_program(config);
                if (alert_cmd && ! scan)
-                       printf("mdadm: Monitor using program \"%s\" from config file\n",
+                       fprintf(stderr, Name ": Monitor using program \"%s\" from config file\n",
                               alert_cmd);
        }
-       if (scan && !mailaddr && !alert_cmd)
+       if (scan && !mailaddr && !alert_cmd) {
+               fprintf(stderr, Name ": No mail address or alert command - not monitoring.\n");
                return 1;
+       }
 
        if (daemonise) {
                int pid = fork();
@@ -415,7 +417,7 @@ static void alert(char *event, char *dev, char *disc, char *mailaddr, char *cmd)
                        fprintf(mp, "A %s event had been detected on md device %s.\n\n", event, dev);
 
                        if (disc)
-                               fprintf(mp, "It could be related to componenet device %s.\n\n", disc);
+                               fprintf(mp, "It could be related to component device %s.\n\n", disc);
 
                        fprintf(mp, "Faithfully yours, etc.\n");
                        fclose(mp);
diff --git a/Query.c b/Query.c
index ea5bca6e0ab2f4b1f7870773075a534be4b3a93c..07e60479ff37b430e38937342586ae6fdfd94709 100644 (file)
--- a/Query.c
+++ b/Query.c
@@ -101,7 +101,7 @@ int Query(char *dev)
                       dev, strerror(superrno));
                break;
        case 2:
-               printf("%s: is too small to be an md componenet.\n",
+               printf("%s: is too small to be an md component.\n",
                       dev);
                break;
        case 3:
index 3ba1e01c470978aed2274a3753acaf729fea854c..fd16d8a9e910f64e1b4bb4aed0986d738d71a62a 100644 (file)
--- a/ReadMe.c
+++ b/ReadMe.c
@@ -29,7 +29,7 @@
 
 #include "mdadm.h"
 
-char Version[] = Name " - v1.1.0 - 3 Mar 2003\n";
+char Version[] = Name " - v1.2.0 - 13 Mar 2003\n";
 /*
  * File: ReadMe.c
  *
@@ -105,6 +105,7 @@ struct option long_options[] = {
            
     /* after those will normally come the name of the md device */
     {"help",      0, 0, 'h'},
+    {"help-options",0,0,'h'},
     {"version",          0, 0, 'V'},
     {"verbose",   0, 0, 'v'},
 
@@ -146,8 +147,8 @@ struct option long_options[] = {
     {"program",   1, 0, 'p'},
     {"alert",     1, 0, 'p'},
     {"delay",     1, 0, 'd'},
-    {"daemonise", 1, 0, 'f'},
-    {"daemonize", 1, 0, 'f'},
+    {"daemonise", 0, 0, 'f'},
+    {"daemonize", 0, 0, 'f'},
     
     
     {0, 0, 0, 0}
@@ -167,18 +168,23 @@ char Help[] =
 "       mdadm --monitor options...\n"
 "       mdadm device options...\n"
 " mdadm is used for building, managing, and monitoring\n"
-"      Linux md devices (aka RAID arrays)\n"
-" For detail help on the above major modes use --help after the mode\n"
+" Linux md devices (aka RAID arrays)\n"
+" For detailed help on the above major modes use --help after the mode\n"
 " e.g.\n"
 "         mdadm --assemble --help\n"
-"\n"
+" For general help on options use\n"
+"         mdadm --help-options\n"
+;
+
+char OptionHelp[] =
 "Any parameter that does not start with '-' is treated as a device name\n"
 "The first such name is often the name of an md device.  Subsequent\n"
 "names are often names of component devices."
 "\n"
 "Some common options are:\n"
-"  --help        -h   : This help message or, after above option,\n"
+"  --help        -h   : General help message or, after above option,\n"
 "                       mode specific help message\n"
+"  --help-options     : This help message\n"
 "  --version     -V   : Print version information for mdadm\n"
 "  --verbose     -v   : Be more verbose about what is happening\n"
 "  --brief       -b   : Be less verbose, more brief\n"
diff --git a/TODO b/TODO
index feb8a11a7c638ccb16599711d5777cf0f614b622..646095f8be09f6e91f39ceec130427cd3dbd7020 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,3 +1,6 @@
+* Maybe make "--help" fit in 80x24 and have a --long-help with more info. DONE
+
+
 * maybe "missing" instead of <bold>missing</> in doco DONE
 * possibly wait for resync to start, or even finish while assembling.- NO
 
@@ -90,7 +93,7 @@ umount /tmp
 
 - mdadm -S /dev/md0 /dev/md1 gives internal error FIXED
 
-- mdadm --detail --scan print summary of what it can find?
+- mdadm --detail --scan print summary of what it can find? DONE
 
 
 ---------
index 8b01af9caec9b4a9e9245873f36c5b1d8b5aa613..63d958b97abfd37c018607ae1cebfe931545528e 100755 (executable)
--- a/makedist
+++ b/makedist
@@ -1,6 +1,6 @@
 #!/bin/sh
-
-target=${1-~/public_html/source/mdadm}
+arg=$1
+target=~/public_html/source/mdadm
 if [ -d $target ]
 then :
 else echo $target is not a directory
@@ -8,23 +8,53 @@ else echo $target is not a directory
 fi
 set `grep '^char Version' ReadMe.c `
 version=`echo $7 | sed 's/v//'`
+grep "^.TH MDADM 8 .. v$version" mdadm.8 > /dev/null 2>&1 ||
+ {
+   echo mdadm.8 does not mention verion $version.
+   exit 1
+ }
 grep "^Version: *$version$" mdadm.spec > /dev/null 2>&1 || 
  {
    echo mdadm.spec does not mention version $version.
    exit 1
  }
+if [ -f ANNOUNCE-$version ]
+then :
+else
+   echo ANNONCE-$version does not exist
+   exit 1
+fi
+
 echo version = $version
 base=mdadm-$version.tgz
-if [ -f $target/$base ] 
-then 
-  echo $target/$base exists.
-  exit 1
-fi
-trap "rm $target/$base; exit" 1 2 3
-( cd .. ; ln -s mdadm mdadm-$version ; tar chvf - --exclude="TAGS" --exclude='*,v' --exclude='*.o' --exclude mdadm --exclude=mdadm'.[^ch0-9]' --exclude=RCS mdadm-$version ; rm mdadm-$version ) | gzip --best > $target/$base
-chmod a+r $target/$base
-ls -l $target/$base
+if [ " $arg" != " diff" ]
+then
+  if [ -f $target/$base ] 
+  then 
+    echo $target/$base exists.
+    exit 1
+  fi
+  trap "rm $target/$base; exit" 1 2 3
+  ( cd .. ; ln -s mdadm mdadm-$version ; tar chvf - --exclude="TAGS" --exclude='*,v' --exclude='*.o' --exclude mdadm --exclude=mdadm'.[^ch0-9]' --exclude=RCS mdadm-$version ; rm mdadm-$version ) | gzip --best > $target/$base
+  chmod a+r $target/$base
+  ls -l $target/$base
 
-rpm -ta $target/$base
-find /home/neilb/src/RPM -name "*mdadm-$version-*" \
- -exec cp {} $target/RPM \;
+  rpm -ta $target/$base
+  find /home/neilb/src/RPM -name "*mdadm-$version-*" \
+     -exec cp {} $target/RPM \;
+  cp ANNOUNCE-$version $target/ANNOUNCE
+  cp ChangeLog $target/ChangeLog
+  scp $target/$base master.kernel.org:/pub/linux/utils/raid/mdadm/mdadm-$version.tar.gz
+  scp $target/ANNOUNCE $target/ChangeLog master.kernel.org:/pub/linux/utils/raid/mdadm/
+else
+  if [ ! -f $target/$base ] 
+  then 
+    echo $target/$base does not exist.
+    exit 1
+  fi
+  ( cd .. ; ln -s mdadm mdadm-$version ; tar chf - --exclude="TAGS" --exclude='*,v' --exclude='*.o' --exclude mdadm --exclude=mdadm'.[^ch0-9]' --exclude=RCS mdadm-$version ; rm mdadm-$version ) | gzip --best > /var/tmp/mdadm-new.tgz
+  mkdir /var/tmp/mdadm-old ; zcat $target/$base | ( cd /var/tmp/mdadm-old ; tar xf - )
+  mkdir /var/tmp/mdadm-new ; zcat /var/tmp/mdadm-new.tgz | ( cd /var/tmp/mdadm-new ; tar xf - )
+  diff -ru /var/tmp/mdadm-old /var/tmp/mdadm-new 
+  rm -rf /var/tmp/mdadm-old /var/tmp/mdadm-new /var/tmp/mdadm-new.tgz
+fi
diff --git a/mdadm.8 b/mdadm.8
index 5511aeccf46589a3f097026ddefc4836e57835ad..a04f7a029c590eebbe97ad70244944339d217758 100644 (file)
--- a/mdadm.8
+++ b/mdadm.8
@@ -1,5 +1,5 @@
 .\" -*- nroff -*-
-.TH MDADM 8 "" v1.1.0
+.TH MDADM 8 "" v1.2.0
 .SH NAME
 mdadm \- manage MD devices
 .I aka
@@ -153,7 +153,13 @@ mode.
 
 .TP
 .BR -h ", " --help
-Display help message or, after above option, mode specific help message.
+Display help message or, after above option, mode specific help
+message.
+
+.TP
+.B --help-options
+Display more detailed help about command line parsing and some commonly
+used options.
 
 .TP
 .BR -V ", " --version
diff --git a/mdadm.c b/mdadm.c
index d86d1a5bf5095d3f63871fd7bfb4645ebd80a55f..5c8e95681cd3cfe1d74974542ae44a2136377aac 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -101,14 +101,18 @@ int main(int argc, char *argv[])
                switch(opt) {
                case 'h':
                        help_text = Help;
-                       switch (mode) {
-                       case ASSEMBLE : help_text = Help_assemble; break;
-                       case BUILD    : help_text = Help_build; break;
-                       case CREATE   : help_text = Help_create; break;
-                       case MANAGE   : help_text = Help_manage; break;
-                       case MISC     : help_text = Help_misc; break;
-                       case MONITOR  : help_text = Help_monitor; break;
-                       }
+                       if (option_index > 0 && 
+                           strcmp(long_options[option_index].name, "help-options")==0)
+                               help_text = OptionHelp;
+                       else
+                               switch (mode) {
+                               case ASSEMBLE : help_text = Help_assemble; break;
+                               case BUILD    : help_text = Help_build; break;
+                               case CREATE   : help_text = Help_create; break;
+                               case MANAGE   : help_text = Help_manage; break;
+                               case MISC     : help_text = Help_misc; break;
+                               case MONITOR  : help_text = Help_monitor; break;
+                               }
                        fputs(help_text,stderr);
                        exit(0);
 
index 90ff6ccbf1ca9d948f61944888cd4c5ff184797d..7b455223b224e6eabcc32134b35d43cdfc621409 100644 (file)
@@ -96,8 +96,10 @@ stored in the superblock when the array was created. When an array is
 created as /dev/mdX, then the minor number X is stored.
 .TP
 .B devices=
-The value is a comma separated list of device names. Precisely these
-devices will be used to assemble the array.  Note that the devices
+The value is a comma separated list of device names or device name
+patterns.
+Only devices with names which match one entry in the list will be used
+to assemble the array.  Note that the devices 
 listed there must also be listed on a DEVICE line.
 .TP
 .B level=
diff --git a/mdadm.h b/mdadm.h
index 37a23fcf7f468aa569ff826da98eb846239afc9e..802c779d7566feac520925def7e5ba403c870a7c 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -69,7 +69,7 @@ enum mode {
 
 extern char short_options[];
 extern struct option long_options[];
-extern char Version[], Usage[], Help[],
+extern char Version[], Usage[], Help[], OptionHelp[],
        Help_create[], Help_build[], Help_assemble[],
        Help_manage[], Help_misc[], Help_monitor[], Help_config[];
 
index a88c62890ae94e6512db8aebc10ad2b0fa4b0254..7da3c3d80202a93c51548b0960e15bd875794b74 100644 (file)
@@ -1,6 +1,6 @@
 Summary:     mdadm is used for controlling Linux md devices (aka RAID arrays)
 Name:        mdadm
-Version:     1.1.0
+Version:     1.2.0
 Release:     1
 Source:      http://www.cse.unsw.edu.au/~neilb/source/mdadm/mdadm-%{version}.tgz
 URL:         http://www.cse.unsw.edu.au/~neilb/source/mdadm/