public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] xfstests: various fixes
@ 2013-06-07 13:06 Dave Chinner
  2013-06-07 13:06 ` [PATCH 1/6] xfstests: generic/193 runs tests in wrong location Dave Chinner
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Dave Chinner @ 2013-06-07 13:06 UTC (permalink / raw)
  To: xfs

Hi folks,

I figured that sending 77 patches to the list in one day wasn't
enough, so here's another 6 for xfstests. These patches fix the suid
tests in generic/193 to run on the target filesystem, test suid/sgid
behaviour for truncate, stop the experimatal warnings from CRC
enabled xfsprogs from making tests fail, fix a missing $seq to
$seqres conversion, convert an ENOSPC test to work with arbitrary
block sizes, avoid tests that currently won't run or are not
relevant for CRC enabled filesystems, and add a multithreaded test
mode to the bstat test program....

-Dave.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/6] xfstests: generic/193 runs tests in wrong location
  2013-06-07 13:06 [PATCH 0/6] xfstests: various fixes Dave Chinner
@ 2013-06-07 13:06 ` Dave Chinner
  2013-06-25 19:49   ` Ben Myers
  2013-06-07 13:06 ` [PATCH 2/6] xfstests: ensure all mkfs output is redirected properly Dave Chinner
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Dave Chinner @ 2013-06-07 13:06 UTC (permalink / raw)
  To: xfs

From: Dave Chinner <dchinner@redhat.com>

generic/193 runs the test in $here - the root of the xfstests source
tree/installation. IOWs, it doesn't test the filesystem on either
the TEST_DIR or SCRATCH_MNT, and so it not testing the filesystem
we think it is testing. Bad. Fixing this is the majority of the
change - introducing $test_root and $test_user for the files with
different owners, and then redirecting error output and filtering
the output appropriately.

And then add checks that truncate clears the suid/sgid bits
appropriately, somethign that has never been tested on XFS (and
likely other filesystems) so will cause kernels between 3.1 and 3.9
to assert fail as Dave Jones has recently reported.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 tests/generic/193     |  135 ++++++++++++++++++++++++++++++++-----------------
 tests/generic/193.out |   17 ++++++-
 2 files changed, 105 insertions(+), 47 deletions(-)

diff --git a/tests/generic/193 b/tests/generic/193
index cdf04c2..4fa20ff 100755
--- a/tests/generic/193
+++ b/tests/generic/193
@@ -43,9 +43,9 @@ tag="added by qa $seq"
 #
 _create_files()
 {
-	touch test.root
-	touch test.${qa_user}
-	chown ${qa_user}:${qa_user} test.${qa_user}
+	touch $test_root
+	touch $test_user
+	chown ${qa_user}:${qa_user} $test_user
 }
 
 #
@@ -53,8 +53,13 @@ _create_files()
 #
 _cleanup_files()
 {
-	rm -f test.${qa_user}
-	rm -f test.root
+	rm -f $test_user
+	rm -f $test_root
+}
+
+_filter_files()
+{
+	sed -e "s,$test_root,test.root,g" -e "s,$test_user,test.user,g"
 }
 
 # get standard environment, filters and checks
@@ -68,6 +73,9 @@ _supported_os Linux
 _require_user
 _need_to_be_root
 
+test_root=$TEST_DIR/$seq.$$.root
+test_user=$TEST_DIR/$seq.$$.user
+
 #
 # make sure we have a normal umask set
 #
@@ -83,17 +91,17 @@ echo
 _create_files
 
 echo "user: chown root owned file to qa_user (should fail)"
-su ${qa_user} -c "chown ${qa_user} test.root"
+su ${qa_user} -c "chown ${qa_user} $test_root" 2>&1 | _filter_files
 
 echo "user: chown root owned file to root (should fail)"
-su ${qa_user} -c "chown root test.root"
+su ${qa_user} -c "chown root $test_root" 2>&1 | _filter_files
 
 echo "user: chown qa_user owned file to qa_user (should succeed)"
-su ${qa_user} -c "chown ${qa_user} test.${qa_user}"
+su ${qa_user} -c "chown ${qa_user} $test_user"
 
 # this would work without _POSIX_CHOWN_RESTRICTED
 echo "user: chown qa_user owned file to root (should fail)"
-su ${qa_user} -c "chown root test.${qa_user}"
+su ${qa_user} -c "chown root $test_user" 2>&1 | _filter_files
 
 _cleanup_files
 
@@ -107,19 +115,19 @@ echo
 _create_files
 
 echo "user: chgrp root owned file to root (should fail)"
-su ${qa_user} -c "chgrp root test.root"
+su ${qa_user} -c "chgrp root $test_root" 2>&1 | _filter_files
 
 echo "user: chgrp qa_user owned file to root (should fail)"
-su ${qa_user} -c "chgrp root test.${qa_user}"
+su ${qa_user} -c "chgrp root $test_user" 2>&1 | _filter_files
 
 echo "user: chgrp root owned file to qa_user (should fail)"
-su ${qa_user} -c "chgrp ${qa_user} test.root"
+su ${qa_user} -c "chgrp ${qa_user} $test_root" 2>&1 | _filter_files
 
 echo "user: chgrp qa_user owned file to qa_user (should succeed)"
-su ${qa_user} -c "chgrp ${qa_user} test.${qa_user}"
+su ${qa_user} -c "chgrp ${qa_user} $test_user"
 
 #echo "user: chgrp qa_user owned file to secondary group (should succeed)"
-#su ${qa_user} -c "chgrp ${group2} test.${qa_user}"
+#su ${qa_user} -c "chgrp ${group2} $test_user"
 
 _cleanup_files
 
@@ -133,10 +141,10 @@ echo
 _create_files
 
 echo "user: chmod a+r on qa_user owned file (should succeed)"
-su ${qa_user} -c "chmod a+r test.${qa_user}"
+su ${qa_user} -c "chmod a+r $test_user"
 
 echo "user: chmod a+r on root owned file (should fail)"
-su ${qa_user} -c "chmod a+r test.root"
+su ${qa_user} -c "chmod a+r $test_root" 2>&1 | _filter_files
 
 #
 # Setup a file owned by the qa_user, but with a group ID that
@@ -153,12 +161,12 @@ su ${qa_user} -c "chmod a+r test.root"
 # reg file + file's gid not in process' group set + no approp. privileges -> clear sgid
 #
 echo "check that the sgid bit is cleared"
-chown ${qa_user}:root test.${qa_user}
-chmod g+s test.${qa_user}
+chown ${qa_user}:root $test_user
+chmod g+s $test_user
 
 # and let the qa_user change permission bits
-su ${qa_user} -c "chmod a+w test.${qa_user}"
-stat -c '%A' test.${qa_user}
+su ${qa_user} -c "chmod a+w $test_user"
+stat -c '%A' $test_user
 
 #
 # Setup a file owned by the qa_user and with the suid bit set.
@@ -166,9 +174,9 @@ stat -c '%A' test.${qa_user}
 # There is nothing in Posix that says it should but just checking.
 #
 echo "check that suid bit is not cleared"
-chmod u+s test.${qa_user}
-chmod a+w test.${qa_user}
-stat -c '%A' test.${qa_user}
+chmod u+s $test_user
+chmod a+w $test_user
+stat -c '%A' $test_user
 
 _cleanup_files
 
@@ -196,35 +204,72 @@ _create_files
 echo "check that suid/sgid bits are cleared after successful chown..."
 
 echo "with no exec perm"
-chmod ug+s test.${qa_user}
-echo -n "before: "; stat -c '%A' test.${qa_user}
-chown root test.${qa_user}
-echo -n "after:  "; stat -c '%A' test.${qa_user}
+chmod ug+s $test_user
+echo -n "before: "; stat -c '%A' $test_user
+chown root $test_user
+echo -n "after:  "; stat -c '%A' $test_user
 
 echo "with user exec perm"
-chmod ug+s test.${qa_user}
-chmod u+x test.${qa_user}
-echo -n "before: "; stat -c '%A' test.${qa_user}
-chown root test.${qa_user}
-echo -n "after:  "; stat -c '%A' test.${qa_user}
+chmod ug+s $test_user
+chmod u+x $test_user
+echo -n "before: "; stat -c '%A' $test_user
+chown root $test_user
+echo -n "after:  "; stat -c '%A' $test_user
 
 echo "with group exec perm"
-chmod ug+s test.${qa_user}
-chmod g+x test.${qa_user}
-chmod u-x test.${qa_user}
-echo -n "before: "; stat -c '%A' test.${qa_user}
-chown root test.${qa_user}
-echo -n "after:  "; stat -c '%A' test.${qa_user}
+chmod ug+s $test_user
+chmod g+x $test_user
+chmod u-x $test_user
+echo -n "before: "; stat -c '%A' $test_user
+chown root $test_user
+echo -n "after:  "; stat -c '%A' $test_user
 
 echo "with user+group exec perm"
-chmod ug+s test.${qa_user}
-chmod ug+x test.${qa_user}
-echo -n "before: "; stat -c '%A' test.${qa_user}
-chown root test.${qa_user}
-echo -n "after:  "; stat -c '%A' test.${qa_user}
+chmod ug+s $test_user
+chmod ug+x $test_user
+echo -n "before: "; stat -c '%A' $test_user
+chown root $test_user
+echo -n "after:  "; stat -c '%A' $test_user
 
 _cleanup_files
 
+_create_files
+# Now test out the clear of suid/sgid for truncate
+#
+echo "check that suid/sgid bits are cleared after successful truncate..."
+
+echo "with no exec perm"
+echo frobnozzle >> $test_user
+chmod ug+s $test_user
+echo -n "before: "; stat -c '%A' $test_user
+su ${qa_user} -c "echo > $test_user"
+echo -n "after:  "; stat -c '%A' $test_user
+
+echo "with user exec perm"
+echo frobnozzle >> $test_user
+chmod ug+s $test_user
+chmod u+x $test_user
+echo -n "before: "; stat -c '%A' $test_user
+su ${qa_user} -c "echo > $test_user"
+echo -n "after:  "; stat -c '%A' $test_user
+
+echo "with group exec perm"
+echo frobnozzle >> $test_user
+chmod ug+s $test_user
+chmod g+x $test_user
+chmod u-x $test_user
+echo -n "before: "; stat -c '%A' $test_user
+su ${qa_user} -c "echo > $test_user"
+echo -n "after:  "; stat -c '%A' $test_user
+
+echo "with user+group exec perm"
+echo frobnozzle >> $test_user
+chmod ug+s $test_user
+chmod ug+x $test_user
+echo -n "before: "; stat -c '%A' $test_user
+su ${qa_user} -c "echo > $test_user"
+echo -n "after:  "; stat -c '%A' $test_user
+
 #
 # Test ATTR_*TIMES_SET
 #
@@ -235,10 +280,10 @@ echo
 _create_files
 
 echo "user: touch qa_user file (should succeed)"
-su ${qa_user} -c "touch test.${qa_user}"
+su ${qa_user} -c "touch $test_user"
 
 echo "user: touch root file (should fail)"
-su ${qa_user} -c "touch test.root"
+su ${qa_user} -c "touch $test_root" 2>&1 | _filter_files
 
 _cleanup_files
 
diff --git a/tests/generic/193.out b/tests/generic/193.out
index b89add3..357a7c1 100644
--- a/tests/generic/193.out
+++ b/tests/generic/193.out
@@ -8,14 +8,14 @@ user: chown root owned file to root (should fail)
 chown: changing ownership of `test.root': Operation not permitted
 user: chown qa_user owned file to qa_user (should succeed)
 user: chown qa_user owned file to root (should fail)
-chown: changing ownership of `test.fsgqa': Operation not permitted
+chown: changing ownership of `test.user': Operation not permitted
 
 testing ATTR_GID
 
 user: chgrp root owned file to root (should fail)
 chgrp: changing group of `test.root': Operation not permitted
 user: chgrp qa_user owned file to root (should fail)
-chgrp: changing group of `test.fsgqa': Operation not permitted
+chgrp: changing group of `test.user': Operation not permitted
 user: chgrp root owned file to qa_user (should fail)
 chgrp: changing group of `test.root': Operation not permitted
 user: chgrp qa_user owned file to qa_user (should succeed)
@@ -42,6 +42,19 @@ after:  -rw-r-xr--
 with user+group exec perm
 before: -rwsr-sr--
 after:  -rwxr-xr--
+check that suid/sgid bits are cleared after successful truncate...
+with no exec perm
+before: -rwSr-Sr--
+after:  -rw-r-Sr--
+with user exec perm
+before: -rwsr-Sr--
+after:  -rwxr-Sr--
+with group exec perm
+before: -rwSr-sr--
+after:  -rw-r-xr--
+with user+group exec perm
+before: -rwsr-sr--
+after:  -rwxr-xr--
 
 testing ATTR_*TIMES_SET
 
-- 
1.7.10.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/6] xfstests: ensure all mkfs output is redirected properly
  2013-06-07 13:06 [PATCH 0/6] xfstests: various fixes Dave Chinner
  2013-06-07 13:06 ` [PATCH 1/6] xfstests: generic/193 runs tests in wrong location Dave Chinner
