mdadm-1.2.0

This commit is contained in:
Neil Brown 2003-03-12 22:24:39 +00:00
parent d013a55e94
commit 56eedc1a3f
13 changed files with 169 additions and 52 deletions

36
ANNOUNCE-1.2.0 Normal file
View File

@ -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

View 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;

View File

@ -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

View File

@ -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);

View File

@ -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:

View File

@ -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"

5
TODO
View File

@ -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
---------

View File

@ -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

10
mdadm.8
View File

@ -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

20
mdadm.c
View File

@ -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);

View 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=

View File

@ -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[];

View 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/