mdadm: Fixup more broken logical operator formatting

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
This commit is contained in:
Jes Sorensen 2017-05-16 13:59:43 -04:00
parent fc54fe7a7e
commit d7be7d8736
11 changed files with 38 additions and 38 deletions

View File

@ -220,8 +220,8 @@ static int select_devices(struct mddev_dev *devlist,
pr_err("not a recognisable container: %s\n",
devname);
tmpdev->used = 2;
} else if (!tst->ss->load_container
|| tst->ss->load_container(tst, dfd, NULL)) {
} else if (!tst->ss->load_container ||
tst->ss->load_container(tst, dfd, NULL)) {
if (report_mismatch)
pr_err("no correct container type: %s\n",
devname);
@ -776,9 +776,8 @@ static int load_devices(struct devs *devices, char *devmap,
*stp = st;
return -1;
}
if (best[i] == -1
|| (devices[best[i]].i.events
< devices[devcnt].i.events))
if (best[i] == -1 || (devices[best[i]].i.events
< devices[devcnt].i.events))
best[i] = devcnt;
}
devcnt++;

16
Grow.c
View File

@ -3995,8 +3995,8 @@ int progress_reshape(struct mdinfo *info, struct reshape *reshape,
* a backup.
*/
if (advancing) {
if ((need_backup > info->reshape_progress
|| info->array.major_version < 0) &&
if ((need_backup > info->reshape_progress ||
info->array.major_version < 0) &&
*suspend_point < info->reshape_progress + target) {
if (need_backup < *suspend_point + 2 * target)
*suspend_point = need_backup;
@ -4149,8 +4149,9 @@ check_progress:
* it was just a device failure that leaves us degraded but
* functioning.
*/
if (sysfs_get_str(info, NULL, "reshape_position", buf, sizeof(buf)) < 0
|| strncmp(buf, "none", 4) != 0) {
if (sysfs_get_str(info, NULL, "reshape_position", buf,
sizeof(buf)) < 0 ||
strncmp(buf, "none", 4) != 0) {
/* The abort might only be temporary. Wait up to 10
* seconds for fd to contain a valid number again.
*/
@ -4182,9 +4183,10 @@ check_progress:
/* Maybe racing with array shutdown - check state */
if (fd >= 0)
close(fd);
if (sysfs_get_str(info, NULL, "array_state", buf, sizeof(buf)) < 0
|| strncmp(buf, "inactive", 8) == 0
|| strncmp(buf, "clear",5) == 0)
if (sysfs_get_str(info, NULL, "array_state", buf,
sizeof(buf)) < 0 ||
strncmp(buf, "inactive", 8) == 0 ||
strncmp(buf, "clear",5) == 0)
return -2; /* abort */
return -1; /* complete */
}

View File

@ -655,8 +655,8 @@ int attempt_re_add(int fd, int tfd, struct mddev_dev *dv,
if (dv->failfast == FlagClear)
disc.state &= ~(1 << MD_DISK_FAILFAST);
remove_partitions(tfd);
if (update || dv->writemostly != FlagDefault
|| dv->failfast != FlagDefault) {
if (update || dv->writemostly != FlagDefault ||
dv->failfast != FlagDefault) {
int rv = -1;
tfd = dev_open(dv->devname, O_RDWR);
if (tfd < 0) {

View File

@ -530,7 +530,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
if (st->utime == array.utime && st->failed == sra->array.failed_disks &&
st->working == sra->array.working_disks &&
st->spare == sra->array.spare_disks &&
(mse == NULL || (mse->percent == st->percent))) {
(mse == NULL || (mse->percent == st->percent))) {
if ((st->active < st->raid) && st->spare == 0)
retval = 1;
goto out;
@ -672,7 +672,7 @@ static int add_new_arrays(struct mdstat_ent *mdstat, struct state **statelist,
char *name;
for (mse = mdstat; mse; mse = mse->next)
if (mse->devnm[0] && (!mse->level || /* retrieve containers */
if (mse->devnm[0] && (!mse->level || /* retrieve containers */
(strcmp(mse->level, "raid0") != 0 &&
strcmp(mse->level, "linear") != 0))) {
struct state *st = xcalloc(1, sizeof *st);

View File

@ -439,8 +439,8 @@ void RebuildMap(void)
if ((homehost == NULL ||
st->ss->match_home(st, homehost) != 1) &&
st->ss->match_home(st, "any") != 1 &&
(require_homehost
|| ! conf_name_is_free(info->name)))
(require_homehost ||
!conf_name_is_free(info->name)))
/* require a numeric suffix */
unum = 0;
else

View File

@ -166,8 +166,8 @@ struct mdstat_ent *mdstat_read(int hold, int start)
continue;
insert_here = NULL;
/* Better be an md line.. */
if (strncmp(line, "md", 2)!= 0 || strlen(line) >= 32
|| (line[2] != '_' && !isdigit(line[2])))
if (strncmp(line, "md", 2)!= 0 || strlen(line) >= 32 ||
(line[2] != '_' && !isdigit(line[2])))
continue;
strcpy(devnm, line);
@ -212,8 +212,10 @@ struct mdstat_ent *mdstat_read(int hold, int start)
struct mdstat_ent **ih;
ih = &all;
while (ih != insert_here && *ih &&
((int)strlen((*ih)->devnm) != ep-w
|| strncmp((*ih)->devnm, w, ep-w) != 0))
((int)strlen((*ih)->devnm) !=
ep-w ||
strncmp((*ih)->devnm, w,
ep-w) != 0))
ih = & (*ih)->next;
insert_here = ih;
}

View File

@ -548,8 +548,8 @@ static int read_efi_variable(void *buffer, ssize_t buf_size, char *variable_name
errno = 0;
var_data_len = strtoul(buf, NULL, 16);
if ((errno == ERANGE && (var_data_len == LONG_MAX))
|| (errno != 0 && var_data_len == 0))
if ((errno == ERANGE && (var_data_len == LONG_MAX)) ||
(errno != 0 && var_data_len == 0))
return 1;
/* get data */

View File

@ -731,8 +731,8 @@ int restore_stripes(int *dest, unsigned long long *offsets,
zero_size = chunk_size;
}
if (stripe_buf == NULL || stripes == NULL || blocks == NULL
|| zero == NULL) {
if (stripe_buf == NULL || stripes == NULL || blocks == NULL ||
zero == NULL) {
rv = -2;
goto abort;
}

View File

@ -932,14 +932,13 @@ static int load_ddf_headers(int fd, struct ddf_super *super, char *devname)
if (load_ddf_header(fd, be64_to_cpu(super->anchor.secondary_lba),
dsize >> 9, 2,
&super->secondary, &super->anchor)) {
if (super->active == NULL
|| (be32_to_cpu(super->primary.seq)
< be32_to_cpu(super->secondary.seq) &&
!super->secondary.openflag)
|| (be32_to_cpu(super->primary.seq)
== be32_to_cpu(super->secondary.seq) &&
super->primary.openflag && !super->secondary.openflag)
)
if (super->active == NULL ||
(be32_to_cpu(super->primary.seq)
< be32_to_cpu(super->secondary.seq) &&
!super->secondary.openflag) ||
(be32_to_cpu(super->primary.seq) ==
be32_to_cpu(super->secondary.seq) &&
super->primary.openflag && !super->secondary.openflag))
super->active = &super->secondary;
} else if (devname &&
be64_to_cpu(super->anchor.secondary_lba) != ~(__u64)0)

View File

@ -10874,8 +10874,7 @@ static int imsm_create_metadata_update_for_reshape(
*/
spares = get_spares_for_grow(st);
if (spares == NULL
|| delta_disks > spares->array.spare_disks) {
if (spares == NULL || delta_disks > spares->array.spare_disks) {
pr_err("imsm: ERROR: Cannot get spare devices for %s.\n", geo->dev_name);
i = -1;
goto abort;

3
util.c
View File

@ -2213,8 +2213,7 @@ void enable_fds(int devices)
{
unsigned int fds = 20 + devices;
struct rlimit lim;
if (getrlimit(RLIMIT_NOFILE, &lim) != 0
|| lim.rlim_cur >= fds)
if (getrlimit(RLIMIT_NOFILE, &lim) != 0 || lim.rlim_cur >= fds)
return;
if (lim.rlim_max < fds)
lim.rlim_max = fds;