@ 2013-06-07 13:06 ` Dave Chinner
  2013-06-07 13:06 ` [PATCH 3/6] xfstests: xfs/253 doesn't use seqres correctly Dave Chinner
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Dave Chinner @ 2013-06-07 13:06 UTC (permalink / raw)
  To: xfs

From: Dave Chinner <dchinner@redhat.com>

mkfs.xfs with experimental CRC support outputs extra warnings about
being experimental on stderr, and so some tests do not redirect the
output correctly. These tests fail with a golden output mismatch due
to this. Fix these tests by redirecting stderr to either seqres.full
or /dev/null.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 common/dump   |    4 ++--
 common/rc     |    2 +-
 common/repair |    2 ++
 tests/xfs/004 |    3 ++-
 tests/xfs/021 |    2 +-
 tests/xfs/029 |    2 +-
 tests/xfs/030 |    5 +++--
 tests/xfs/031 |   10 +++++++---
 tests/xfs/033 |    6 ++++--
 tests/xfs/041 |    5 +++--
 tests/xfs/042 |    2 +-
 tests/xfs/050 |    3 ++-
 tests/xfs/052 |    3 ++-
 tests/xfs/067 |    4 ++--
 tests/xfs/071 |    3 ++-
 tests/xfs/072 |    3 +--
 tests/xfs/073 |   17 +++++++++++------
 tests/xfs/092 |    2 +-
 tests/xfs/104 |    7 +++++--
 tests/xfs/106 |    3 ++-
 tests/xfs/107 |    3 ++-
 tests/xfs/108 |    3 ++-
 tests/xfs/109 |    3 ++-
 tests/xfs/110 |    3 ++-
 tests/xfs/118 |    2 +-
 tests/xfs/178 |    2 +-
 tests/xfs/189 |    3 ++-
 tests/xfs/244 |    6 ++++--
 tests/xfs/287 |    4 ++--
 29 files changed, 73 insertions(+), 44 deletions(-)

diff --git a/common/dump b/common/dump
index 7fe50f6..9c998e5 100644
--- a/common/dump
+++ b/common/dump
@@ -236,8 +236,8 @@ _wipe_fs()
 {
     _require_scratch
 
-    _scratch_mkfs_xfs >>$seqres.full || _fail "mkfs failed"
-    _scratch_mount >>$seqres.full || _fail "mount failed"
+    _scratch_mkfs_xfs >>$seqres.full 2>&1 || _fail "mkfs failed"
+    _scratch_mount >>$seqres.full 2>&1 || _fail "mount failed"
 }
 
 #
diff --git a/common/rc b/common/rc
index fe6bbfc..88d38ef 100644
--- a/common/rc
+++ b/common/rc
@@ -1078,7 +1078,7 @@ _require_dm_flakey()
 #
 _require_projid32bit()
 {
-        _scratch_mkfs_xfs -f -i projid32bit=0 2>&1 >/dev/null \
+        _scratch_mkfs_xfs -f -i projid32bit=0 >/dev/null 2>&1 \
 	   || _notrun "mkfs.xfs doesn't have projid32bit feature"
 }
 
diff --git a/common/repair b/common/repair
index db160bb..243f70f 100644
--- a/common/repair
+++ b/common/repair
@@ -80,6 +80,8 @@ s/\s+- \d+:\d\d:\d\d:.*\n//g;
 # crc enabled filesystem output
 /XFS_CORRUPTION_ERROR/ && next;
 /^bad uuid/ && next;
+/^Version 5 superblock detected./ && next;
+/^Use of these features/ && next;
 	print;'
 }
 
