Merge branch 'master' into devel-3.0

Conflicts:

	Assemble.c
	Incremental.c
	Kill.c
	ReadMe.c
	inventory
	mapfile.c
	mdadm.8
	mdadm.spec
	mdassemble.8
This commit is contained in:
NeilBrown 2008-12-18 16:56:13 +11:00
commit 8a659c3321
7 changed files with 138 additions and 55 deletions

58
ANNOUNCE-2.6.8 Normal file
View File

@ -0,0 +1,58 @@
Subject: ANNOUNCE: mdadm 2.6.8 - A tool for managing Soft RAID under Linux
I am pleased to announce the availability of
mdadm version 2.6.8
It is available at the usual places:
countrycode=xx.
http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://neil.brown.name/mdadm
http://neil.brown.name/git?p=mdadm
mdadm is a tool for creating, managing and monitoring
device arrays using the "md" driver in Linux, also
known as Software RAID arrays.
Release 2.6.8 contains various bug fixes and minor enhancements.
It is possibly that 2.6.8 will be the last release in the 2.x
series and very likely that there will never be a 2.7.
Hopefully 3.0 will be released soon making future development
of 2.6.x unnecessary. However if a need does arise for a 2.6.9
it will be considered.
Changelog Entries:
fix add_dev() handling of broken links
Assemble: allow --force to work even when event counts are 0.
mapfile: fix bug in testing for /var/run/mdadm/
Incremental: change precedence order for autof setting.
Adjust major number testing to allow for extended minor number in 2.6.28
Incremental: allow assembly of foreign array.
Incremental: fix setting of 'autof' flag.
Fix --incremental assembly of partitions arrays.
Fix NULL pointer oops
Fix bad metadata formatting
Allow WRITEMOSTLY to be cleared on --readd using --readwrite.
Remove .UR .UE macros from man page because the don't do what we want.
Grow: Fix linear-growth when devices are not all the same size.
Improve reporting of layout for raid10.
Manage: allow adding device that is just large enough to v1.x array.
Cosmetic cleanup of some messages.
Clean up usage of open()
Add support for distribution specific build extensions
Fix confusing usage in md.4 man page.
Describe the HOMEHOST entry in the mdadm.conf man page.
Some more cleanup of tests.
Add test for stoping and restarting a raid5 reshape.
Add "bitmap=" to "--detail --brief" output when relevant.
Improve error message when mdadm fails to stop an array.
Couple more man page fixes
Add text to man pages suggesting partition type to use for version 1.x metadata.
Italic/bold fixes in man pages.
Fix bug in forced assemble.
Fix an error when assembling arrays that are in the middle of a reshape.
Development of mdadm is sponsored by
SUSE Labs, Novell Inc.
NeilBrown 28th November 2008

View File

