dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/Create-Fixup-bad-placement-of-logical-in-multi-line-.patch

2c1b57
From cf622ec1d81a5bb3f882922667bac494b3a16581 Mon Sep 17 00:00:00 2001
2c1b57
From: Jes Sorensen <Jes.Sorensen@gmail.com>
2c1b57
Date: Wed, 5 Apr 2017 11:53:12 -0400
2c1b57
Subject: [RHEL7.5 PATCH 050/169] Create: Fixup bad placement of logical ||
2c1b57
 && in multi-line if statements
2c1b57
2c1b57
These always go at the end of the line, never at the front
2c1b57
2c1b57
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
2c1b57
---
2c1b57
 Create.c | 28 +++++++++++-----------------
2c1b57
 1 file changed, 11 insertions(+), 17 deletions(-)
2c1b57
2c1b57
diff --git a/Create.c b/Create.c
2c1b57
index ba24606..17333ce 100644
2c1b57
--- a/Create.c
2c1b57
+++ b/Create.c
2c1b57
@@ -457,8 +457,8 @@ int Create(struct supertype *st, char *mddev,
2c1b57
 			    st->minor_version >= 1)
2c1b57
 				/* metadata at front */
2c1b57
 				warn |= check_partitions(fd, dname, 0, 0);
2c1b57
-			else if (s->level == 1 || s->level == LEVEL_CONTAINER
2c1b57
-				    || (s->level == 0 && s->raiddisks == 1))
2c1b57
+			else if (s->level == 1 || s->level == LEVEL_CONTAINER ||
2c1b57
+				 (s->level == 0 && s->raiddisks == 1))
2c1b57
 				/* partitions could be meaningful */
2c1b57
 				warn |= check_partitions(fd, dname, freesize*2, s->size*2);
2c1b57
 			else
2c1b57
@@ -495,9 +495,8 @@ int Create(struct supertype *st, char *mddev,
2c1b57
 			pr_err("no size and no drives given - aborting create.\n");
2c1b57
 			return 1;
2c1b57
 		}
2c1b57
-		if (s->level > 0 || s->level == LEVEL_MULTIPATH
2c1b57
-		    || s->level == LEVEL_FAULTY
2c1b57
-		    || st->ss->external ) {
2c1b57
+		if (s->level > 0 || s->level == LEVEL_MULTIPATH ||
2c1b57
+		    s->level == LEVEL_FAULTY || st->ss->external ) {
2c1b57
 			/* size is meaningful */
2c1b57
 			if (!st->ss->validate_geometry(st, s->level, s->layout,
2c1b57
 						       s->raiddisks,
2c1b57
@@ -616,8 +615,8 @@ int Create(struct supertype *st, char *mddev,
2c1b57
 	 * it could be in conflict with already existing device
2c1b57
 	 * e.g. container, array
2c1b57
 	 */
2c1b57
-	if (strncmp(chosen_name, "/dev/md/", 8) == 0
2c1b57
-	    && map_by_name(&map, chosen_name+8) != NULL) {
2c1b57
+	if (strncmp(chosen_name, "/dev/md/", 8) == 0 &&
2c1b57
+	    map_by_name(&map, chosen_name+8) != NULL) {
2c1b57
 		pr_err("Array name %s is in use already.\n",
2c1b57
 			chosen_name);
2c1b57
 		close(mdfd);
2c1b57
@@ -653,16 +652,11 @@ int Create(struct supertype *st, char *mddev,
2c1b57
 		info.array.md_minor = minor(stb.st_rdev);
2c1b57
 	info.array.not_persistent = 0;
2c1b57
 
2c1b57
-	if ( ( (s->level == 4 || s->level == 5) &&
2c1b57
-	       (insert_point < s->raiddisks || first_missing < s->raiddisks) )
2c1b57
-	     ||
2c1b57
-	     ( s->level == 6 && (insert_point < s->raiddisks
2c1b57
-			      || second_missing < s->raiddisks))
2c1b57
-	     ||
2c1b57
-	     ( s->level <= 0 )
2c1b57
-	     ||
2c1b57
-	     s->assume_clean
2c1b57
-		) {
2c1b57
+	if (((s->level == 4 || s->level == 5) &&
2c1b57
+	     (insert_point < s->raiddisks || first_missing < s->raiddisks)) ||
2c1b57
+	    (s->level == 6 && (insert_point < s->raiddisks ||
2c1b57
+			       second_missing < s->raiddisks)) ||
2c1b57
+	    (s->level <= 0) || s->assume_clean) {
2c1b57
 		info.array.state = 1; /* clean, but one+ drive will be missing*/
2c1b57
 		info.resync_start = MaxSector;
2c1b57
 	} else {
2c1b57
-- 
2c1b57
2.7.4
2c1b57