diff --git a/tests/xfs/004 b/tests/xfs/004
index 978943d..e491b5f 100755
--- a/tests/xfs/004
+++ b/tests/xfs/004
@@ -41,7 +41,8 @@ trap "_cleanup" 0 1 2 3 15
 _populate_scratch()
 {
 	echo "=== mkfs output ===" >>$seqres.full
-	_scratch_mkfs_xfs | tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs
+	_scratch_mkfs_xfs 2> /dev/null | tee -a $seqres.full \
+			| _filter_mkfs 2>$tmp.mkfs || _fail "mkfs failed"
 	. $tmp.mkfs
 	_scratch_mount
 	dd if=/dev/zero of=$SCRATCH_MNT/foo count=200 bs=4096 >/dev/null 2>&1 &
diff --git a/tests/xfs/021 b/tests/xfs/021
index a727b51..46a3f1b 100755
--- a/tests/xfs/021
+++ b/tests/xfs/021
@@ -83,7 +83,7 @@ rm -f $seqres.full
 umount $SCRATCH_DEV >/dev/null 2>&1
 
 echo "*** mkfs"
-_scratch_mkfs_xfs >/dev/null \
+_scratch_mkfs_xfs >/dev/null 2>&1 \
 	|| _fail "mkfs failed"
 
 echo "*** mount FS"
diff --git a/tests/xfs/029 b/tests/xfs/029
index 0709fce..3992c94 100755
--- a/tests/xfs/029
+++ b/tests/xfs/029
@@ -58,7 +58,7 @@ _supported_os Linux
 _require_scratch
 
 echo
-_scratch_mkfs_xfs | _filter_mkfs 2>/dev/null
+_scratch_mkfs_xfs > /dev/null 2>&1 || _fail "mkfs failed"
 
 echo
 _scratch_xfs_logprint | _filter_logprint
diff --git a/tests/xfs/030 b/tests/xfs/030
index af03166..2321da4 100755
--- a/tests/xfs/030
+++ b/tests/xfs/030
@@ -74,7 +74,7 @@ DSIZE="-dsize=100m,agcount=6"
 # superblock (hanging around from earlier tests)...
 #
 
-_scratch_mkfs_xfs $DSIZE >/dev/null 2>&1
+_scratch_mkfs_xfs $DSIZE >/dev/null 2>&1 || _fail "mkfs failed"
 if [ $? -ne 0 ]		# probably don't have a big enough scratch
 then
 	_notrun "SCRATCH_DEV too small, results would be non-deterministic"
@@ -98,7 +98,8 @@ src/devzero -v -1 -n "$clear" $SCRATCH_DEV >/dev/null
 
 # now kick off the real repair test...
 #
-_scratch_mkfs_xfs $DSIZE | _filter_mkfs 2>$tmp.mkfs
+_scratch_mkfs_xfs $DSIZE 2>/dev/null | _filter_mkfs 2>$tmp.mkfs\
+		|| _fail "mkfs failed"
 . $tmp.mkfs
 _check_ag 0
 _check_ag -1
diff --git a/tests/xfs/031 b/tests/xfs/031
index 48a97e1..3fd5b3a 100755
--- a/tests/xfs/031
+++ b/tests/xfs/031
@@ -56,6 +56,8 @@ _check_repair()
 		fi
 		# echo all interesting stuff...
 		perl -ne '
+			/EXPERIMENTAL/d;
+			/Use of these features/d;
 			s/(rebuilding directory inode) (\d+)/\1 INO/g;
 			s/internal log/<TYPEOF> log/g;
 			s/external log on \S+/<TYPEOF> log/g;
@@ -104,7 +106,7 @@ _require_no_large_scratch_dev
 # Note: must do this proto/mkfs now for later inode size calcs
 _create_proto 0
 echo "=== one entry (shortform)"
-_scratch_mkfs_xfs -p $tmp.proto >$tmp.mkfs0 2>&1
+_scratch_mkfs_xfs -p $tmp.proto >$tmp.mkfs0 2>&1 || _fail "mkfs failed"
 _filter_mkfs <$tmp.mkfs0 >/dev/null 2>$tmp.mkfs
 . $tmp.mkfs
 _check_repair
@@ -112,13 +114,15 @@ _check_repair
 # block-form root directory & repeat
 _create_proto 20
 echo "=== twenty entries (block form)"
-_scratch_mkfs_xfs -p $tmp.proto | _filter_mkfs >/dev/null 2>&1
+_scratch_mkfs_xfs -p $tmp.proto 2> /dev/null | _filter_mkfs >/dev/null 2>&1 \
+		|| _fail "mkfs failed"
 _check_repair
 
 # leaf-form root directory & repeat
 _create_proto 1000
 echo "=== thousand entries (leaf form)"
-_scratch_mkfs_xfs -p $tmp.proto | _filter_mkfs >/dev/null 2>&1
+_scratch_mkfs_xfs -p $tmp.proto | _filter_mkfs >/dev/null 2>&1 \
+		|| _fail "mkfs failed"
 _check_repair
 
 # success, all done
diff --git a/tests/xfs/033 b/tests/xfs/033
index bf906e0..3b69018 100755
--- a/tests/xfs/033
+++ b/tests/xfs/033
@@ -81,10 +81,12 @@ _require_scratch
 _require_no_large_scratch_dev
 
 # devzero blows away 512byte blocks, so make 512byte inodes (at least)
-_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
+_scratch_mkfs_xfs 2> /dev/null | _filter_mkfs 2>$tmp.mkfs \
+		|| _fail "mkfs failed"
 . $tmp.mkfs
 [ $isize -lt 512 ] && \
-	_scratch_mkfs_xfs -isize=512 | _filter_mkfs >/dev/null 2>&1
+	_scratch_mkfs_xfs -isize=512 2> /dev/null \
+		| _filter_mkfs >/dev/null 2>&1 || _fail "mkfs failed"
 
 `xfs_db -r -c sb -c p $SCRATCH_DEV | grep 'ino = ' | \
 	sed -e 's/ //g' -e 's/^/export /'`
diff --git a/tests/xfs/041 b/tests/xfs/041
index 8b109fc..f25975a 100755
--- a/tests/xfs/041
+++ b/tests/xfs/041
@@ -63,8 +63,9 @@ _do_die_on_error=message_only
 rm -f $seqres.full
 agsize=32
 echo -n "Make $agsize megabyte filesystem on SCRATCH_DEV and mount... "
-_scratch_mkfs_xfs -dsize=${agsize}m,agcount=1 2>&1 >/dev/null || _fail "mkfs failed"
-bsize=`_scratch_mkfs_xfs -dsize=${agsize}m,agcount=1 2>&1 | _filter_mkfs 2>&1 \
+_scratch_mkfs_xfs -dsize=${agsize}m,agcount=1 >/dev/null 2>&1 || _fail "mkfs failed"
+bsize=`_scratch_mkfs_xfs -dsize=${agsize}m,agcount=1 2> /dev/null \
+		|_filter_mkfs 2>&1 \
 		| perl -ne 'if (/dbsize=(\d+)/) {print $1;}'`
 onemeginblocks=`expr 1048576 / $bsize`
 _scratch_mount || _fail "mount failed"
diff --git a/tests/xfs/042 b/tests/xfs/042
index db0fa28..bb9ab03 100755
--- a/tests/xfs/042
+++ b/tests/xfs/042
@@ -91,7 +91,7 @@ rm -f $seqres.full
 _do_die_on_error=message_only
 
 echo -n "Make a 48 megabyte filesystem on SCRATCH_DEV and mount... "
-_scratch_mkfs_xfs -dsize=48m,agcount=3 2>&1 >/dev/null || _fail "mkfs failed"
+_scratch_mkfs_xfs -dsize=48m,agcount=3 >/dev/null 2>&1 || _fail "mkfs failed"
 _scratch_mount || _fail "mount failed" 
 
 echo "done"
diff --git a/tests/xfs/050 b/tests/xfs/050
index 6641e7d..6339042 100755
--- a/tests/xfs/050
+++ b/tests/xfs/050
@@ -116,7 +116,8 @@ _qsetup()
 
 _exercise()
 {
-	_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
+	_scratch_mkfs_xfs 2> /dev/null | _filter_mkfs 2>$tmp.mkfs \
+			|| _fail "mkfs failed"
 	cat $tmp.mkfs >>$seqres.full
 
 	# keep the blocksize and data size for dd later
diff --git a/tests/xfs/052 b/tests/xfs/052
index c2cf596..f2dec2c 100755
--- a/tests/xfs/052
+++ b/tests/xfs/052
@@ -59,7 +59,8 @@ _require_nobody
 # setup a default run
 _qmount_option uquota
 
-_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
+_scratch_mkfs_xfs 2> /dev/null | _filter_mkfs 2>$tmp.mkfs \
+		|| _fail "mkfs failed"
 cat $tmp.mkfs >>$seqres.full
 chmod a+w $seqres.full     # arbitrary users will write here
 
diff --git a/tests/xfs/067 b/tests/xfs/067
index 27f5713..fd664b6 100755
--- a/tests/xfs/067
+++ b/tests/xfs/067
@@ -47,10 +47,10 @@ _require_scratch
 
 # set up fs for 1K inodes
 isize=0
-_scratch_mkfs_xfs | _filter_mkfs >$seqres.full 2>$tmp.mkfs
+_scratch_mkfs_xfs 2>&1 | _filter_mkfs >$seqres.full 2>$tmp.mkfs
 [ $? -eq 0 ] && source $tmp.mkfs
 if [ "$isize" -lt 1024 ]; then
-    _scratch_mkfs_xfs -i size=1024 >>$seqres.full \
+    _scratch_mkfs_xfs -i size=1024 >>$seqres.full 2>&1 \
 	|| _notrun "Cannot mkfs for this test using MKFS_OPTIONS specified"
 fi
 _scratch_mount >>$seqres.full || _fail "mount failed"
diff --git a/tests/xfs/071 b/tests/xfs/071
index 86c6899..0aeb8d6 100755
--- a/tests/xfs/071
+++ b/tests/xfs/071
@@ -105,7 +105,8 @@ _supported_os IRIX Linux
 [ -n "$XFS_IO_PROG" ] || _notrun "xfs_io executable not found"
 
 _require_scratch
-_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
+_scratch_mkfs_xfs 2> /dev/null | _filter_mkfs 2>$tmp.mkfs \
+		|| _fail "mkfs failed"
 . $tmp.mkfs
 echo
 _scratch_mount
diff --git a/tests/xfs/072 b/tests/xfs/072
index 9949749..e71bb08 100755
--- a/tests/xfs/072
+++ b/tests/xfs/072
@@ -51,9 +51,8 @@ _supported_os IRIX Linux
 _require_scratch
 
 rm -f $seqres.full
-umount $SCRATCH_DEV >/dev/null 2>&1
 
-_scratch_mkfs_xfs >/dev/null	|| _fail "mkfs failed"
+_scratch_mkfs_xfs >/dev/null 2>&1 || _fail "mkfs failed"
 _scratch_mount >/dev/null	|| _fail "mount failed"
 
 # check there's enough freespace on $SCRATCH_MNT ... (1GiB + 1MiB)
diff --git a/tests/xfs/073 b/tests/xfs/073
index ad38059..caffd13 100755
--- a/tests/xfs/073
+++ b/tests/xfs/073
@@ -133,7 +133,8 @@ _supported_os Linux
 _require_scratch
 _require_loop
 
-_scratch_mkfs_xfs -dsize=41m,agcount=2 | _filter_mkfs 2>/dev/null
+_scratch_mkfs_xfs -dsize=41m,agcount=2 2> /dev/null | _filter_mkfs 2>/dev/null \
+		|| _fail "mkfs failed"
 _scratch_mount 2>/dev/null || _fail "initial scratch mount failed"
 
 echo
@@ -143,17 +144,20 @@ umount $SCRATCH_MNT 2>/dev/null
 
 echo
 echo === copying scratch device to single target
-$XFS_COPY_PROG $SCRATCH_DEV $imgs.image | _filter_copy '#' $imgs.image '#' '#'
+$XFS_COPY_PROG $SCRATCH_DEV $imgs.image 2> /dev/null \
+	| _filter_copy '#' $imgs.image '#' '#'
 _verify_copy $imgs.image $SCRATCH_DEV $SCRATCH_MNT
 
 echo
 echo === copying scratch device to single target, duplicate UUID
-$XFS_COPY_PROG -d $SCRATCH_DEV $imgs.image | _filter_copy '#' $imgs.image '#' '#'
+$XFS_COPY_PROG -d $SCRATCH_DEV $imgs.image 2> /dev/null \
+	| _filter_copy '#' $imgs.image '#' '#'
 _verify_copy $imgs.image $SCRATCH_DEV $SCRATCH_MNT
 
 echo 
 echo === copying scratch device to single target, large ro device
-${MKFS_PROG}.xfs -dfile,name=$imgs.source,size=100g | _filter_mkfs 2>/dev/null
+${MKFS_PROG}.xfs -dfile,name=$imgs.source,size=100g 2> /dev/null \
+		| _filter_mkfs 2>/dev/null
 rmdir $imgs.source_dir 2>/dev/null
 mkdir $imgs.source_dir
 
@@ -161,7 +165,8 @@ mount -t xfs -o loop $imgs.source $imgs.source_dir
 loop2=`mount | grep $imgs.source | grep -o -e 'loop=.*[^),]' | grep -o -e '/.*$'`
 cp -a $here $imgs.source_dir
 mount -t xfs -o remount,ro $imgs.source $imgs.source_dir
-$XFS_COPY_PROG $imgs.source $imgs.image | _filter_copy '#' $imgs.image '#' '#'
+$XFS_COPY_PROG $imgs.source $imgs.image 2> /dev/null \
+	| _filter_copy '#' $imgs.image '#' '#'
 _verify_copy $imgs.image $imgs.source $imgs.source_dir
 
 # HACK WARNING:
@@ -173,7 +178,7 @@ losetup -d $loop2 > /dev/null 2>&1
 echo
 echo === copying scratch device to multiple targets
 $XFS_COPY_PROG -L$imgs.log -b $SCRATCH_DEV $imgs.image1 $imgs.image2 \
-	| _filter_copy '#' $imgs.image1 '#' $imgs.image2
+	2> /dev/null | _filter_copy '#' $imgs.image1 '#' $imgs.image2
 _verify_copy $imgs.image1 $SCRATCH_DEV $SCRATCH_MNT
 _verify_copy $imgs.image2 $SCRATCH_DEV $SCRATCH_MNT
 
diff --git a/tests/xfs/092 b/tests/xfs/092
index f195077..0268785 100755
--- a/tests/xfs/092
+++ b/tests/xfs/092
@@ -50,7 +50,7 @@ _require_scratch
 _require_no_large_scratch_dev
 
 MOUNT_OPTIONS="$MOUNT_OPTIONS -o inode64"
-_scratch_mkfs_xfs | _filter_mkfs 2>/dev/null
+_scratch_mkfs_xfs 2> /dev/null | _filter_mkfs 2>/dev/null || _fail "mkfs failed"
 echo Silence is golden
 
 _scratch_mount
diff --git a/tests/xfs/104 b/tests/xfs/104
index d31cf16..a8d7535 100755
--- a/tests/xfs/104
+++ b/tests/xfs/104
@@ -38,7 +38,8 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 _create_scratch()
 {
 	echo "*** mkfs"
-	_scratch_mkfs_xfs $@ | tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs
+	_scratch_mkfs_xfs $@ 2> /dev/null | tee -a $seqres.full \
+			  | _filter_mkfs 2>$tmp.mkfs || _fail "mkfs failed"
 	. $tmp.mkfs
 
 	echo "*** mount"
@@ -71,7 +72,9 @@ _stress_scratch()
 # real QA test starts here
 _supported_fs xfs
 _require_scratch
-_scratch_mkfs_xfs | tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs
+_scratch_mkfs_xfs 2> /dev/null | tee -a $seqres.full \
+		| _filter_mkfs 2>$tmp.mkfs || _fail "mkfs failed"
+
 . $tmp.mkfs	# extract blocksize and data size for scratch device
 
 endsize=`expr 550 \* 1048576`	# stop after growing this big
diff --git a/tests/xfs/106 b/tests/xfs/106
index 7f97722..421c6cb 100755
--- a/tests/xfs/106
+++ b/tests/xfs/106
@@ -44,7 +44,8 @@ _require_scratch
 _require_xfs_quota
 
 # real QA test starts here
-_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
+_scratch_mkfs_xfs 2> /dev/null | _filter_mkfs 2>$tmp.mkfs \
+		|| _fail "mkfs failed"
 cat $tmp.mkfs >$seqres.full
 . $tmp.mkfs
 
diff --git a/tests/xfs/107 b/tests/xfs/107
index 2bd20a3..87f93e9 100755
--- a/tests/xfs/107
+++ b/tests/xfs/107
@@ -56,7 +56,8 @@ _require_scratch
 _require_xfs_quota
 
 # real QA test starts here
-_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
+_scratch_mkfs_xfs 2> /dev/null | _filter_mkfs 2>$tmp.mkfs \
+		|| _fail "mkfs failed"
 cat $tmp.mkfs >$seqres.full
 . $tmp.mkfs
 
diff --git a/tests/xfs/108 b/tests/xfs/108
index 5a47009..81f7527 100755
--- a/tests/xfs/108
+++ b/tests/xfs/108
@@ -83,7 +83,8 @@ _require_prjquota $SCRATCH_DEV
 # real QA test starts here
 rm -f $tmp.projects $seqres.full
 umount $SCRATCH_DEV 2>/dev/null
-_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
+_scratch_mkfs_xfs 2> /dev/null | _filter_mkfs 2>$tmp.mkfs \
+		|| _fail "mkfs failed"
 cat $tmp.mkfs >>$seqres.full
 _scratch_mount
 
diff --git a/tests/xfs/109 b/tests/xfs/109
index 5578c90..55282f9 100755
--- a/tests/xfs/109
+++ b/tests/xfs/109
@@ -102,7 +102,8 @@ if [ -n "$FASTSTART" -a -f $SCRATCH_MNT/f0 ]; then
 fi
 umount $SCRATCH_DEV
 
-_scratch_mkfs_xfs -dsize=160m,agcount=4 $faststart | _filter_mkfs 2>$tmp.mkfs
+_scratch_mkfs_xfs -dsize=160m,agcount=4 $faststart 2> /dev/null \
+			| _filter_mkfs 2>$tmp.mkfs || _fail "mkfs failed"
 cat $tmp.mkfs >>$seqres.full
 _scratch_mount
 
diff --git a/tests/xfs/110 b/tests/xfs/110
index 48bea45..36497e7 100755
--- a/tests/xfs/110
+++ b/tests/xfs/110
@@ -42,7 +42,8 @@ _require_scratch
 
 # real QA test starts here
 umount $SCRATCH_DEV 2>/dev/null
-_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
+_scratch_mkfs_xfs 2> /dev/null | _filter_mkfs 2>$tmp.mkfs \
+		|| _fail "mkfs failed"
 
 STR1=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 STR2=BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
diff --git a/tests/xfs/118 b/tests/xfs/118
index 8414594..9e9b173 100755
--- a/tests/xfs/118
+++ b/tests/xfs/118
@@ -72,7 +72,7 @@ _chowning_file()
 }
 
 echo "mkfs on scratch"
-_scratch_mkfs_xfs >$seqres.full
+_scratch_mkfs_xfs >$seqres.full 2> /dev/null || _fail "mkfs failed"
 
 echo "mount with quotas"
 export MOUNT_OPTIONS="-o uquota"
diff --git a/tests/xfs/178 b/tests/xfs/178
index 9db8d05..4efba35 100755
--- a/tests/xfs/178
+++ b/tests/xfs/178
@@ -74,7 +74,7 @@ _supported_os Linux
 #             fix filesystem, new mkfs.xfs will be fine.
 
 _require_scratch
-_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs \
+_scratch_mkfs_xfs 2> /dev/null | _filter_mkfs 2>$tmp.mkfs \
         || _fail "mkfs failed!"
 
 # By executing the followint tmp file, will get on the mkfs options stored in
diff --git a/tests/xfs/189 b/tests/xfs/189
index 27bfb63..81139b2 100755
--- a/tests/xfs/189
+++ b/tests/xfs/189
@@ -241,7 +241,8 @@ _require_scratch
 unset SCRATCH_RTDEV
 unset SCRATCH_LOGDEV
 
-_scratch_mkfs_xfs | _filter_mkfs 2>/dev/null
+_scratch_mkfs_xfs 2> /dev/null | _filter_mkfs 2>/dev/null \
+	|| _fail "mkfs failed"
 
 _add_scratch_fstab
 _test_remount_rw
diff --git a/tests/xfs/244 b/tests/xfs/244
index d899a3d..7d2a2d3 100755
--- a/tests/xfs/244
+++ b/tests/xfs/244
@@ -52,7 +52,8 @@ _require_projid32bit
 export MOUNT_OPTIONS="-opquota"
 
 # make fs with no projid32bit
-_scratch_mkfs_xfs -i projid32bit=0 >> $seqres.full || _fail "mkfs failed"
+_scratch_mkfs_xfs -i projid32bit=0 2> /dev/null >> $seqres.full \
+		|| _fail "mkfs failed"
 _qmount
 # make sure project quota is supported
 _require_prjquota ${SCRATCH_DEV}
@@ -96,7 +97,8 @@ fi
 
 #  Do testing on filesystem with projid32bit feature enabled
 umount $SCRATCH_DEV 2>/dev/null
-_scratch_mkfs_xfs -i projid32bit=1 >> $seqres.full || _fail "mkfs failed"
+_scratch_mkfs_xfs -i projid32bit=1 >> $seqres.full 2> /dev/null \
+		|| _fail "mkfs failed"
 _qmount
 mkdir $dir
 
diff --git a/tests/xfs/287 b/tests/xfs/287
index 10853d1..9de0b3d 100755
--- a/tests/xfs/287
+++ b/tests/xfs/287
@@ -58,8 +58,8 @@ _require_scratch
 _require_projid32bit
 
 # create xfs fs without projid32bit ability, will be gained by xfs_admin
-_scratch_mkfs_xfs -i projid32bit=0 -d size=200m >> $seqres.full \
-		|| _fail "mkfs failed"
+_scratch_mkfs_xfs -i projid32bit=0 -d size=200m 2> /dev/null >> $seqres.full \
+		 || _fail "mkfs failed"
 _qmount_option "pquota"
 _qmount
 # require project quotas
-- 
1.7.10.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/6] xfstests: xfs/253 doesn't use seqres correctly
  2013-06-07 13:06 [PATCH 0/6] xfstests: various fixes Dave Chinner
  2013-06-07 13:06 ` [PATCH 1/6] xfstests: generic/193 runs tests in wrong location Dave Chinner
  2013-06-07 13:06 ` [PATCH 2/6] xfstests: ensure all mkfs output is redirected properly Dave Chinner
@ 2013-06-07 13:06 ` Dave Chinner
  2013-06-25 20:27   ` Ben Myers
  2013-06-07 13:06 ` [PATCH 4/6] xfstests: Make 204 work with different block and inode sizes Dave Chinner
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Dave Chinner @ 2013-06-07 13:06 UTC (permalink / raw)
  To: xfs

From: Dave Chinner <dchinner@redhat.com>

It was missed when converting all the tests as it was using
${seq}.full and none of the regexes matched it. Fix it up to direct
the output to the correct place.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 tests/xfs/253 |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/tests/xfs/253 b/tests/xfs/253
index 98c61d6..f491ef4 100755
--- a/tests/xfs/253
+++ b/tests/xfs/253
@@ -71,6 +71,8 @@ function create_file() {
 
 echo "Disciplyne of silence is goed."
 
+rm -f $seqres.full
+
 _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
 
@@ -162,11 +164,11 @@ mv "${TEMP_ORPHAN}" "${ORPHAN}"
 touch "${NON_ORPHAN}"
 
 # Get a listing of all the files before obfuscation
-ls -R >> "${seq}.full"
-ls -R | od -c >> "${seq}.full"
+ls -R >> $seqres.full
+ls -R | od -c >> $seqres.full
 
 # Now unmount the filesystem and create a metadump file
-cd /; sync; sync		# Old school
+cd $here
 
 _scratch_unmount
 
@@ -178,9 +180,9 @@ xfs_mdrestore "${METADUMP_FILE}" "${SCRATCH_DEV}"
 _scratch_mount
 
 # Get a listing of all the files after obfuscation
-cd "${SCRATCH_MNT}"
-ls -R >> "${seq}.full"
-ls -R | od -c >> "${seq}.full"
+cd ${SCRATCH_MNT}
+ls -R >> $seqres.full
+ls -R | od -c >> $seqres.full
 
 # Finally, re-make the filesystem since to ensure we don't
 # leave a directory with duplicate entries lying around.
-- 
1.7.10.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/6] xfstests: Make 204 work with different block and inode sizes.
  2013-06-07 13:06 [PATCH 0/6] xfstests: various fixes Dave Chinner
                   ` (2 preceding siblings ...)
  2013-06-07 13:06 ` [PATCH 3/6] xfstests: xfs/253 doesn't use seqres correctly Dave Chinner
@ 2013-06-07 13:06 ` Dave Chinner
  2013-06-07 13:06 ` [PATCH 5/6] xfstests: New _require_* tests for CRC enabled filesystems Dave Chinner
  2013-06-07 13:06 ` [PATCH 6/6] xfstests: add a multithreaded mode to bstat Dave Chinner
  5 siblings, 0 replies; 14+ messages in thread
From: Dave Chinner @ 2013-06-07 13:06 UTC (permalink / raw)
  To: xfs

From: Dave Chinner <dchinner@redhat.com>

Otherwise it fails with ENOSPC on CRC enabled filesystems because
ofhte larger inode size.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 common/filter     |   10 +++++++++-
 tests/generic/204 |   37 ++++++++++++++++++++++++++++++++-----
 2 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/common/filter b/common/filter
index dbb1674..1bf9e9c 100644
--- a/common/filter
+++ b/common/filter
@@ -131,9 +131,17 @@ _filter_date()
 }
 
 # prints filtered output on stdout, values (use eval) on stderr
-# 
+# Non XFS filesystems always return a 4k block size and a 256 byte inode.
 _filter_mkfs()
 {
+    case $FSTYP in
+    xfs)
+	;;
+    *)
+	perl -e 'print STDERR "dbsize=4096\nisize=256\n"'
+	return ;;
+    esac
+
     set -
     perl -ne '
     if (/^meta-data=([\w,|\/.-]+)\s+isize=(\d+)\s+agcount=(\d+), agsize=(\d+) blks/) {
diff --git a/tests/generic/204 b/tests/generic/204
index 62bd248..ecc9923 100755
--- a/tests/generic/204
+++ b/tests/generic/204
@@ -28,6 +28,12 @@ echo "QA output created by $seq"
 here=`pwd`
 tmp=/tmp/$$
 status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	rm -f $tmp.*
+}
 
 # get standard environment, filters and checks
 . ./common/rc
@@ -39,20 +45,41 @@ _supported_os Linux
 
 _require_scratch
 
+rm -f $seqres.full
+
+# get the block size first
+_scratch_mkfs 2> /dev/null | _filter_mkfs 2> $tmp.mkfs > /dev/null
+. $tmp.mkfs
+
 SIZE=`expr 104 \* 1024 \* 1024`
-_scratch_mkfs_sized $SIZE  &> /dev/null
+_scratch_mkfs_sized $SIZE $dbsize 2> /dev/null \
+		| _filter_mkfs 2> $tmp.mkfs > /dev/null
 _scratch_mount
 
+. $tmp.mkfs
+
 # fix the reserve block pool to a known size so that the enospc calculations
-# work out correctly.
-_scratch_resvblks 1024 > $seqres.full 2>&1
+# work out correctly. Space usages is based 22500 files and 1024 reserved blocks
+# on a 4k block size 256 byte inode size filesystem.
+resv_blks=1024
+space=97920000
 
-for i in `seq 1 22500`; do
+# decrease files for inode size.
+#	22500 * (256 + 4k) = ~97MB
+#	files * (isize + bsize) = 97MB
+#	files = (97920000 / (isize + bsize))
+
+files=$((space / (isize + dbsize)))
+resv_blks=$((resv_blks * (4096 / dbsize)))
+
+echo files $files, resvblks $resv_blks >> $seqres.full
+_scratch_resvblks $resv_blks >> $seqres.full 2>&1
+
+for i in `seq 1 $files`; do
     echo -n > $SCRATCH_MNT/$i
     echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX > $SCRATCH_MNT/$i
 done
 
 # success, all done
 echo "*** done"
-rm -f $seqres.full
 status=0
-- 
1.7.10.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/6] xfstests: New _require_* tests for CRC enabled filesystems
  2013-06-07 13:06 [PATCH 0/6] xfstests: various fixes Dave Chinner
                   ` (3 preceding siblings ...)
  2013-06-07 13:06 ` [PATCH 4/6] xfstests: Make 204 work with different block and inode sizes Dave Chinner
@ 2013-06-07 13:06 ` Dave Chinner
  2013-10-17 21:24   ` Eric Sandeen
  2013-06-07 13:06 ` [PATCH 6/6] xfstests: add a multithreaded mode to bstat Dave Chinner
  5 siblings, 1 reply; 14+ messages in thread
From: Dave Chinner @ 2013-06-07 13:06 UTC (permalink / raw)
  To: xfs

From: Dave Chinner <dchinner@redhat.com>

CRCs always enabled 32 bit project inodes and attr2 formats, hence
they cannot be turned off. Add new require rules for the tests that
require attr and 16 bit project IDs so these tests are avoided on
CRC enabled filesystems.

Also, add a xfs_db write check so that we can avoid tests that are
dependent on xfs_db modifying filesystem structures as they will
fail on CRC enabled filessystems right now. This is just temporary
until full write xfs_db support is available.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 common/attr      |    6 ++++++
 common/rc        |   26 +++++++++++++++++++++++---
 tests/shared/298 |    2 +-
 tests/xfs/044    |    1 +
 tests/xfs/045    |    1 +
 tests/xfs/186    |    2 ++
 tests/xfs/187    |   13 +++++++------
 tests/xfs/199    |    1 +
 tests/xfs/244    |    1 +
 tests/xfs/278    |    2 ++
 tests/xfs/287    |    4 +++-
 tests/xfs/291    |    2 +-
 12 files changed, 49 insertions(+), 12 deletions(-)

diff --git a/common/attr b/common/attr
index e5070bf..1ab5014 100644
--- a/common/attr
+++ b/common/attr
@@ -176,6 +176,12 @@ _require_attrs()
     rm -f $TEST_DIR/syscalltest.out
 }
 
