Support --assume-clean for --create

Signed-off-by: Neil Brown <neilb@suse.de>
This commit is contained in:
Neil Brown 2005-12-05 05:54:48 +00:00
parent c06487ce20
commit 47d79ef8e5
5 changed files with 13 additions and 7 deletions

View File

@ -9,6 +9,7 @@ Changes Prior to this release
depending on context.
- Allow scanning of devices listed in /proc/partitions even
if they don't appear in /dev.
- Support --assume-clean in --create mode as well as --build
Changes Prior to 2.1 release
- Fix assembling of raid10 array when devices are missing.

View File

@ -35,7 +35,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
int chunk, int level, int layout, unsigned long size, int raiddisks, int sparedisks,
char *name,
int subdevs, mddev_dev_t devlist,
int runstop, int verbose, int force,
int runstop, int verbose, int force, int assume_clean,
char *bitmap_file, int bitmap_chunk, int write_behind, int delay)
{
/*
@ -288,7 +288,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
* as missing, so that a reconstruct happens (faster than re-parity)
* FIX: Can we do this for raid6 as well?
*/
if (force == 0 && first_missing >= raiddisks) {
if (assume_clean==0 && force == 0 && first_missing >= raiddisks) {
switch ( level ) {
case 5:
insert_point = raiddisks-1;
@ -318,6 +318,8 @@ int Create(struct supertype *st, char *mddev, int mdfd,
(insert_point < raiddisks || first_missing < raiddisks) )
||
( level == 6 && missing_disks == 2)
||
assume_clean
)
array.state = 1; /* clean, but one+ drive will be missing */
else

View File

@ -476,9 +476,12 @@ which means to choose the largest size that fits on all current drives.
.BR --assume-clean
Tell
.I mdadm
that the array pre-existed and is known to be clean. This is only
really useful for Building RAID1 array. Only use this if you really
know what you are doing. This is currently only supported for --build.
that the array pre-existed and is known to be clean. It can be useful
when trying to recover from a major failure as you can be sure that no
data will be affected unless you actually write to the array. It can
also be used when creating a RAID1 or RAID10 if you want to avoid the
initial resync, however this practice - while normally safe - is not
recommended. Use this ony if you really know what you are doing.
.TP
.BR -N ", " --name=

View File

@ -1002,7 +1002,7 @@ int main(int argc, char *argv[])
rv = Create(ss, devlist->devname, mdfd, chunk, level, layout, size<0 ? 0 : size,
raiddisks, sparedisks, ident.name,
devs_found-1, devlist->next, runstop, verbose-quiet, force,
devs_found-1, devlist->next, runstop, verbose-quiet, force, assume_clean,
bitmap_file, bitmap_chunk, write_behind, delay);
break;
case MISC:

View File

@ -250,7 +250,7 @@ extern int Create(struct supertype *st, char *mddev, int mdfd,
int chunk, int level, int layout, unsigned long size, int raiddisks, int sparedisks,
char *name,
int subdevs, mddev_dev_t devlist,
int runstop, int verbose, int force,
int runstop, int verbose, int force, int assume_clean,
char *bitmap_file, int bitmap_chunk, int write_behind, int delay);
extern int Detail(char *dev, int brief, int test);