mdadm-0.8.2

This commit is contained in:
Neil Brown 2002-04-11 01:36:14 +00:00
parent c913b90e6d
commit b83d95f362
15 changed files with 74 additions and 55 deletions

View File

@ -1,4 +1,9 @@
Changes Prior to this release
- Correct spelling of persist[ae]nce/persist[ae]nt.
- Change "disk" to "device" in options and config file
- convert array size to "long long" *before* shift-left in -D and -Q
Changes Prior to 0.8.1 release
- Add "INSTALL" file.
- Fix some "i" variables that were not being set properly
- Initialise minsize and maxsize so that compilers don't complain.

View File

@ -77,22 +77,22 @@ int Create(char *mddev, int mdfd,
}
if (raiddisks < 1) {
fprintf(stderr,
Name ": a number of --raid-disks must be given to create an array\n");
Name ": a number of --raid-devices must be given to create an array\n");
return 1;
}
if (raiddisks < 2 && level >= 4) {
fprintf(stderr,
Name ": atleast 2 raid-disks needed for level 4 or 5\n");
Name ": atleast 2 raid-devices needed for level 4 or 5\n");
return 1;
}
if (raiddisks+sparedisks > MD_SB_DISKS) {
fprintf(stderr,
Name ": too many discs requested: %d+%d > %d\n",
Name ": too many devices requested: %d+%d > %d\n",
raiddisks, sparedisks, MD_SB_DISKS);
return 1;
}
if (subdevs > raiddisks+sparedisks) {
fprintf(stderr, Name ": You have listed more disks (%d) than are in the array(%d)!\n", subdevs, raiddisks+sparedisks);
fprintf(stderr, Name ": You have listed more devices (%d) than are in the array(%d)!\n", subdevs, raiddisks+sparedisks);
return 1;
}
if (subdevs < raiddisks+sparedisks) {
@ -325,7 +325,7 @@ int Create(char *mddev, int mdfd,
}
fprintf(stderr, Name ": array %s started.\n", mddev);
} else {
fprintf(stderr, Name ": not starting array - not enough discs.\n");
fprintf(stderr, Name ": not starting array - not enough devices.\n");
}
return 0;
}

View File