+_require_attr_v1()
+{
+	scratch_mkfs_xfs -f -i attr=1 > /dev/null 2>&1 \
+		|| _notrun "attr v1 not supported"
+}
+
 # getfattr -R returns info in readdir order which varies from fs to fs.
 # This sorts the output by filename
 _sort_getfattr_output()
diff --git a/common/rc b/common/rc
index 88d38ef..b2ad2a0 100644
--- a/common/rc
+++ b/common/rc
@@ -1074,14 +1074,34 @@ _require_dm_flakey()
 }
 
 # this test requires the projid32bit feature to be available in
-# mkfs.xfs
-#
+# mkfs.xfs. We need to open code the mkfs test because _scratch_mkfs_xfs
+# will drop command line mkfs options to ensure that it succeeds, hence
+# not actually testing the configuration we desire to be tested for support.
 _require_projid32bit()
 {
-        _scratch_mkfs_xfs -f -i projid32bit=0 >/dev/null 2>&1 \
+    _scratch_options mkfs
+
+    $MKFS_XFS_PROG $SCRATCH_OPTIONS $MKFS_OPTIONS \
+		-f -i projid32bit=1 $SCRATCH_DEV >/dev/null 2>&1 \
 	   || _notrun "mkfs.xfs doesn't have projid32bit feature"
 }
 
+_require_projid16bit()
+{
+    _scratch_options mkfs
+
+    $MKFS_XFS_PROG $SCRATCH_OPTIONS $MKFS_OPTIONS \
+		-f -i projid32bit=0 $SCRATCH_DEV >/dev/null 2>&1 \
+	   || _notrun "16 bit project IDs not supported on $SCRATCH_DEV"
+}
+
+# This test requires xfs_db write support
+_require_xfs_db_write()
+{
+	$XFS_DB_PROG $TEST_DEV > /dev/null 2>&1 \
+		|| _notrun "xfs_db write support required."
+}
+
 # this test requires that external log/realtime devices are not in use
 #
 _require_nonexternal()
diff --git a/tests/shared/298 b/tests/shared/298
index 4541798..6b5402c 100755
--- a/tests/shared/298
+++ b/tests/shared/298
@@ -70,7 +70,7 @@ get_free_sectors()
 	agsize=`xfs_info $loop_mnt | $SED_PROG -n 's/.*agsize=\(.*\) blks.*/\1/p'`
 	# Convert free space (agno, block, length) to (start sector, end sector)
 	$UMOUNT_PROG $loop_mnt
-	$XFS_DB_PROG -c "freesp -d" $img_file | $SED_PROG '/^.*from/,$d'| \
+	$XFS_DB_PROG -r -c "freesp -d" $img_file | $SED_PROG '/^.*from/,$d'| \
 		 $AWK_PROG -v spb=$sectors_per_block -v agsize=$agsize \
 		'{ print spb * ($1 * agsize + $2), spb * ($1 * agsize + $2 + $3) - 1 }'
 	;;
diff --git a/tests/xfs/044 b/tests/xfs/044
index a84af22..cf575f8 100755
--- a/tests/xfs/044
+++ b/tests/xfs/044
@@ -44,6 +44,7 @@ _supported_fs xfs
 _supported_os Linux
 
 _require_logdev
