Skip to contentSkip to conversation

xfstests: fsx: fix fallocate logging

PATCH In review Josef Bacik 3 participants 4 messages Aug 8, 2011 – Aug 14, 2011 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests: fsx: fix fallocate logging

I've been getting segfaults on fsx tests with btrfs because we're using the wrong values for the logging with fallocate. We were using the numbers 1,2 and 3 to indicate the type of preallocate we were doing, however we use these to point to an array, so obviously array[3] for a 3 element array is wrong, so fix these to do 0,1, and 2. Also spit out of we're using KEEP_SIZE in the log to make it easier to figure out what's going on. Thanks,

---
 ltp/fsx.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
ltp/fsx.c +6 -5
index 0683853..662af38 100644
@@ -878,11 +878,11 @@ do_preallocate(unsigned offset, unsigned length)
 
 	/*
 	 * last arg:
-	 * 	1: allocate past EOF
-	 * 	2: extending prealloc
-	 * 	3: interior prealloc
+	 * 	0: allocate past EOF
+	 * 	1: extending prealloc
+	 * 	2: interior prealloc
 	 */
-	log4(OP_FALLOCATE, offset, length, (end_offset > file_size) ? (keep_size ? 1 : 2) : 3);
+	log4(OP_FALLOCATE, offset, length, (end_offset > file_size) ? (keep_size ? 0 : 1) : 2);
 
 	if (end_offset > file_size) {
 		memset(good_buf + file_size, '\0', end_offset - file_size);
@@ -895,7 +895,8 @@ do_preallocate(unsigned offset, unsigned length)
 	if ((progressinterval && testcalls % progressinterval == 0) ||
 	    (debug && (monitorstart == -1 || monitorend == -1 ||
 		      end_offset <= monitorend)))
-		prt("%lu falloc\tfrom 0x%x to 0x%x\n", testcalls, offset, length);
+		prt("%lu falloc\tfrom 0x%x to 0x%x%s\n", testcalls, offset, length,
+		    keep_size ? " (KEEP_SIZE)" : "");
 	if (fallocate(fd, keep_size ? FALLOC_FL_KEEP_SIZE : 0, (loff_t)offset, (loff_t)length) == -1) {
 	        prt("fallocate: %x to %x\n", offset, length);
 		prterr("do_preallocate: fallocate");
Signature · 1 line
1.7.5.2
#1 lore raw
Quoted 8 lines · Josef Bacik

I've been getting segfaults on fsx tests with btrfs because we're using the wrong values for the logging with fallocate. We were using the numbers 1,2 and 3 to indicate the type of preallocate we were doing, however we use these to point to an array, so obviously array[3] for a 3 element array is wrong, so fix these to do 0,1, and 2. Also spit out of we're using KEEP_SIZE in the log to make it easier to figure out what's going on. Thanks,

Already fixed.

http://git.kernel.org/?p=fs/xfs/xfstests-dev.git;a=commit;h=77c06202484237e26774efbd1774c251b6bef0a9

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#2 lore raw
Quoted 8 lines · Dave Chinner
Quoted 7 lines · Josef Bacik

I've been getting segfaults on fsx tests with btrfs because we're using the wrong values for the logging with fallocate. We were using the numbers 1,2 and 3 to indicate the type of preallocate we were doing, however we use these to point to an array, so obviously array[3] for a 3 element array is wrong, so fix these to do 0,1, and 2. Also spit out of we're using KEEP_SIZE in the log to make it easier to figure out what's going on. Thanks,

Quoted 6 lines
Quoted 1 line

Already fixed.

http://git.kernel.org/?p=fs/xfs/xfstests-dev.git;a=commit;h=77c06202484237e26774efbd1774c251b6bef0a9

Damnit, this is what I get for not git pulling first. Thanks,

Josef