@ -890,6 +890,8 @@ int Assemble(struct supertype *st, char *mddev,
continue;
devices[j].i.disk.state = desired_state;
if (!(devices[j].i.array.state & 1))
clean = 0;
if (st->ss->update_super(st, &devices[j].i, "assemble", NULL,
verbose, 0, NULL)) {
@ -1088,6 +1090,20 @@ int Assemble(struct supertype *st, char *mddev,
fprintf(stderr, " and %d spare%s", sparecnt, sparecnt==1?"":"s");
fprintf(stderr, ".\n");
}
if (content->reshape_active &&
content->array.level >= 4 &&
content->array.level <= 6) {
/* might need to increase the size
* of the stripe cache - default is 256
*/
if (256 < 4 * (content->array.chunk_size/4096)) {
struct mdinfo *sra = sysfs_read(mdfd, 0, 0);
if (sra)
sysfs_set_num(sra, NULL,
"stripe_cache_size",
(4 * content->array.chunk_size / 4096) + 1);
}
}
close(mdfd);
wait_for(mddev);
if (auto_assem) {

View File

@ -596,59 +596,6 @@ static int count_active(struct supertype *st, int mdfd, char **availp,
return cnt + cnt1;
}
void RebuildMap(void)
{
struct mdstat_ent *mdstat = mdstat_read(0, 0);
struct mdstat_ent *md;
struct map_ent *map = NULL;
int mdp = get_mdp_major();
for (md = mdstat ; md ; md = md->next) {
struct mdinfo *sra = sysfs_read(-1, md->devnum, GET_DEVS);
struct mdinfo *sd;
for (sd = sra->devs ; sd ; sd = sd->next) {
char dn[30];
int dfd;
int ok;
struct supertype *st;
char *path;
struct mdinfo info;
sprintf(dn, "%d:%d", sd->disk.major, sd->disk.minor);
dfd = dev_open(dn, O_RDONLY);
if (dfd < 0)
continue;
st = guess_super(dfd);
if ( st == NULL)
ok = -1;
else
ok = st->ss->load_super(st, dfd, NULL);
close(dfd);
if (ok != 0)
continue;
st->ss->getinfo_super(st, &info);
if (md->devnum > 0)
path = map_dev(MD_MAJOR, md->devnum, 0);
else
path = map_dev(mdp, (-1-md->devnum)<< 6, 0);
map_add(&map, md->devnum,
info.text_version,
info.uuid, path ? : "/unknown");
st->ss->free_super(st);
break;
}
sysfs_free(sra);
}
map_write(map);
map_free(map);
for (md = mdstat ; md ; md = md->next) {
struct mdinfo *sra = sysfs_read(-1, md->devnum, GET_VERSION);
sysfs_uevent(sra, "change");
sysfs_free(sra);
}
}
int IncrementalScan(int verbose)
{
/* look at every device listed in the 'map' file.

4
Kill.c
View File

@ -44,7 +44,9 @@ int Kill(char *dev, int force, int quiet, int noexcl)
int fd, rv = 0;
struct supertype *st;
fd = open(dev, O_DIRECT | (noexcl ? O_RDWR : (O_RDWR|O_EXCL)));
if (force)
noexcl = 1;
fd = open(dev, O_RDWR|(force ? 0 : O_EXCL));
if (fd < 0) {
if (!quiet)
fprintf(stderr, Name ": Couldn't open %s for write - not zeroing\n",

View File

@ -22,6 +22,7 @@ ANNOUNCE-2.6.4
ANNOUNCE-2.6.5
ANNOUNCE-2.6.6
ANNOUNCE-2.6.7
ANNOUNCE-2.6.8
ANNOUNCE-3.0-devel1
ANNOUNCE-3.0-devel2
Assemble.c

View File

@ -150,6 +150,12 @@ void map_read(struct map_ent **melp)
*melp = NULL;
f = fopen("/var/run/mdadm/map", "r");
if (!f)
f = fopen("/var/run/mdadm.map", "r");
if (!f) {
RebuildMap();
f = fopen("/var/run/mdadm/map", "r");
}
if (!f)
f = fopen("/var/run/mdadm.map", "r");
if (!f)
@ -279,3 +285,56 @@ struct map_ent *map_by_name(struct map_ent **map, char *name)
}
return NULL;
}
void RebuildMap(void)
{
struct mdstat_ent *mdstat = mdstat_read(0, 0);
struct mdstat_ent *md;
struct map_ent *map = NULL;
int mdp = get_mdp_major();
for (md = mdstat ; md ; md = md->next) {
struct mdinfo *sra = sysfs_read(-1, md->devnum, GET_DEVS);
struct mdinfo *sd;
for (sd = sra->devs ; sd ; sd = sd->next) {
char dn[30];
int dfd;
int ok;
struct supertype *st;
char *path;
struct mdinfo info;
sprintf(dn, "%d:%d", sd->disk.major, sd->disk.minor);
dfd = dev_open(dn, O_RDONLY);
if (dfd < 0)
continue;
st = guess_super(dfd);
if ( st == NULL)
ok = -1;
else
ok = st->ss->load_super(st, dfd, NULL);
close(dfd);
if (ok != 0)
continue;
st->ss->getinfo_super(st, &info);
if (md->devnum > 0)
path = map_dev(MD_MAJOR, md->devnum, 0);
else
path = map_dev(mdp, (-1-md->devnum)<< 6, 0);
map_add(&map, md->devnum,
info.text_version,
info.uuid, path ? : "/unknown");
st->ss->free_super(st);
break;
}
sysfs_free(sra);
}
map_write(map);
map_free(map);
for (md = mdstat ; md ; md = md->next) {
struct mdinfo *sra = sysfs_read(-1, md->devnum, GET_VERSION);
sysfs_uevent(sra, "change");
sysfs_free(sra);
}
}

View File

@ -340,7 +340,7 @@ DEVICE /dev/sd[bcdjkl]1
.br
DEVICE /dev/hda1 /dev/hdb1
# /dev/md0 is known by its UID.
# /dev/md0 is known by its UUID.
.br
ARRAY /dev/md0 UUID=3aaa0122:29827cfa:5331ad66:ca767371
.br