+_require_xfs_db_write
 
 _filter_logprint()
 {
diff --git a/tests/xfs/045 b/tests/xfs/045
index 84ca802..17d2391 100755
--- a/tests/xfs/045
+++ b/tests/xfs/045
@@ -45,6 +45,7 @@ _supported_fs xfs
 _supported_os Linux
 
 _require_scratch
+_require_xfs_db_write
 
 echo "*** get uuid"
 uuid=`_get_existing_uuid`
diff --git a/tests/xfs/186 b/tests/xfs/186
index 960aed1..71f2a31 100755
--- a/tests/xfs/186
+++ b/tests/xfs/186
@@ -147,6 +147,8 @@ _supported_os Linux
 
 _require_scratch
 _require_attrs
+_require_attr_v1
+_require_xfs_db_write
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/187 b/tests/xfs/187
index 9cf1305..415ab11 100755
--- a/tests/xfs/187
+++ b/tests/xfs/187
@@ -58,6 +58,7 @@ _supported_os Linux
 
 _require_scratch
 _require_attrs
+_require_attr_v1
 
 rm -f $seqres.full
 
@@ -87,13 +88,13 @@ echo ""
 echo "attr2 fs"
 echo ""
 _scratch_mkfs -i attr=2 -l lazy-count=0 >/dev/null 2>&1
-$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
 echo ""
 echo "noattr2 fs"
 echo ""
 _scratch_mount -o noattr2
 $UMOUNT_PROG $SCRATCH_MNT
-$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
 
 # adding an EA will ensure the ATTR1 flag is turned on
 echo ""
@@ -102,7 +103,7 @@ echo ""
 echo "attr2 fs"
 echo ""
 _scratch_mkfs -i attr=2 -l lazy-count=0 >/dev/null 2>&1
-$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
 echo ""
 echo "noattr2 fs"
 echo ""
@@ -113,7 +114,7 @@ $SETFATTR_PROG -n user.test -v 0xbabe testfile
 $GETFATTR_PROG testfile
 cd $here
 $UMOUNT_PROG $SCRATCH_MNT
-$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
 
 echo ""
 echo "*** 3. test noattr2 mount and lazy sb ***"
@@ -122,7 +123,7 @@ echo ""
 echo "attr2 fs"
 echo ""
 _scratch_mkfs -i attr=2 -l lazy-count=1 >/dev/null 2>&1
-$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
 echo ""
 echo "noattr2 fs"
 echo ""
@@ -131,7 +132,7 @@ cd $SCRATCH_MNT
 touch testfile
 cd $here
 $UMOUNT_PROG $SCRATCH_MNT
-$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
 
 # success, all done
 status=0
diff --git a/tests/xfs/199 b/tests/xfs/199
index 1d64e02..0ab0dba 100755
--- a/tests/xfs/199
+++ b/tests/xfs/199
@@ -48,6 +48,7 @@ _supported_fs xfs
 _supported_os Linux
 
 _require_scratch
+_require_xfs_db_write
 
 _scratch_mkfs_xfs -l lazy-count=1 >/dev/null 2>&1
 
diff --git a/tests/xfs/244 b/tests/xfs/244
index 7d2a2d3..90291fb 100755
--- a/tests/xfs/244
+++ b/tests/xfs/244
@@ -48,6 +48,7 @@ _supported_fs xfs
 _require_xfs_quota
 _require_scratch
 _require_projid32bit
+_require_projid16bit
 
 export MOUNT_OPTIONS="-opquota"
 
diff --git a/tests/xfs/278 b/tests/xfs/278
index 938717d..e6f9289 100755
--- a/tests/xfs/278
+++ b/tests/xfs/278
@@ -46,6 +46,8 @@ _cleanup()
 _supported_fs xfs
 _supported_os Linux
 _require_scratch
+_require_xfs_db_write
+
 _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
 
diff --git a/tests/xfs/287 b/tests/xfs/287
index 9de0b3d..febc3af 100755
--- a/tests/xfs/287
+++ b/tests/xfs/287
@@ -45,7 +45,7 @@ _cleanup()
 
 _print_projid()
 {
-	$XFS_DB_PROG -c "inode $1" \
+	$XFS_DB_PROG -r -c "inode $1" \
 		-c "print core.projid_lo" \
 		-c "print core.projid_hi" \
 		$SCRATCH_DEV
@@ -56,6 +56,8 @@ _supported_fs xfs
 _require_xfs_quota
 _require_scratch
 _require_projid32bit
+_require_projid16bit
+_require_xfs_db_write	# for xfs_admin
 
 # create xfs fs without projid32bit ability, will be gained by xfs_admin
 _scratch_mkfs_xfs -i projid32bit=0 -d size=200m 2> /dev/null >> $seqres.full \
diff --git a/tests/xfs/291 b/tests/xfs/291
index 7723b9e..03c4de9 100755
--- a/tests/xfs/291
+++ b/tests/xfs/291
@@ -70,7 +70,7 @@ xfs_io -f -c "pwrite 0 16m" -c "fsync" $SCRATCH_MNT/space_file.large >> $seqres.
 
 # Take a look at freespace for any post-mortem on the test
 _scratch_unmount
-xfs_db -c freesp $SCRATCH_DEV >> $seqres.full 2>&1
+xfs_db -r -c freesp $SCRATCH_DEV >> $seqres.full 2>&1
 _scratch_mount
 
 # Step 2: Make a bunch of (hopefully fragmented) multiblock
-- 
1.7.10.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 6/6] xfstests: add a multithreaded mode to bstat
  2013-06-07 13:06 [PATCH 0/6] xfstests: various fixes Dave Chinner
                   ` (4 preceding siblings ...)
  2013-06-07 13:06 ` [PATCH 5/6] xfstests: New _require_* tests for CRC enabled filesystems Dave Chinner
@ 2013-06-07 13:06 ` Dave Chinner
  2013-10-17 21:29   ` Eric Sandeen
  5 siblings, 1 reply; 14+ messages in thread
From: Dave Chinner @ 2013-06-07 13:06 UTC (permalink / raw)
  To: xfs

From: Dave Chinner <dchinner@redhat.com>

For benchmarking of bulkstat, add a multithreaded mode that spawns a
thread per AG and runs bulkstat on every AG in parallel. There is a
small amount of overlap between each AG because of the way the
interface works only on inode numbers, so some inodes are reported
twice. A real implementation of this sort of parallelism would be
greatly helped by adding an AG parameter to the bulkstat interface.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 src/Makefile |    2 +-
 src/bstat.c  |  388 +++++++++++++++++++++++++++++++++++++++++++++-------------
 2 files changed, 302 insertions(+), 88 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index c18ffc9..243a432 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -22,7 +22,7 @@ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
 
 SUBDIRS =
 
-LLDLIBS = $(LIBATTR) $(LIBHANDLE) $(LIBACL)
+LLDLIBS = $(LIBATTR) $(LIBHANDLE) $(LIBACL) -lpthread
 
 ifeq ($(HAVE_XLOG_ASSIGN_LSN), true)
 LINUX_TARGETS += loggen
diff --git a/src/bstat.c b/src/bstat.c
index 4e22ecd..0fc7d9d 100644
--- a/src/bstat.c
+++ b/src/bstat.c
@@ -18,6 +18,60 @@
 
 #include "global.h"
 #include <xfs/jdm.h>
+#include <pthread.h>
+
+
+int	debug;
+int	quiet;
+int	statit;
+int	verbose;
+int	threaded;
+
+unsigned int
+libxfs_log2_roundup(unsigned int i)
+{
+	unsigned int    rval;
+
+	for (rval = 0; rval < NBBY * sizeof(i); rval++) {
+		if ((1 << rval) >= i)
+			break;
+	}
+	return rval;
+}
+static inline int fls(int x)
+{
+	int r = 32;
+
+	if (!x)
+		return 0;
+	if (!(x & 0xffff0000u)) {
+		x <<= 16;
+		r -= 16;
+	}
+	if (!(x & 0xff000000u)) {
+		x <<= 8;
+		r -= 8;
+	}
+	if (!(x & 0xf0000000u)) {
+		x <<= 4;
+		r -= 4;
+	}
+	if (!(x & 0xc0000000u)) {
+		x <<= 2;
+		r -= 2;
+	}
+	if (!(x & 0x80000000u)) {
+		x <<= 1;
+		r -= 1;
+	}
+	return r;
+}
+
+static inline int xfs_highbit32(__uint32_t v)
+{
+	return fls(v) - 1;
+}
+
 
 void
 dotime(void *ti, char *s)
@@ -62,87 +116,21 @@ printstat(struct stat64 *sp)
 	dotime(&sp->st_ctime, "ctime");
 }
 
-int
-main(int argc, char **argv)
+static int
+do_bstat(
+	int		fsfd,
+	jdm_fshandle_t	*fshandlep,
+	char		*name,
+	int		nent,
+	__u64		first,
+	__u64		last)
 {
 	__s32		count;
 	int		total = 0;
-	int		fsfd;
-	int		i;
-	__u64		last = 0;
-	char		*name;
-	int		nent;
-	int		debug = 0;
-	int		quiet = 0;
-	int		statit = 0;
-	int		verbose = 0;
 	xfs_bstat_t	*t;
 	int		ret;
-	jdm_fshandle_t	*fshandlep = NULL;
-	int		fd;
-	struct stat64	sb;
-	int nread;
-	char *cc_readlinkbufp;
-	int cc_readlinkbufsz;
-	int 		c;
 	xfs_fsop_bulkreq_t bulkreq;
-
-	while ((c = getopt(argc, argv, "cdl:qv")) != -1) {
-		switch (c) {
-		case 'q':
-			quiet = 1;
-			break;
-		case 'v':
-			verbose = 1;
-			break;
-		case 'c':
-			statit = 1;
-			break;
-		case 'd':
-			debug = 1;
-			break;
-		case 'l':
-			last = atoi(optarg);
-			break;
-		case '?':
-		printf("usage: xfs_bstat [-c] [-q] [-v] [ dir [ batch_size ]]\n");
-		printf("   -c   Check the results against stat(3) output\n");
-		printf("   -q   Quiet\n");
-		printf("   -l _num_  Inode to start with\n");
-		printf("   -v   Verbose output\n");
-			exit(1);
-		}
-	}
-	argc -= optind;
-	argv += optind;
-
-	if (argc < 1)
-		name = ".";
-	else
-		name = *argv;
-
-	fsfd = open(name, O_RDONLY);
-	if (fsfd < 0) {
-		perror(name);
-		exit(1);
-	}
-	if (argc < 2)
-		nent = 4096;
-	else
-		nent = atoi(*++argv);
-
-	if (verbose)
-		printf("Bulkstat test on %s, batch size=%d statcheck=%d\n", 
-			name, nent, statit);
-
-	if (statit) {
-		fshandlep = jdm_getfshandle( name );
-		if (! fshandlep) {
-			printf("unable to construct sys handle for %s: %s\n",
-			  name, strerror(errno));
-			return -1;
-		}
-	}
+	__u64		ino;
 
 	t = malloc(nent * sizeof(*t));
 
@@ -150,23 +138,27 @@ main(int argc, char **argv)
 		printf(
 		  "XFS_IOC_FSBULKSTAT test: last=%lld nent=%d\n", (long long)last, nent);
 
-	bulkreq.lastip  = &last;
+	ino = first;
+
+	bulkreq.lastip  = &ino;
 	bulkreq.icount  = nent;
 	bulkreq.ubuffer = t;
 	bulkreq.ocount  = &count;
 
 	while ((ret = xfsctl(name, fsfd, XFS_IOC_FSBULKSTAT, &bulkreq)) == 0) {
+		int		i;
+
 		total += count;
 
 		if (verbose)
 			printf(
-	    "XFS_IOC_FSBULKSTAT test: last=%lld ret=%d count=%d total=%d\n", 
-						(long long)last, ret, count, total);
+    "XFS_IOC_FSBULKSTAT test: first/last/ino=%lld/%lld/%lld ret=%d count=%d total=%d\n", 
+			(long long)first, (long long)last, (long long)ino, ret, count, total);
 		if (count == 0)
-			exit(0);
+			break;
 
 		if ( quiet && ! statit )
-			continue;
+			goto next;
 
 		for (i = 0; i < count; i++) {
 			if (! quiet) {
@@ -174,6 +166,12 @@ main(int argc, char **argv)
 			}
 	
 			if (statit) {
+				char *cc_readlinkbufp;
+				int cc_readlinkbufsz;
+				struct stat64	sb;
+				int nread;
+				int		fd;
+
 				switch(t[i].bs_mode & S_IFMT) {
 				case S_IFLNK:
 					cc_readlinkbufsz = MAXPATHLEN;
@@ -244,10 +242,231 @@ main(int argc, char **argv)
 				}
 			}
 		}
-
+next:
 		if (debug)
 			break;
+
+		if (ino >= last)
+			break;
 	}
