Grow.c: fix lots of white-space issues.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2011-12-23 06:59:51 +11:00
parent ce4783d3d6
commit 24daa16fa1
1 changed files with 41 additions and 43 deletions

36
Grow.c
View File

@ -480,7 +480,6 @@ int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int
return 0;
}
/*
* When reshaping an array we might need to backup some data.
* This is written to all spares with a 'super_block' describing it.
@ -1526,7 +1525,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
sra = sysfs_read(fd, 0, GET_LEVEL | GET_DISKS | GET_DEVS
| GET_STATE | GET_VERSION);
if (sra) {
if (sra) {
if (st->ss->external && subarray == NULL) {
array.level = LEVEL_CONTAINER;
sra->array.level = LEVEL_CONTAINER;
@ -1673,11 +1672,11 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
/* ========= check for Raid10/Raid1 -> Raid0 conversion ===============
* current implementation assumes that following conditions must be met:
* - RAID10:
* - far_copies == 1
* - near_copies == 2
* - far_copies == 1
* - near_copies == 2
*/
if ((level == 0 && array.level == 10 && sra &&
array.layout == ((1 << 8) + 2) && !(array.raid_disks & 1)) ||
array.layout == ((1 << 8) + 2) && !(array.raid_disks & 1)) ||
(level == 0 && array.level == 1 && sra)) {
int err;
err = remove_disks_for_takeover(st, sra, array.layout);
@ -1727,7 +1726,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
goto release;
}
} else if (strcmp(layout_str, "normalise") == 0 ||
strcmp(layout_str, "normalize") == 0) {
strcmp(layout_str, "normalize") == 0) {
/* If we have a -6 RAID6 layout, remove the '-6'. */
info.new_layout = UnSet;
if (info.array.level == 6 && info.new_level == UnSet) {
@ -2273,11 +2272,11 @@ started:
if (sysfs_set_num(sra, NULL, "chunk_size", info->new_chunk) < 0)
err = errno;
if (!err && sysfs_set_num(sra, NULL, "layout",
reshape.after.layout) < 0)
reshape.after.layout) < 0)
err = errno;
if (!err && subarray_set_num(container, sra, "raid_disks",
reshape.after.data_disks +
reshape.parity) < 0)
reshape.after.data_disks +
reshape.parity) < 0)
err = errno;
if (err) {
fprintf(stderr, Name ": Cannot set device shape for %s\n",
@ -2771,7 +2770,7 @@ int progress_reshape(struct mdinfo *info, struct reshape *reshape,
* this much.
*/
target = 64*1024*2 * min(reshape->before.data_disks,
reshape->after.data_disks);
reshape->after.data_disks);
target /= reshape->backup_blocks;
if (target < 2)
target = 2;
@ -2968,7 +2967,6 @@ check_progress:
}
}
/* FIXME return status is never checked */
static int grow_backup(struct mdinfo *sra,
unsigned long long offset, /* per device */
@ -3086,9 +3084,9 @@ static int grow_backup(struct mdinfo *sra,
* every works.
*/
/* FIXME return value is often ignored */
static int forget_backup(
int dests, int *destfd, unsigned long long *destoffsets,
int part)
static int forget_backup(int dests, int *destfd,
unsigned long long *destoffsets,
int part)
{
/*
* Erase backup 'part' (which is 0 or 1)
@ -3150,7 +3148,7 @@ static void validate(int afd, int bfd, unsigned long long offset)
fail("magic is bad");
if (memcmp(bsb2.magic, "md_backup_data-2", 16) == 0 &&
bsb2.sb_csum2 != bsb_csum((char*)&bsb2,
((char*)&bsb2.sb_csum2)-((char*)&bsb2)))
((char*)&bsb2.sb_csum2)-((char*)&bsb2)))
fail("second csum bad");
if (__le64_to_cpu(bsb2.devstart)*512 != offset)
@ -3180,7 +3178,7 @@ static void validate(int afd, int bfd, unsigned long long offset)
if ((unsigned long long)read(afd, abuf, len) != len)
fail("read first from array failed");
if (memcmp(bbuf, abuf, len) != 0) {
#if 0
#if 0
int i;
printf("offset=%llu len=%llu\n",
(unsigned long long)__le64_to_cpu(bsb2.arraystart)*512, len);
@ -3189,7 +3187,7 @@ static void validate(int afd, int bfd, unsigned long long offset)
printf("first diff byte %d\n", i);
break;
}
#endif
#endif
fail("data1 compare failed");
}
}
@ -3540,7 +3538,7 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
nonew:
if (verbose)
fprintf(stderr, Name
": backup-metadata found on %s but is not needed\n", devname);
": backup-metadata found on %s but is not needed\n", devname);
continue; /* No new data here */
}
} else {
@ -3575,7 +3573,7 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
second_fail:
if (verbose)
fprintf(stderr, Name
": Failed to verify secondary backup-metadata block on %s\n",
": Failed to verify secondary backup-metadata block on %s\n",
devname);
continue; /* Cannot seek */
}