Grow: report if a --size change has no effect.

e.g. if "--grow --size=max" doesn't actually change anything, it is
useful to report that.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2011-05-10 11:56:38 +10:00
parent d515d27f60
commit 85f102879f
1 changed files with 14 additions and 4 deletions

18
Grow.c
View File

@ -1437,9 +1437,12 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
/* ========= set size =============== */
if (size >= 0 && (size == 0 || size != array.size)) {
long long orig_size = array.size;
long long orig_size = get_component_size(fd)/2;
struct mdinfo *mdi;
if (orig_size == 0)
orig_size = array.size;
if (reshape_super(st, size, UnSet, UnSet, 0, 0, UnSet, NULL,
devname, !quiet)) {
rv = 1;
@ -1486,9 +1489,16 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
size = get_component_size(fd)/2;
if (size == 0)
size = array.size;
if (!quiet)
fprintf(stderr, Name ": component size of %s has been set to %lluK\n",
devname, size);
if (!quiet) {
if (size == orig_size)
fprintf(stderr, Name ": component size of %s "
"unchanged at %lluK\n",
devname, size);
else
fprintf(stderr, Name ": component size of %s "
"has been set to %lluK\n",
devname, size);
}
changed = 1;
} else if (array.level != LEVEL_CONTAINER) {
size = get_component_size(fd)/2;