+	if (verbose)
+		printf(
+	    "XFS_IOC_FSBULKSTAT test: last=%lld nent=%d ret=%d count=%d\n", 
+					       (long long)last, nent, ret, count);
+
+	return total;
+}
+
+struct thread_args {
+	pthread_t	tid;
+	int		fsfd;
+	jdm_fshandle_t	*fshandlep;
+	char		*name;
+	int		nent;
+	__u64		first;
+	__u64		last;
+	int		ret;
+};
+
+static void *
+do_bstat_thread(
+	void	*args)
+{
+	struct thread_args *targs = args;
+
+	targs->ret = do_bstat(targs->fsfd, targs->fshandlep, targs->name,
+			      targs->nent, targs->first, targs->last);
+	return NULL;
+}
+
+/*
+ *   XFS_AGINO_TO_INO(mp,a,i)        \
+ *           (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i))
+ *
+ * 	i always zero, so:
+ * 			a << XFS_INO_AGINO_BITS(mp)
+ *
+ *   XFS_INO_AGINO_BITS(mp)          (mp)->m_agino_log
+ *
+ *   mp->m_agino_log = sbp->sb_inopblog + sbp->sb_agblklog
+ *
+ *   sb_inopblog = fsgeom.blocksize / fsgeom.inodesize
+ *   sb_agblklog = (__uint8_t)libxfs_log2_roundup((unsigned int)fsgeom.agblocks);
+ *
+ *	a << (libxfs_highbit32(fsgeom.blocksize /fsgeom.inodesize) +
+ *				libxfs_log2_roundup(fsgeom.agblocks));
+ */
+#define FSGEOM_INOPBLOG(fsg) \
+		(xfs_highbit32((fsg).blocksize / (fsg).inodesize))
+#define FSGEOM_AGINO_TO_INO(fsg, a, i) \
+	(((__u64)(a) << (FSGEOM_INOPBLOG(fsg) + \
+			libxfs_log2_roundup((fsg).agblocks))) | (i))
+
+/*
+ *    XFS_OFFBNO_TO_AGINO(mp,b,o)     \                                        
+ *            ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o)))
+ *
+ *       i always zero, so:
+ *			b << XFS_INO_OFFSET_BITS(mp)
+ *
+ *    XFS_INO_OFFSET_BITS(mp)         (mp)->m_sb.sb_inopblog
+ */
+#define FSGEOM_OFFBNO_TO_AGINO(fsg, b, o) \
+		((__u32)(((b) << FSGEOM_INOPBLOG(fsg)) | (o)))
+static int
+do_threads(
+	int		fsfd,
+	jdm_fshandle_t	*fshandlep,
+	char		*name,
+	int		nent,
+	__u64		first)
+{
+	struct xfs_fsop_geom geom;
+	struct thread_args *targs;
+	int		ret;
+	int		i;
+	int		numthreads;
+	int		total = 0;
+
+
+	/* get number of AGs */
+	ret = ioctl(fsfd, XFS_IOC_FSGEOMETRY, &geom);
+	if (ret) {
+		perror("XFS_IOC_FSGEOMETRY");
+		exit(1);
+	}
+
+	/* allocate thread array */
+	targs = malloc(geom.agcount * sizeof(*targs));
+	if (ret) {
+		perror("malloc(targs)");
+		exit(1);
+	}
+
+	for (i = 0; i < geom.agcount; i++) {
+		__u64 last;
+
+		last = FSGEOM_AGINO_TO_INO(geom, i,
+					   FSGEOM_OFFBNO_TO_AGINO(geom,
+						       geom.agblocks - 1, 0));
+
+		if (first > last) {
+			i--;
+			continue;
+		}
+		first = MAX(first, FSGEOM_AGINO_TO_INO(geom, i, 0));
+
+		targs[i].fsfd = fsfd;
+		targs[i].fshandlep = fshandlep;
+		targs[i].name = name;
+		targs[i].nent = nent;
+		targs[i].first = first;
+		targs[i].last = last;
+		targs[i].ret = 0;
+	}
+	numthreads = i;
+
+	/* start threads */
+	for (i = 0; i< numthreads; i++) {
+		ret = pthread_create(&targs[i].tid, NULL, do_bstat_thread, &targs[i]);
+		if (ret) {
+			perror("pthread-create");
+			exit(1);
+		}
+	}
+
+
+	/* join threads */
+	for (i = 0; i < numthreads; i++) {
+		if (targs[i].tid) {
+			pthread_join(targs[i].tid, NULL);
+			total += targs[i].ret;
+		}
+	}
+
+	/* die */
+	return total;
+}
+
+
+int
+main(int argc, char **argv)
+{
+	int		fsfd;
+	__u64		first = 0;
+	char		*name;
+	int		nent;
+	int		ret;
+	jdm_fshandle_t	*fshandlep = NULL;
+	int 		c;
+
+	while ((c = getopt(argc, argv, "cdl:qtv")) != -1) {
+		switch (c) {
+		case 'q':
+			quiet = 1;
+			break;
+		case 'v':
+			verbose = 1;
+			break;
+		case 'c':
+			statit = 1;
+			break;
+		case 'd':
+			debug = 1;
+			break;
+		case 'l':
+			first = atoi(optarg);
+			break;
+		case 't':
+			threaded = 1;
+			break;
+		case '?':
+		printf("usage: xfs_bstat [-c] [-q] [-v] [ dir [ batch_size ]]\n");
+		printf("   -c   Check the results against stat(3) output\n");
+		printf("   -q   Quiet\n");
+		printf("   -l _num_  Inode to start with\n");
+		printf("   -v   Verbose output\n");
+			exit(1);
+		}
+	}
+	argc -= optind;
+	argv += optind;
+
+	if (argc < 1)
+		name = ".";
+	else
+		name = *argv;
+
+	fsfd = open(name, O_RDONLY);
+	if (fsfd < 0) {
+		perror(name);
+		exit(1);
+	}
+	if (argc < 2)
+		nent = 4096;
+	else
+		nent = atoi(*++argv);
+
+	if (verbose)
+		printf("Bulkstat test on %s, batch size=%d statcheck=%d\n", 
+			name, nent, statit);
+
+	if (statit) {
+		fshandlep = jdm_getfshandle( name );
+		if (! fshandlep) {
+			printf("unable to construct sys handle for %s: %s\n",
+			  name, strerror(errno));
+			return -1;
+		}
+	}
+
+	if (threaded)
+		ret = do_threads(fsfd, fshandlep, name, nent, first);
+	else
+		ret = do_bstat(fsfd, fshandlep, name, nent, first, -1LL);
+
+	if (verbose)
+		printf("Bulkstat found %d inodes\n", ret);
 
 	if (fsfd)
 		close(fsfd);
@@ -255,10 +474,5 @@ main(int argc, char **argv)
 	if (ret < 0 )
 		perror("xfsctl(XFS_IOC_FSBULKSTAT)");
 
-	if (verbose)
-		printf(
-	    "XFS_IOC_FSBULKSTAT test: last=%lld nent=%d ret=%d count=%d\n", 
-					       (long long)last, nent, ret, count);
-
-	return 1;
+	return 0;
 }
-- 
1.7.10.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/6] xfstests: generic/193 runs tests in wrong location
  2013-06-07 13:06 ` [PATCH 1/6] xfstests: generic/193 runs tests in wrong location Dave Chinner
@ 2013-06-25 19:49   ` Ben Myers
  0 siblings, 0 replies; 14+ messages in thread
From: Ben Myers @ 2013-06-25 19:49 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs

On Fri, Jun 07, 2013 at 11:06:33PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> generic/193 runs the test in $here - the root of the xfstests source
> tree/installation. IOWs, it doesn't test the filesystem on either
> the TEST_DIR or SCRATCH_MNT, and so it not testing the filesystem
> we think it is testing. Bad. Fixing this is the majority of the
> change - introducing $test_root and $test_user for the files with
> different owners, and then redirecting error output and filtering
> the output appropriately.
> 
> And then add checks that truncate clears the suid/sgid bits
> appropriately, somethign that has never been tested on XFS (and
> likely other filesystems) so will cause kernels between 3.1 and 3.9
> to assert fail as Dave Jones has recently reported.
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>

Looks good.  The behavior you outlined regarding suid/sgid bits matches that of
should_remove_suid().

Reviewed-by: Ben Myers <bpm@sgi.com>

Applied.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/6] xfstests: xfs/253 doesn't use seqres correctly
  2013-06-07 13:06 ` [PATCH 3/6] xfstests: xfs/253 doesn't use seqres correctly Dave Chinner
@ 2013-06-25 20:27   ` Ben Myers
  0 siblings, 0 replies; 14+ messages in thread
From: Ben Myers @ 2013-06-25 20:27 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs

On Fri, Jun 07, 2013 at 11:06:35PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> It was missed when converting all the tests as it was using
> ${seq}.full and none of the regexes matched it. Fix it up to direct
> the output to the correct place.
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>

Reviewed-by: Ben Myers <bpm@sgi.com>

Applied.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/6] xfstests: New _require_* tests for CRC enabled filesystems
  2013-06-07 13:06 ` [PATCH 5/6] xfstests: New _require_* tests for CRC enabled filesystems Dave Chinner
@ 2013-10-17 21:24   ` Eric Sandeen
  2013-10-18  2:58     ` Dave Chinner
  0 siblings, 1 reply; 14+ messages in thread
From: Eric Sandeen @ 2013-10-17 21:24 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs

On 6/7/13 8:06 AM, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> CRCs always enabled 32 bit project inodes and attr2 formats, hence
> they cannot be turned off. Add new require rules for the tests that
> require attr and 16 bit project IDs so these tests are avoided on
> CRC enabled filesystems.
> 
> Also, add a xfs_db write check so that we can avoid tests that are
> dependent on xfs_db modifying filesystem structures as they will
> fail on CRC enabled filessystems right now. This is just temporary
> until full write xfs_db support is available.
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>

small optimization question below

> ---
>  common/attr      |    6 ++++++
>  common/rc        |   26 +++++++++++++++++++++++---
>  tests/shared/298 |    2 +-
>  tests/xfs/044    |    1 +
>  tests/xfs/045    |    1 +
>  tests/xfs/186    |    2 ++
>  tests/xfs/187    |   13 +++++++------
>  tests/xfs/199    |    1 +
>  tests/xfs/244    |    1 +
>  tests/xfs/278    |    2 ++
>  tests/xfs/287    |    4 +++-
>  tests/xfs/291    |    2 +-
>  12 files changed, 49 insertions(+), 12 deletions(-)
> 
> diff --git a/common/attr b/common/attr
> index e5070bf..1ab5014 100644
> --- a/common/attr
> +++ b/common/attr
> @@ -176,6 +176,12 @@ _require_attrs()
>      rm -f $TEST_DIR/syscalltest.out
>  }
>  
> +_require_attr_v1()
> +{
> +	scratch_mkfs_xfs -f -i attr=1 > /dev/null 2>&1 \

How about adding an "-N" to speed it up if the fs is large?

> +		|| _notrun "attr v1 not supported"
> +}
> +
>  # getfattr -R returns info in readdir order which varies from fs to fs.
>  # This sorts the output by filename
>  _sort_getfattr_output()
> diff --git a/common/rc b/common/rc
> index 88d38ef..b2ad2a0 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -1074,14 +1074,34 @@ _require_dm_flakey()
>  }
>  
>  # this test requires the projid32bit feature to be available in
> -# mkfs.xfs
> -#
> +# mkfs.xfs. We need to open code the mkfs test because _scratch_mkfs_xfs
> +# will drop command line mkfs options to ensure that it succeeds, hence
> +# not actually testing the configuration we desire to be tested for support.
>  _require_projid32bit()
>  {
> -        _scratch_mkfs_xfs -f -i projid32bit=0 >/dev/null 2>&1 \
> +    _scratch_options mkfs
> +
> +    $MKFS_XFS_PROG $SCRATCH_OPTIONS $MKFS_OPTIONS \
> +		-f -i projid32bit=1 $SCRATCH_DEV >/dev/null 2>&1 \
>  	   || _notrun "mkfs.xfs doesn't have projid32bit feature"
>  }

Same here?

> +_require_projid16bit()
> +{
> +    _scratch_options mkfs
> +
> +    $MKFS_XFS_PROG $SCRATCH_OPTIONS $MKFS_OPTIONS \
> +		-f -i projid32bit=0 $SCRATCH_DEV >/dev/null 2>&1 \
> +	   || _notrun "16 bit project IDs not supported on $SCRATCH_DEV"
> +}

and here?  Do we want the mkfs as a side effect?  (that would seem odd...)

> +
> +# This test requires xfs_db write support
> +_require_xfs_db_write()
> +{
> +	$XFS_DB_PROG $TEST_DEV > /dev/null 2>&1 \
> +		|| _notrun "xfs_db write support required."
> +}
> +
>  # this test requires that external log/realtime devices are not in use
>  #
>  _require_nonexternal()
> diff --git a/tests/shared/298 b/tests/shared/298
> index 4541798..6b5402c 100755
> --- a/tests/shared/298
> +++ b/tests/shared/298
> @@ -70,7 +70,7 @@ get_free_sectors()
>  	agsize=`xfs_info $loop_mnt | $SED_PROG -n 's/.*agsize=\(.*\) blks.*/\1/p'`
>  	# Convert free space (agno, block, length) to (start sector, end sector)
>  	$UMOUNT_PROG $loop_mnt
> -	$XFS_DB_PROG -c "freesp -d" $img_file | $SED_PROG '/^.*from/,$d'| \
> +	$XFS_DB_PROG -r -c "freesp -d" $img_file | $SED_PROG '/^.*from/,$d'| \
>  		 $AWK_PROG -v spb=$sectors_per_block -v agsize=$agsize \
>  		'{ print spb * ($1 * agsize + $2), spb * ($1 * agsize + $2 + $3) - 1 }'
>  	;;
> diff --git a/tests/xfs/044 b/tests/xfs/044
> index a84af22..cf575f8 100755
> --- a/tests/xfs/044
> +++ b/tests/xfs/044
> @@ -44,6 +44,7 @@ _supported_fs xfs
>  _supported_os Linux
>  
>  _require_logdev
> +_require_xfs_db_write
>  
>  _filter_logprint()
>  {
> diff --git a/tests/xfs/045 b/tests/xfs/045
> index 84ca802..17d2391 100755
> --- a/tests/xfs/045
> +++ b/tests/xfs/045
> @@ -45,6 +45,7 @@ _supported_fs xfs
>  _supported_os Linux
>  
>  _require_scratch
> +_require_xfs_db_write
>  
>  echo "*** get uuid"
>  uuid=`_get_existing_uuid`
> diff --git a/tests/xfs/186 b/tests/xfs/186
> index 960aed1..71f2a31 100755
> --- a/tests/xfs/186
> +++ b/tests/xfs/186
> @@ -147,6 +147,8 @@ _supported_os Linux
>  
>  _require_scratch
>  _require_attrs
> +_require_attr_v1
> +_require_xfs_db_write
>  
>  rm -f $seqres.full
>  
> diff --git a/tests/xfs/187 b/tests/xfs/187
> index 9cf1305..415ab11 100755
> --- a/tests/xfs/187
> +++ b/tests/xfs/187
> @@ -58,6 +58,7 @@ _supported_os Linux
>  
>  _require_scratch
>  _require_attrs
> +_require_attr_v1
>  
>  rm -f $seqres.full
>  
> @@ -87,13 +88,13 @@ echo ""
>  echo "attr2 fs"
>  echo ""
>  _scratch_mkfs -i attr=2 -l lazy-count=0 >/dev/null 2>&1
> -$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version
> +$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
>  echo ""
>  echo "noattr2 fs"
>  echo ""
>  _scratch_mount -o noattr2
>  $UMOUNT_PROG $SCRATCH_MNT
> -$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version
> +$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
>  
>  # adding an EA will ensure the ATTR1 flag is turned on
>  echo ""
> @@ -102,7 +103,7 @@ echo ""
>  echo "attr2 fs"
>  echo ""
>  _scratch_mkfs -i attr=2 -l lazy-count=0 >/dev/null 2>&1
> -$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version
> +$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
>  echo ""
>  echo "noattr2 fs"
>  echo ""
> @@ -113,7 +114,7 @@ $SETFATTR_PROG -n user.test -v 0xbabe testfile
>  $GETFATTR_PROG testfile
>  cd $here
>  $UMOUNT_PROG $SCRATCH_MNT
> -$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version
> +$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
>  
>  echo ""
>  echo "*** 3. test noattr2 mount and lazy sb ***"
> @@ -122,7 +123,7 @@ echo ""
>  echo "attr2 fs"
>  echo ""
>  _scratch_mkfs -i attr=2 -l lazy-count=1 >/dev/null 2>&1
> -$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version
> +$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
>  echo ""
>  echo "noattr2 fs"
>  echo ""
> @@ -131,7 +132,7 @@ cd $SCRATCH_MNT
>  touch testfile
>  cd $here
>  $UMOUNT_PROG $SCRATCH_MNT
> -$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version
> +$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
>  
>  # success, all done
>  status=0
> diff --git a/tests/xfs/199 b/tests/xfs/199
> index 1d64e02..0ab0dba 100755
> --- a/tests/xfs/199
> +++ b/tests/xfs/199
> @@ -48,6 +48,7 @@ _supported_fs xfs
>  _supported_os Linux
>  
>  _require_scratch
> +_require_xfs_db_write
>  
>  _scratch_mkfs_xfs -l lazy-count=1 >/dev/null 2>&1
>  
> diff --git a/tests/xfs/244 b/tests/xfs/244
> index 7d2a2d3..90291fb 100755
> --- a/tests/xfs/244
> +++ b/tests/xfs/244
> @@ -48,6 +48,7 @@ _supported_fs xfs
>  _require_xfs_quota
>  _require_scratch
>  _require_projid32bit
> +_require_projid16bit
>  
>  export MOUNT_OPTIONS="-opquota"
>  
> diff --git a/tests/xfs/278 b/tests/xfs/278
> index 938717d..e6f9289 100755
> --- a/tests/xfs/278
> +++ b/tests/xfs/278
> @@ -46,6 +46,8 @@ _cleanup()
>  _supported_fs xfs
>  _supported_os Linux
>  _require_scratch
> +_require_xfs_db_write
> +
>  _scratch_mkfs >/dev/null 2>&1
>  _scratch_mount
>  
> diff --git a/tests/xfs/287 b/tests/xfs/287
> index 9de0b3d..febc3af 100755
> --- a/tests/xfs/287
> +++ b/tests/xfs/287
> @@ -45,7 +45,7 @@ _cleanup()
>  
>  _print_projid()
>  {
> -	$XFS_DB_PROG -c "inode $1" \
> +	$XFS_DB_PROG -r -c "inode $1" \
>  		-c "print core.projid_lo" \
>  		-c "print core.projid_hi" \
>  		$SCRATCH_DEV
> @@ -56,6 +56,8 @@ _supported_fs xfs
>  _require_xfs_quota
>  _require_scratch
>  _require_projid32bit
> +_require_projid16bit
> +_require_xfs_db_write	# for xfs_admin
>  
>  # create xfs fs without projid32bit ability, will be gained by xfs_admin
>  _scratch_mkfs_xfs -i projid32bit=0 -d size=200m 2> /dev/null >> $seqres.full \
> diff --git a/tests/xfs/291 b/tests/xfs/291
> index 7723b9e..03c4de9 100755
> --- a/tests/xfs/291
> +++ b/tests/xfs/291
> @@ -70,7 +70,7 @@ xfs_io -f -c "pwrite 0 16m" -c "fsync" $SCRATCH_MNT/space_file.large >> $seqres.
>  
>  # Take a look at freespace for any post-mortem on the test
>  _scratch_unmount
> -xfs_db -c freesp $SCRATCH_DEV >> $seqres.full 2>&1
> +xfs_db -r -c freesp $SCRATCH_DEV >> $seqres.full 2>&1
>  _scratch_mount
>  
>  # Step 2: Make a bunch of (hopefully fragmented) multiblock
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 6/6] xfstests: add a multithreaded mode to bstat
  2013-06-07 13:06 ` [PATCH 6/6] xfstests: add a multithreaded mode to bstat Dave Chinner
