]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm: Fixup more broken logical operator formatting
authorJes Sorensen <jsorensen@fb.com>
Tue, 16 May 2017 17:59:43 +0000 (13:59 -0400)
committerJes Sorensen <jsorensen@fb.com>
Tue, 16 May 2017 17:59:43 +0000 (13:59 -0400)
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Assemble.c
Grow.c
Manage.c
Monitor.c
mapfile.c
mdstat.c
platform-intel.c
restripe.c
super-ddf.c
super-intel.c
util.c

index 1b1905c7da8dbd7aa85cfbf0e264b2d8da92380b..afc6d9ca100e57dcd49a29af363da97517133e28 100644 (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++;
diff --git a/Grow.c b/Grow.c
index 39110b852e7c8979eb45023df072ae536f5a5221..db3f18b6d2630f95ad9dd39b2590a6828d97706f 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -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 */
        }
index cee5dad8600473e882efec5ac78a42dcc09e0ba0..04b9398c2e4f1e76587de518966b0d557b9688ba 100644 (file)
--- a/Manage.c
+++ b/Manage.c
@@ -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) {
index 0198a346c05801015508af21533b4546f770c79b..725f47db564e87f4afb4c3cd5cb0f5469034239a 100644 (file)
--- a/Monitor.c
+++ b/Monitor.c
@@ -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);
index c89d403f4e32b22c9a2e682c85617f354cf86e7c..f3c8191e80b7485760152db11df90bb2548c70f8 100644 (file)
--- a/mapfile.c
+++ b/mapfile.c
@@ -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
index 39628967047e7b8275269871fdd79507fa5112e3..0d440508ae6c04efbb998bb90f0bb3c31ffd7622 100644 (file)
--- a/mdstat.c
+++ b/mdstat.c
@@ -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;
                                }
index 9867697b1296f7e9fbfaf62d8737437e748412d7..a11101db3bfb7024466c2ff82310f1b1f215c1e3 100644 (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 */
index de85ee46259f92e39d30e92b56c7582ce8306efe..6b31695b5a92451c4ec72dbd1092d06df349e96f 100644 (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;
        }
index 769eded3bba8a8926aa6c64766fbb79fed3bd68b..4da7c09c6095900f41be7226ddb22c0908218934 100644 (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)
index c84e7559fb93d970c67a6a80fb1d4cb68dc92a4a..3d0a37c6a906ef2a31345eefbc20394d0aae4891 100644 (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;
diff --git a/util.c b/util.c
index 0564c0be66299c991be6eef5b492cc6349865ab1..d89438c812ef809e18710e052bee584f8525def9 100644 (file)
--- a/util.c
+++ b/util.c
@@ -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;