@ -79,7 +79,7 @@ int Detail(char *dev, int brief)
/* Ok, we have some info to print... */
c = map_num(pers, array.level);
if (brief)
printf("ARRAY %s level=%s disks=%d", dev, c?c:"-unknown-",array.raid_disks );
printf("ARRAY %s level=%s num-devices=%d", dev, c?c:"-unknown-",array.raid_disks );
else {
unsigned long array_size;
unsigned long long larray_size;
@ -88,8 +88,11 @@ int Detail(char *dev, int brief)
;
else
#endif
if (ioctl(fd, BLKGETSIZE, &array_size)==0)
larray_size = array_size<<9;
if (ioctl(fd, BLKGETSIZE, &array_size)==0) {
larray_size = array_size;
larray_size <<= 9;
}
else larray_size = 0;
printf("%s:\n", dev);
@ -102,10 +105,10 @@ int Detail(char *dev, int brief)
printf(" Array Size : %ld%s\n", (long)(larray_size>>10), human_size(larray_size));
if (array.level >= 1)
printf(" Device Size : %d%s\n", array.size, human_size((long long)array.size<<10));
printf(" Raid Disks : %d\n", array.raid_disks);
printf(" Total Disks : %d\n", array.nr_disks);
printf(" Raid Devices : %d\n", array.raid_disks);
printf(" Total Devices : %d\n", array.nr_disks);
printf("Preferred Minor : %d\n", array.md_minor);
printf(" Persistance : Superblock is %spersistant\n",
printf(" Persistence : Superblock is %spersistent\n",
array.not_persistent?"not ":"");
printf("\n");
atime = array.utime;
@ -113,10 +116,10 @@ int Detail(char *dev, int brief)
printf(" State : %s, %serrors\n",
(array.state&(1<<MD_SB_CLEAN))?"clean":"dirty",
(array.state&(1<<MD_SB_ERRORS))?"":"no-");
printf(" Active Drives : %d\n", array.active_disks);
printf(" Working Drives : %d\n", array.working_disks);
printf(" Failed Drives : %d\n", array.failed_disks);
printf(" Spare Drives : %d\n", array.spare_disks);
printf(" Active Devices : %d\n", array.active_disks);
printf("Working Devices : %d\n", array.working_disks);
printf(" Failed Devices : %d\n", array.failed_disks);
printf(" Spare Devices : %d\n", array.spare_disks);
printf("\n");
if (array.level == 5) {
c = map_num(r5layout, array.layout);
@ -135,7 +138,7 @@ int Detail(char *dev, int brief)
}
printf("\n");
printf(" Number Major Minor RaidDisk State\n");
printf(" Number Major Minor RaidDevice State\n");
}
for (d= 0; d<MD_SB_DISKS; d++) {
mdu_disk_info_t disk;
@ -143,7 +146,7 @@ int Detail(char *dev, int brief)
disk.number = d;
if (ioctl(fd, GET_DISK_INFO, &disk) < 0) {
if (d < array.raid_disks)
fprintf(stderr, Name ": cannot get disk detail for disk %d: %s\n",
fprintf(stderr, Name ": cannot get device detail for device %d: %s\n",
d, strerror(errno));
continue;
}

View File

@ -145,8 +145,8 @@ int Examine(mddev_dev_t devlist, int brief, int scan)
c=map_num(pers, super.level);
printf(" Raid Level : %s\n", c?c:"-unknown-");
printf(" Device Size : %d%s\n", super.size, human_size((long long)super.size<<10));
printf(" Raid Disks : %d\n", super.raid_disks);
printf(" Total Disks : %d\n", super.nr_disks);
printf(" Raid Devices : %d\n", super.raid_disks);
printf(" Total Devices : %d\n", super.nr_disks);
printf("Preferred Minor : %d\n", super.md_minor);
printf("\n");
atime = super.utime;
@ -154,10 +154,10 @@ int Examine(mddev_dev_t devlist, int brief, int scan)
printf(" State : %s, %serrors\n",
(super.state&(1<<MD_SB_CLEAN))?"clean":"dirty",
(super.state&(1<<MD_SB_ERRORS))?"":"no-");
printf(" Active Drives : %d\n", super.active_disks);
printf(" Working Drives : %d\n", super.working_disks);
printf(" Failed Drives : %d\n", super.failed_disks);
printf(" Spare Drives : %d\n", super.spare_disks);
printf(" Active Devices : %d\n", super.active_disks);
printf("Working Devices : %d\n", super.working_disks);
printf(" Failed Devices : %d\n", super.failed_disks);
printf(" Spare Devices : %d\n", super.spare_disks);
if (calc_sb_csum(&super) == super.sb_csum)
printf(" Checksum : %x - correct\n", super.sb_csum);
else
@ -180,7 +180,7 @@ int Examine(mddev_dev_t devlist, int brief, int scan)
default: break;
}
printf("\n");
printf(" Number Major Minor RaidDisk State\n");
printf(" Number Major Minor RaidDevice State\n");
for (d= -1; d<(signed int)(super.raid_disks+super.spare_disks); d++) {
mdp_disk_t *dp;
char *dv;
@ -206,7 +206,7 @@ int Examine(mddev_dev_t devlist, int brief, int scan)
char sep='=';
char *c=map_num(pers, ap->super.level);
char *d;
printf("ARRAY /dev/md%d level=%s disks=%d UUID=",
printf("ARRAY /dev/md%d level=%s num-devices=%d UUID=",
ap->super.md_minor, c?c:"-unknown-", ap->super.raid_disks);
if (ap->super.minor_version >= 90)
printf("%08x:%08x:%08x:%08x", ap->super.set_uuid0, ap->super.set_uuid1,

View File

@ -190,7 +190,7 @@ int Manage_subdevs(char *devname, int fd,
disc.major = MAJOR(stb.st_rdev);
disc.minor = MINOR(stb.st_rdev);
if (ioctl(fd,ADD_NEW_DISK, &disc)) {
fprintf(stderr, Name ": add new disk failed for %s: %s\n",
fprintf(stderr, Name ": add new device failed for %s: %s\n",
dv->devname, strerror(errno));
return 1;
}
@ -211,7 +211,7 @@ int Manage_subdevs(char *devname, int fd,
case 'f': /* set faulty */
/* FIXME check current member */
if (ioctl(fd, SET_DISK_FAULTY, (unsigned long) stb.st_rdev)) {
fprintf(stderr, Name ": set disk faulty failed for %s: %s\n",
fprintf(stderr, Name ": set device faulty failed for %s: %s\n",
dv->devname, strerror(errno));
return 1;
}

View File

@ -378,7 +378,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 sub-device %s.\n\n", disc);
fprintf(mp, "It could be related to componenet device %s.\n\n", disc);
fprintf(mp, "Faithfully yours, etc.\n");
fclose(mp);

View File

@ -71,9 +71,10 @@ int Query(char *dev)
;
else
#endif
if (ioctl(fd, BLKGETSIZE, &array_size)==0)
larray_size = array_size<<9;
else larray_size = 0;
if (ioctl(fd, BLKGETSIZE, &array_size)==0) {
larray_size = array_size;
larray_size <<= 9;
} else larray_size = 0;
}
close(fd);

View File

@ -29,7 +29,7 @@
#include "mdadm.h"
char Version[] = Name " - v0.8.1 - 6 April 2002\n";
char Version[] = Name " - v0.8.2 - 11 April 2002\n";
/*
* File: ReadMe.c
*
@ -115,7 +115,9 @@ struct option long_options[] = {
{"parity", 1, 0, 'p'}, /* {left,right}-{a,}symetric */
{"layout", 1, 0, 'p'},
{"raid-disks",1, 0, 'n'},
{"raid-devices",1, 0, 'n'},
{"spare-disks",1,0, 'x'},
{"spare-devices",1,0, 'x'},
{"size" ,1, 0, 'z'},
/* For assemble */
@ -195,8 +197,8 @@ char Help[] =
" --level= -l : raid level: 0,1,4,5,linear,mp. 0 or linear for build\n"
" --paritiy= -p : raid5 parity algorith: {left,right}-{,a}symmetric\n"
" --layout= : same as --parity\n"
" --raid-disks= -n : number of active devices in array\n"
" --spare-disks= -x : number of spares (eXtras) devices in initial array\n"
" --raid-devices= -n : number of active devices in array\n"
" --spare-devices= -x: number of spares (eXtras) devices in initial array\n"
" --size= -z : Size (in K) of each drive in RAID1/4/5 - optional\n"
" --force -f : Honour devices as listed on command line. Don't\n"
" : insert a missing drive for RAID5.\n"
@ -233,7 +235,7 @@ char Help[] =
*/
char Help_create[] =
"Usage: mdadm --create device -chunk=X --level=Y --raid-disks=Z devices\n"
"Usage: mdadm --create device -chunk=X --level=Y --raid-devices=Z devices\n"
"\n"
" This usage will initialise a new md array and associate some\n"
" devices with it. If enough devices are given to complete the array,\n"
@ -259,8 +261,8 @@ char Help_create[] =
" --level= -l : raid level: 0,1,4,5,linear,multipath and synonyms\n"
" --paritiy= -p : raid5 parity algorith: {left,right}-{,a}symmetric\n"
" --layout= : same as --parity\n"
" --raid-disks= -n : number of active devices in array\n"
" --spare-disks= -x : number of spares (eXtras) devices in initial array\n"
" --raid-devices= -n : number of active devices in array\n"
" --spare-devices= -x: number of spares (eXtras) devices in initial array\n"
" --size= -z : Size (in K) of each drive in RAID1/4/5 - optional\n"
" --force -f : Honour devices as listed on command line. Don't\n"
" : insert a missing drive for RAID5.\n"
@ -271,7 +273,7 @@ char Help_create[] =
;
char Help_build[] =
"Usage: mdadm --build device -chunk=X --level=Y --raid-disks=Z devices\n"
"Usage: mdadm --build device -chunk=X --level=Y --raid-devices=Z devices\n"
"\n"
" This usage is similar to --create. The difference is that it creates\n"
" a legacy array without a superblock. With these arrays there is no\n"
@ -285,7 +287,7 @@ char Help_build[] =
" --chunk= -c : chunk size of kibibytes\n"
" --rounding= : rounding factor for linear array (==chunck size)\n"
" --level= -l : 0, raid0, or linear\n"
" --raid-disks= -n : number of active devices in array\n"
" --raid-devices= -n : number of active devices in array\n"
;
char Help_assemble[] =

2
TODO
View File

@ -1,4 +1,6 @@
Document "missing"
?? Allow -S /dev/md? - current complains subsequent not a/d/r - DONE

View File

@ -29,6 +29,7 @@
#include "mdadm.h"
#include "dlink.h"
#include <sys/dir.h>
#include <glob.h>
#include <fnmatch.h>
@ -285,6 +286,9 @@ void arrayline(char *line)
} else if (strncasecmp(w, "disks=", 6) == 0 ) {
/* again, for compat */
mis.raid_disks = atoi(w+6);
} else if (strncasecmp(w, "num-devices=", 12) == 0 ) {
/* again, for compat */
mis.raid_disks = atoi(w+12);
} else {
fprintf(stderr, Name ": unrecognised word on ARRAY line: %s\n",
w);

10
mdadm.8
View File

@ -209,12 +209,12 @@ Set raid5 parity algorithm. Options are:
same as --parity
.TP
.BR -n ", " --raid-disks=
.BR -n ", " --raid-devices=
number of active devices in array.
.TP
.BR -x ", " --spare-disks=
number of spare (eXtra) disks in initial array. Spares can be added
.BR -x ", " --spare-devices=
number of spare (eXtra) devices in initial array. Spares can be added
and removed later.
.TP
@ -381,7 +381,7 @@ Usage:
.I device
.BI --chunk= X
.BI --level= Y
.BI --raid-disks= Z
.BI --raid-devices= Z
.I devices
.PP
@ -404,7 +404,7 @@ Usage:
.BI --chunk= X
.BI --level= Y
.br
.BI --raid-disks= Z
.BI --raid-devices= Z
.I devices
.PP

14
mdadm.c
View File

@ -267,7 +267,7 @@ int main(int argc, char *argv[])
exit(2);
}
if (sparedisks > 0 && level < 1 && level >= -1) {
fprintf(stderr, Name ": raid level %s is incompatible with spare-disks setting.\n",
fprintf(stderr, Name ": raid level %s is incompatible with spare-devices setting.\n",
optarg);
exit(2);
}
@ -303,13 +303,13 @@ int main(int argc, char *argv[])
case O(CREATE,'n'):
case O(BUILD,'n'): /* number of raid disks */
if (raiddisks) {
fprintf(stderr, Name ": raid-disks set twice: %d and %s\n",
fprintf(stderr, Name ": raid-devices set twice: %d and %s\n",
raiddisks, optarg);
exit(2);
}
raiddisks = strtol(optarg, &c, 10);
if (!optarg[0] || *c || raiddisks<=0 || raiddisks > MD_SB_DISKS) {
fprintf(stderr, Name ": invalid number of raid disks: %s\n",
fprintf(stderr, Name ": invalid number of raid devices: %s\n",
optarg);
exit(2);
}
@ -318,18 +318,18 @@ int main(int argc, char *argv[])
case O(CREATE,'x'): /* number of spare (eXtra) discs */
if (sparedisks) {
fprintf(stderr,Name ": spare-disks set twice: %d and %s\n",
fprintf(stderr,Name ": spare-devices set twice: %d and %s\n",
sparedisks, optarg);
exit(2);
}
if (level > -10 && level <= 0 && level >= -1) {
fprintf(stderr, Name ": spare-disks setting is incompatible with raid level %d\n",
fprintf(stderr, Name ": spare-devices setting is incompatible with raid level %d\n",
level);
exit(2);
}
sparedisks = strtol(optarg, &c, 10);
if (!optarg[0] || *c || sparedisks < 0 || sparedisks > MD_SB_DISKS - raiddisks) {
fprintf(stderr, Name ": invalid number of spare disks: %s\n",
fprintf(stderr, Name ": invalid number of spare-devices: %s\n",
optarg);
exit(2);
}
@ -595,7 +595,7 @@ int main(int argc, char *argv[])
fprintf(stderr, Name ": No devices listed in %s\n", configfile?configfile:DefaultConfFile);
exit(1);
}
rv = Examine(devlist, devlist?brief:!verbose, scan);
rv = Examine(devlist, scan?!verbose:brief, scan);
} else {
if (devlist == NULL) {
if ((devmode == 'S' ||devmode=='D') && scan) {

View File

@ -90,8 +90,8 @@ identify an array, but is supported so that the output of
can be use directly in the configuration file.
.TP
.B disks=
The value is the number of disks in a complete active array. As with
.B num-devices=
The value is the number of devices in a complete active array. As with
.B level=
this is mainly for compatibility with the output of

View File

@ -1,6 +1,6 @@
Summary: mdadm is used for controlling Linux md devices (aka RAID arrays)
Name: mdadm
Version: 0.8.1
Version: 0.8.2
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/
@ -20,6 +20,8 @@ some common tasks).
%prep
%setup -q
# we want to install in /sbin, not /usr/sbin...
%define _exec_prefix %{nil}
%build
# This is a debatable issue. The author of this RPM spec file feels that

2
util.c
View File

@ -317,7 +317,7 @@ int check_raid(int fd, char *name)
fprintf(stderr, Name ": %s appear to be part of a raid array:\n",
name);
crtime = super.ctime;
fprintf(stderr, " level=%d disks=%d ctime=%s",
fprintf(stderr, " level=%d devices=%d ctime=%s",
super.level, super.raid_disks, ctime(&crtime));
return 1;
}