@ 2013-10-17 21:29   ` Eric Sandeen
  2013-10-18  3:00     ` Dave Chinner
  0 siblings, 1 reply; 14+ messages in thread
From: Eric Sandeen @ 2013-10-17 21:29 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs

On 6/7/13 8:06 AM, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> For benchmarking of bulkstat, add a multithreaded mode that spawns a
> thread per AG and runs bulkstat on every AG in parallel. There is a
> small amount of overlap between each AG because of the way the
> interface works only on inode numbers, so some inodes are reported
> twice. A real implementation of this sort of parallelism would be
> greatly helped by adding an AG parameter to the bulkstat interface.
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>

At least w/ older xfsprogs[[qa]-devel] packages, I get:

bstat.c:41: error: redefinition of 'fls'
/usr/include/xfs/bitops.h:8: note: previous definition of 'fls' was here
bstat.c:70: error: redefinition of 'xfs_highbit32'
/usr/include/xfs/xfs_bit.h:50: note: previous definition of 'xfs_highbit32' was here

w/ the new functions you've added here...

-Eric

> ---
>  src/Makefile |    2 +-
>  src/bstat.c  |  388 +++++++++++++++++++++++++++++++++++++++++++++-------------
>  2 files changed, 302 insertions(+), 88 deletions(-)
> 
> diff --git a/src/Makefile b/src/Makefile
> index c18ffc9..243a432 100644
> --- a/src/Makefile
> +++ b/src/Makefile
> @@ -22,7 +22,7 @@ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
>  
>  SUBDIRS =
>  
> -LLDLIBS = $(LIBATTR) $(LIBHANDLE) $(LIBACL)
> +LLDLIBS = $(LIBATTR) $(LIBHANDLE) $(LIBACL) -lpthread
>  
>  ifeq ($(HAVE_XLOG_ASSIGN_LSN), true)
>  LINUX_TARGETS += loggen
> diff --git a/src/bstat.c b/src/bstat.c
> index 4e22ecd..0fc7d9d 100644
> --- a/src/bstat.c
> +++ b/src/bstat.c
> @@ -18,6 +18,60 @@
>  
>  #include "global.h"
>  #include <xfs/jdm.h>
> +#include <pthread.h>
> +
> +
> +int	debug;
> +int	quiet;
> +int	statit;
> +int	verbose;
> +int	threaded;
> +
> +unsigned int
> +libxfs_log2_roundup(unsigned int i)
> +{
> +	unsigned int    rval;
> +
> +	for (rval = 0; rval < NBBY * sizeof(i); rval++) {
> +		if ((1 << rval) >= i)
> +			break;
> +	}
> +	return rval;
> +}
> +static inline int fls(int x)
> +{
> +	int r = 32;
> +
> +	if (!x)
> +		return 0;
> +	if (!(x & 0xffff0000u)) {
> +		x <<= 16;
> +		r -= 16;
> +	}
> +	if (!(x & 0xff000000u)) {
> +		x <<= 8;
> +		r -= 8;
> +	}
> +	if (!(x & 0xf0000000u)) {
> +		x <<= 4;
> +		r -= 4;
> +	}
> +	if (!(x & 0xc0000000u)) {
> +		x <<= 2;
> +		r -= 2;
> +	}
> +	if (!(x & 0x80000000u)) {
> +		x <<= 1;
> +		r -= 1;
> +	}
> +	return r;
> +}
> +
> +static inline int xfs_highbit32(__uint32_t v)
> +{
> +	return fls(v) - 1;
> +}
> +
>  
>  void
>  dotime(void *ti, char *s)
> @@ -62,87 +116,21 @@ printstat(struct stat64 *sp)
>  	dotime(&sp->st_ctime, "ctime");
>  }
>  
> -int
> -main(int argc, char **argv)
> +static int
> +do_bstat(
> +	int		fsfd,
> +	jdm_fshandle_t	*fshandlep,
> +	char		*name,
> +	int		nent,
> +	__u64		first,
> +	__u64		last)
>  {
>  	__s32		count;
>  	int		total = 0;
> -	int		fsfd;
> -	int		i;
> -	__u64		last = 0;
> -	char		*name;
> -	int		nent;
> -	int		debug = 0;
> -	int		quiet = 0;
> -	int		statit = 0;
> -	int		verbose = 0;
>  	xfs_bstat_t	*t;
>  	int		ret;
> -	jdm_fshandle_t	*fshandlep = NULL;
> -	int		fd;
> -	struct stat64	sb;
> -	int nread;
> -	char *cc_readlinkbufp;
> -	int cc_readlinkbufsz;
> -	int 		c;
>  	xfs_fsop_bulkreq_t bulkreq;
> -
> -	while ((c = getopt(argc, argv, "cdl:qv")) != -1) {
> -		switch (c) {
> -		case 'q':
> -			quiet = 1;
> -			break;
> -		case 'v':
> -			verbose = 1;
> -			break;
> -		case 'c':
> -			statit = 1;
> -			break;
> -		case 'd':
> -			debug = 1;
> -			break;
> -		case 'l':
> -			last = atoi(optarg);
> -			break;
> -		case '?':
> -		printf("usage: xfs_bstat [-c] [-q] [-v] [ dir [ batch_size ]]\n");
> -		printf("   -c   Check the results against stat(3) output\n");
> -		printf("   -q   Quiet\n");
> -		printf("   -l _num_  Inode to start with\n");
> -		printf("   -v   Verbose output\n");
> -			exit(1);
> -		}
> -	}
> -	argc -= optind;
> -	argv += optind;
> -
> -	if (argc < 1)
> -		name = ".";
> -	else
> -		name = *argv;
> -
> -	fsfd = open(name, O_RDONLY);
> -	if (fsfd < 0) {
> -		perror(name);
> -		exit(1);
> -	}
> -	if (argc < 2)
> -		nent = 4096;
> -	else
> -		nent = atoi(*++argv);
> -
> -	if (verbose)
> -		printf("Bulkstat test on %s, batch size=%d statcheck=%d\n", 
> -			name, nent, statit);
> -
> -	if (statit) {
> -		fshandlep = jdm_getfshandle( name );
> -		if (! fshandlep) {
> -			printf("unable to construct sys handle for %s: %s\n",
> -			  name, strerror(errno));
> -			return -1;
> -		}
> -	}
> +	__u64		ino;
>  
>  	t = malloc(nent * sizeof(*t));
>  
> @@ -150,23 +138,27 @@ main(int argc, char **argv)
>  		printf(
>  		  "XFS_IOC_FSBULKSTAT test: last=%lld nent=%d\n", (long long)last, nent);
>  
> -	bulkreq.lastip  = &last;
> +	ino = first;
> +
> +	bulkreq.lastip  = &ino;
>  	bulkreq.icount  = nent;
>  	bulkreq.ubuffer = t;
>  	bulkreq.ocount  = &count;
>  
>  	while ((ret = xfsctl(name, fsfd, XFS_IOC_FSBULKSTAT, &bulkreq)) == 0) {
> +		int		i;
> +
>  		total += count;
>  
>  		if (verbose)
>  			printf(
> -	    "XFS_IOC_FSBULKSTAT test: last=%lld ret=%d count=%d total=%d\n", 
> -						(long long)last, ret, count, total);
> +    "XFS_IOC_FSBULKSTAT test: first/last/ino=%lld/%lld/%lld ret=%d count=%d total=%d\n", 
> +			(long long)first, (long long)last, (long long)ino, ret, count, total);
>  		if (count == 0)
> -			exit(0);
> +			break;
>  
>  		if ( quiet && ! statit )
> -			continue;
> +			goto next;
>  
>  		for (i = 0; i < count; i++) {
>  			if (! quiet) {
> @@ -174,6 +166,12 @@ main(int argc, char **argv)
>  			}
>  	
>  			if (statit) {
> +				char *cc_readlinkbufp;
> +				int cc_readlinkbufsz;
> +				struct stat64	sb;
> +				int nread;
> +				int		fd;
> +
>  				switch(t[i].bs_mode & S_IFMT) {
>  				case S_IFLNK:
>  					cc_readlinkbufsz = MAXPATHLEN;
> @@ -244,10 +242,231 @@ main(int argc, char **argv)
>  				}
>  			}
>  		}
> -
> +next:
>  		if (debug)
>  			break;
> +
> +		if (ino >= last)
> +			break;
>  	}
> +	if (verbose)
> +		printf(
> +	    "XFS_IOC_FSBULKSTAT test: last=%lld nent=%d ret=%d count=%d\n", 
> +					       (long long)last, nent, ret, count);
> +
> +	return total;
> +}
> +
> +struct thread_args {
> +	pthread_t	tid;
> +	int		fsfd;
> +	jdm_fshandle_t	*fshandlep;
> +	char		*name;
> +	int		nent;
> +	__u64		first;
> +	__u64		last;
> +	int		ret;
> +};
> +
> +static void *
> +do_bstat_thread(
> +	void	*args)
> +{
> +	struct thread_args *targs = args;
> +
> +	targs->ret = do_bstat(targs->fsfd, targs->fshandlep, targs->name,
> +			      targs->nent, targs->first, targs->last);
> +	return NULL;
> +}
> +
> +/*
> + *   XFS_AGINO_TO_INO(mp,a,i)        \
> + *           (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i))
> + *
> + * 	i always zero, so:
> + * 			a << XFS_INO_AGINO_BITS(mp)
> + *
> + *   XFS_INO_AGINO_BITS(mp)          (mp)->m_agino_log
> + *
> + *   mp->m_agino_log = sbp->sb_inopblog + sbp->sb_agblklog
> + *
> + *   sb_inopblog = fsgeom.blocksize / fsgeom.inodesize
> + *   sb_agblklog = (__uint8_t)libxfs_log2_roundup((unsigned int)fsgeom.agblocks);
> + *
> + *	a << (libxfs_highbit32(fsgeom.blocksize /fsgeom.inodesize) +
> + *				libxfs_log2_roundup(fsgeom.agblocks));
> + */
> +#define FSGEOM_INOPBLOG(fsg) \
> +		(xfs_highbit32((fsg).blocksize / (fsg).inodesize))
> +#define FSGEOM_AGINO_TO_INO(fsg, a, i) \
> +	(((__u64)(a) << (FSGEOM_INOPBLOG(fsg) + \
> +			libxfs_log2_roundup((fsg).agblocks))) | (i))
> +
> +/*
> + *    XFS_OFFBNO_TO_AGINO(mp,b,o)     \                                        
> + *            ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o)))
> + *
> + *       i always zero, so:
> + *			b << XFS_INO_OFFSET_BITS(mp)
> + *
> + *    XFS_INO_OFFSET_BITS(mp)         (mp)->m_sb.sb_inopblog
> + */
> +#define FSGEOM_OFFBNO_TO_AGINO(fsg, b, o) \
> +		((__u32)(((b) << FSGEOM_INOPBLOG(fsg)) | (o)))
> +static int
> +do_threads(
> +	int		fsfd,
> +	jdm_fshandle_t	*fshandlep,
> +	char		*name,
> +	int		nent,
> +	__u64		first)
> +{
> +	struct xfs_fsop_geom geom;
> +	struct thread_args *targs;
> +	int		ret;
> +	int		i;
> +	int		numthreads;
> +	int		total = 0;
> +
> +
> +	/* get number of AGs */
> +	ret = ioctl(fsfd, XFS_IOC_FSGEOMETRY, &geom);
> +	if (ret) {
> +		perror("XFS_IOC_FSGEOMETRY");
> +		exit(1);
> +	}
> +
> +	/* allocate thread array */
> +	targs = malloc(geom.agcount * sizeof(*targs));
> +	if (ret) {
> +		perror("malloc(targs)");
> +		exit(1);
> +	}
> +
> +	for (i = 0; i < geom.agcount; i++) {
> +		__u64 last;
> +
> +		last = FSGEOM_AGINO_TO_INO(geom, i,
> +					   FSGEOM_OFFBNO_TO_AGINO(geom,
> +						       geom.agblocks - 1, 0));
> +
> +		if (first > last) {
> +			i--;
> +			continue;
> +		}
> +		first = MAX(first, FSGEOM_AGINO_TO_INO(geom, i, 0));
> +
> +		targs[i].fsfd = fsfd;
> +		targs[i].fshandlep = fshandlep;
> +		targs[i].name = name;
> +		targs[i].nent = nent;
> +		targs[i].first = first;
> +		targs[i].last = last;
> +		targs[i].ret = 0;
> +	}
> +	numthreads = i;
> +
> +	/* start threads */
> +	for (i = 0; i< numthreads; i++) {
> +		ret = pthread_create(&targs[i].tid, NULL, do_bstat_thread, &targs[i]);
> +		if (ret) {
> +			perror("pthread-create");
> +			exit(1);
> +		}
> +	}
> +
> +
> +	/* join threads */
> +	for (i = 0; i < numthreads; i++) {
> +		if (targs[i].tid) {
> +			pthread_join(targs[i].tid, NULL);
> +			total += targs[i].ret;
> +		}
> +	}
> +
> +	/* die */
> +	return total;
> +}
> +
> +
> +int
> +main(int argc, char **argv)
> +{
> +	int		fsfd;
> +	__u64		first = 0;
> +	char		*name;
> +	int		nent;
> +	int		ret;
> +	jdm_fshandle_t	*fshandlep = NULL;
> +	int 		c;
> +
> +	while ((c = getopt(argc, argv, "cdl:qtv")) != -1) {
> +		switch (c) {
> +		case 'q':
> +			quiet = 1;
> +			break;
> +		case 'v':
> +			verbose = 1;
> +			break;
> +		case 'c':
> +			statit = 1;
> +			break;
> +		case 'd':
> +			debug = 1;
> +			break;
> +		case 'l':
> +			first = atoi(optarg);
> +			break;
> +		case 't':
> +			threaded = 1;
> +			break;
> +		case '?':
> +		printf("usage: xfs_bstat [-c] [-q] [-v] [ dir [ batch_size ]]\n");
> +		printf("   -c   Check the results against stat(3) output\n");
> +		printf("   -q   Quiet\n");
> +		printf("   -l _num_  Inode to start with\n");
> +		printf("   -v   Verbose output\n");
> +			exit(1);
> +		}
> +	}
> +	argc -= optind;
> +	argv += optind;
> +
> +	if (argc < 1)
> +		name = ".";
> +	else
> +		name = *argv;
> +
> +	fsfd = open(name, O_RDONLY);
> +	if (fsfd < 0) {
> +		perror(name);
> +		exit(1);
> +	}
> +	if (argc < 2)
> +		nent = 4096;
> +	else
> +		nent = atoi(*++argv);
> +
> +	if (verbose)
> +		printf("Bulkstat test on %s, batch size=%d statcheck=%d\n", 
> +			name, nent, statit);
> +
> +	if (statit) {
> +		fshandlep = jdm_getfshandle( name );
> +		if (! fshandlep) {
> +			printf("unable to construct sys handle for %s: %s\n",
> +			  name, strerror(errno));
> +			return -1;
> +		}
> +	}
> +
> +	if (threaded)
> +		ret = do_threads(fsfd, fshandlep, name, nent, first);
> +	else
> +		ret = do_bstat(fsfd, fshandlep, name, nent, first, -1LL);
> +
> +	if (verbose)
> +		printf("Bulkstat found %d inodes\n", ret);
>  
>  	if (fsfd)
>  		close(fsfd);
> @@ -255,10 +474,5 @@ main(int argc, char **argv)
>  	if (ret < 0 )
>  		perror("xfsctl(XFS_IOC_FSBULKSTAT)");
>  
> -	if (verbose)
> -		printf(
> -	    "XFS_IOC_FSBULKSTAT test: last=%lld nent=%d ret=%d count=%d\n", 
> -					       (long long)last, nent, ret, count);
> -
> -	return 1;
> +	return 0;
>  }
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/6] xfstests: New _require_* tests for CRC enabled filesystems
  2013-10-17 21:24   ` Eric Sandeen
@ 2013-10-18  2:58     ` Dave Chinner
  0 siblings, 0 replies; 14+ messages in thread
From: Dave Chinner @ 2013-10-18  2:58 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs

On Thu, Oct 17, 2013 at 04:24:13PM -0500, Eric Sandeen wrote:
> On 6/7/13 8:06 AM, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > CRCs always enabled 32 bit project inodes and attr2 formats, hence
> > they cannot be turned off. Add new require rules for the tests that
> > require attr and 16 bit project IDs so these tests are avoided on
> > CRC enabled filesystems.
> > 
> > Also, add a xfs_db write check so that we can avoid tests that are
> > dependent on xfs_db modifying filesystem structures as they will
> > fail on CRC enabled filessystems right now. This is just temporary
> > until full write xfs_db support is available.
> > 
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> 
> small optimization question below

Using -N makes sense. I forgot about that option :)

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 6/6] xfstests: add a multithreaded mode to bstat
  2013-10-17 21:29   ` Eric Sandeen
@ 2013-10-18  3:00     ` Dave Chinner
  2013-10-18  3:39       ` Eric Sandeen
  0 siblings, 1 reply; 14+ messages in thread
From: Dave Chinner @ 2013-10-18  3:00 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs

On Thu, Oct 17, 2013 at 04:29:16PM -0500, Eric Sandeen wrote:
> On 6/7/13 8:06 AM, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > For benchmarking of bulkstat, add a multithreaded mode that spawns a
> > thread per AG and runs bulkstat on every AG in parallel. There is a
> > small amount of overlap between each AG because of the way the
> > interface works only on inode numbers, so some inodes are reported
> > twice. A real implementation of this sort of parallelism would be
> > greatly helped by adding an AG parameter to the bulkstat interface.
> > 
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> 
> At least w/ older xfsprogs[[qa]-devel] packages, I get:
> 
> bstat.c:41: error: redefinition of 'fls'
> /usr/include/xfs/bitops.h:8: note: previous definition of 'fls' was here
> bstat.c:70: error: redefinition of 'xfs_highbit32'
> /usr/include/xfs/xfs_bit.h:50: note: previous definition of 'xfs_highbit32' was here
> 
> w/ the new functions you've added here...

Ok, so I need autoconf magic here to detect this?

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 6/6] xfstests: add a multithreaded mode to bstat
  2013-10-18  3:00     ` Dave Chinner
@ 2013-10-18  3:39       ` Eric Sandeen
  0 siblings, 0 replies; 14+ messages in thread
From: Eric Sandeen @ 2013-10-18  3:39 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs

On 10/17/13 10:00 PM, Dave Chinner wrote:
> On Thu, Oct 17, 2013 at 04:29:16PM -0500, Eric Sandeen wrote:
>> On 6/7/13 8:06 AM, Dave Chinner wrote:
>>> From: Dave Chinner <dchinner@redhat.com>
>>>
>>> For benchmarking of bulkstat, add a multithreaded mode that spawns a
>>> thread per AG and runs bulkstat on every AG in parallel. There is a
>>> small amount of overlap between each AG because of the way the
>>> interface works only on inode numbers, so some inodes are reported
>>> twice. A real implementation of this sort of parallelism would be
>>> greatly helped by adding an AG parameter to the bulkstat interface.
>>>
>>> Signed-off-by: Dave Chinner <dchinner@redhat.com>
>>
>> At least w/ older xfsprogs[[qa]-devel] packages, I get:
>>
>> bstat.c:41: error: redefinition of 'fls'
>> /usr/include/xfs/bitops.h:8: note: previous definition of 'fls' was here
>> bstat.c:70: error: redefinition of 'xfs_highbit32'
>> /usr/include/xfs/xfs_bit.h:50: note: previous definition of 'xfs_highbit32' was here
>>
>> w/ the new functions you've added here...
> 
> Ok, so I need autoconf magic here to detect this?

seems that way.  TBH I don't *cough* have a box w/ latests xfsprogs headers installed
currently, so didn't see exactly what changed...

-Eric

> Cheers,
> 
> Dave.
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-10-18  3:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-07 13:06 [PATCH 0/6] xfstests: various fixes Dave Chinner
2013-06-07 13:06 ` [PATCH 1/6] xfstests: generic/193 runs tests in wrong location Dave Chinner
2013-06-25 19:49   ` Ben Myers
2013-06-07 13:06 ` [PATCH 2/6] xfstests: ensure all mkfs output is redirected properly Dave Chinner
2013-06-07 13:06 ` [PATCH 3/6] xfstests: xfs/253 doesn't use seqres correctly Dave Chinner
2013-06-25 20:27   ` Ben Myers
2013-06-07 13:06 ` [PATCH 4/6] xfstests: Make 204 work with different block and inode sizes Dave Chinner
2013-06-07 13:06 ` [PATCH 5/6] xfstests: New _require_* tests for CRC enabled filesystems Dave Chinner
2013-10-17 21:24   ` Eric Sandeen
2013-10-18  2:58     ` Dave Chinner
2013-06-07 13:06 ` [PATCH 6/6] xfstests: add a multithreaded mode to bstat Dave Chinner
2013-10-17 21:29   ` Eric Sandeen
2013-10-18  3:00     ` Dave Chinner
2013-10-18  3:39       ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox