Grow: accept --assume-clean with --grow --size
When an array is resized to have larger members, --assume-clean will disable any resync if the kernel supports it (2.6.40 and later). Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
ab80e597ba
commit
ce52f92f04
10
Grow.c
10
Grow.c
|
@ -1293,7 +1293,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
|
||||||
long long size,
|
long long size,
|
||||||
int level, char *layout_str, int chunksize, int raid_disks,
|
int level, char *layout_str, int chunksize, int raid_disks,
|
||||||
struct mddev_dev *devlist,
|
struct mddev_dev *devlist,
|
||||||
int force)
|
int assume_clean, int force)
|
||||||
{
|
{
|
||||||
/* Make some changes in the shape of an array.
|
/* Make some changes in the shape of an array.
|
||||||
* The kernel must support the change.
|
* The kernel must support the change.
|
||||||
|
@ -1491,6 +1491,14 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
|
||||||
rv = 1;
|
rv = 1;
|
||||||
goto release;
|
goto release;
|
||||||
}
|
}
|
||||||
|
if (assume_clean) {
|
||||||
|
/* This will fail on kernels newer than 2.6.40 unless
|
||||||
|
* a backport has been arranged.
|
||||||
|
*/
|
||||||
|
if (sra == NULL ||
|
||||||
|
sysfs_set_str(sra, NULL, "resync_start", "none") < 0)
|
||||||
|
fprintf(stderr, Name ": --assume-clean not support with --grow on this kernel\n");
|
||||||
|
}
|
||||||
ioctl(fd, GET_ARRAY_INFO, &array);
|
ioctl(fd, GET_ARRAY_INFO, &array);
|
||||||
size = get_component_size(fd)/2;
|
size = get_component_size(fd)/2;
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
|
|
|
@ -702,6 +702,13 @@ with zeros before creation the operator knows the array is
|
||||||
actually clean. If that is the case, such as after running
|
actually clean. If that is the case, such as after running
|
||||||
badblocks, this argument can be used to tell mdadm the
|
badblocks, this argument can be used to tell mdadm the
|
||||||
facts the operator knows.
|
facts the operator knows.
|
||||||
|
.IP
|
||||||
|
When an array is resized to a larger size with
|
||||||
|
.B "\-\-grow \-\-size="
|
||||||
|
the new space is normally resynced in that same way that the whole
|
||||||
|
array is resynced at creation. From Linux version 2.6.40,
|
||||||
|
.B \-\-assume\-clean
|
||||||
|
can be used with that command to avoid the automatic resync.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR \-\-backup\-file=
|
.BR \-\-backup\-file=
|
||||||
|
|
3
mdadm.c
3
mdadm.c
|
@ -542,6 +542,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
case O(CREATE,AssumeClean):
|
case O(CREATE,AssumeClean):
|
||||||
case O(BUILD,AssumeClean): /* assume clean */
|
case O(BUILD,AssumeClean): /* assume clean */
|
||||||
|
case O(GROW,AssumeClean):
|
||||||
assume_clean = 1;
|
assume_clean = 1;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1637,7 +1638,7 @@ int main(int argc, char *argv[])
|
||||||
rv = Grow_reshape(devlist->devname, mdfd, quiet, backup_file,
|
rv = Grow_reshape(devlist->devname, mdfd, quiet, backup_file,
|
||||||
size, level, layout_str, chunk, raiddisks,
|
size, level, layout_str, chunk, raiddisks,
|
||||||
devlist->next,
|
devlist->next,
|
||||||
force);
|
assume_clean, force);
|
||||||
} else if (array_size < 0)
|
} else if (array_size < 0)
|
||||||
fprintf(stderr, Name ": no changes to --grow\n");
|
fprintf(stderr, Name ": no changes to --grow\n");
|
||||||
break;
|
break;
|
||||||
|
|
2
mdadm.h
2
mdadm.h
|
@ -1013,7 +1013,7 @@ extern int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
|
||||||
long long size,
|
long long size,
|
||||||
int level, char *layout_str, int chunksize, int raid_disks,
|
int level, char *layout_str, int chunksize, int raid_disks,
|
||||||
struct mddev_dev *devlist,
|
struct mddev_dev *devlist,
|
||||||
int force);
|
int assume_clean, int force);
|
||||||
extern int Grow_restart(struct supertype *st, struct mdinfo *info,
|
extern int Grow_restart(struct supertype *st, struct mdinfo *info,
|
||||||
int *fdlist, int cnt, char *backup_file, int verbose);
|
int *fdlist, int cnt, char *backup_file, int verbose);
|
||||||
extern int Grow_continue(int mdfd, struct supertype *st,
|
extern int Grow_continue(int mdfd, struct supertype *st,
|
||||||
|
|
Loading…
Reference in New Issue