Skip to contentSkip to conversation

xfstests: fsstress: fix incorrect if condition check for collapse range mode

PATCH Superseded Namjae Jeon 2 participants 4 messages Apr 30, 2014 VFS

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests: fsstress: fix incorrect if condition check for collapse range mode

There is if condition to be block aligned for off and len of Collapse range. But off and len for all fallocate opearion can be aligned by incorrect if condition check.

---
 ltp/fsstress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ltp/fsstress.c +1 -1
index 29fc250..ff9ed12 100644
@@ -2230,7 +2230,7 @@ do_fallocate(int opno, long r, int mode)
 	 * Collapse range requires off and len to be block aligned, make it
 	 * more likely to be the case.
 	 */
-	if (FALLOC_FL_COLLAPSE_RANGE && (opno % 2)) {
+	if (mode & FALLOC_FL_COLLAPSE_RANGE && (opno % 2)) {
 		off = ((off + stb.st_blksize - 1) & ~(stb.st_blksize - 1));
 		len = ((len + stb.st_blksize - 1) & ~(stb.st_blksize - 1));
 	}
Signature · 1 line
1.7.11-rc0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 23 lines · Namjae Jeon

Date: Wed, 30 Apr 2014 19:11:32 +0900
From: Namjae Jeon <[email protected]>
To: Dave Chinner <[email protected]>
Cc: [email protected], [email protected],
Ashish Sangwan <[email protected]>
Subject: [PATCH] xfstests: fsstress: fix incorrect if condition check for
collapse range mode

There is if condition to be block aligned for off and len of Collapse range. But off and len for all fallocate opearion can be aligned by incorrect if condition check.

---
 ltp/fsstress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ltp/fsstress.c +0 -0
index 29fc250..ff9ed12 100644

ltp/fsstress.c do_fallocate(int opno, long r, int mode) · line 2236

Quoted 8 lines
ltp/fsstress.c +1 -1
@@ -2230,7 +2230,7 @@ do_fallocate(int opno, long r, int mode)
 	 * Collapse range requires off and len to be block aligned, make it
 	 * more likely to be the case.
 	 */
-	if (FALLOC_FL_COLLAPSE_RANGE && (opno % 2)) {
+	if (mode & FALLOC_FL_COLLAPSE_RANGE && (opno % 2)) {
 		off = ((off + stb.st_blksize - 1) & ~(stb.st_blksize - 1));
 		len = ((len + stb.st_blksize - 1) & ~(stb.st_blksize - 1));
 	}

oops :). Thanks for fixing it. Even though it would be better to use parentheses

+ if ((mode & FALLOC_FL_COLLAPSE_RANGE) && (opno % 2)) {

#2 lore raw
Quoted 20 lines · Namjae Jeon
Quoted 19 lines

Date: Wed, 30 Apr 2014 19:11:32 +0900
From: Namjae Jeon <[email protected]>
To: Dave Chinner <[email protected]>
Cc: [email protected], [email protected],
Ashish Sangwan <[email protected]>
Subject: [PATCH] xfstests: fsstress: fix incorrect if condition check for
collapse range mode

There is if condition to be block aligned for off and len of Collapse range. But off and len for all fallocate opearion can be aligned by incorrect if condition check.

---
 ltp/fsstress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines

ltp/fsstress.c do_fallocate(int opno, long r, int mode) · line 2236

Quoted 13 lines
ltp/fsstress.c +1 -1
index 29fc250..ff9ed12 100644
@@ -2230,7 +2230,7 @@ do_fallocate(int opno, long r, int mode)
 	 * Collapse range requires off and len to be block aligned, make it
 	 * more likely to be the case.
 	 */
-	if (FALLOC_FL_COLLAPSE_RANGE && (opno % 2)) {
+	if (mode & FALLOC_FL_COLLAPSE_RANGE && (opno % 2)) {
 		off = ((off + stb.st_blksize - 1) & ~(stb.st_blksize - 1));
 		len = ((len + stb.st_blksize - 1) & ~(stb.st_blksize - 1));
 	}

oops :). Thanks for fixing it. Even though it would be better to use parentheses

Hi Lukas.
Okay, I will send v2 patch.
Thanks for review!

Quoted 4 lines
(quoted diff) +1 -0
+	if ((mode & FALLOC_FL_COLLAPSE_RANGE) && (opno % 2)) {
#3 lore raw
In reply to Lukáš Czerner
Quoted 20 lines · Namjae Jeon
Quoted 19 lines

Date: Wed, 30 Apr 2014 19:11:32 +0900
From: Namjae Jeon <[email protected]>
To: Dave Chinner <[email protected]>
Cc: [email protected], [email protected],
Ashish Sangwan <[email protected]>
Subject: [PATCH] xfstests: fsstress: fix incorrect if condition check for
collapse range mode

There is if condition to be block aligned for off and len of Collapse range. But off and len for all fallocate opearion can be aligned by incorrect if condition check.

---
 ltp/fsstress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines

ltp/fsstress.c do_fallocate(int opno, long r, int mode) · line 2236

Quoted 13 lines
ltp/fsstress.c +1 -1
index 29fc250..ff9ed12 100644
@@ -2230,7 +2230,7 @@ do_fallocate(int opno, long r, int mode)
 	 * Collapse range requires off and len to be block aligned, make it
 	 * more likely to be the case.
 	 */
-	if (FALLOC_FL_COLLAPSE_RANGE && (opno % 2)) {
+	if (mode & FALLOC_FL_COLLAPSE_RANGE && (opno % 2)) {
 		off = ((off + stb.st_blksize - 1) & ~(stb.st_blksize - 1));
 		len = ((len + stb.st_blksize - 1) & ~(stb.st_blksize - 1));
 	}

oops :). Thanks for fixing it. Even though it would be better to use parentheses

Hi Lukas.
Okay, I will send v2 patch.
Thanks for review!

Quoted 4 lines
(quoted diff) +1 -0
+	if ((mode & FALLOC_FL_COLLAPSE_RANGE) && (opno % 2)) {

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs