xfs: add test for XFS_IOC_FSSETXATTR behaviour
authorIustin Pop <iustin@k1024.org>
Wed, 11 Feb 2015 05:54:16 +0000 (16:54 +1100)
committerDave Chinner <david@fromorbit.com>
Wed, 11 Feb 2015 05:54:16 +0000 (16:54 +1100)
Adds a new test that checks for correct behaviour of
XFS_IOC_FSSETXATTR for directories: extent sizes should always be
settable on a directory, even if the directory already has allocated
extents.

Signed-off-by: Iustin Pop <iustin@k1024.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
tests/xfs/069 [new file with mode: 0755]
tests/xfs/069.out [new file with mode: 0644]
tests/xfs/group

diff --git a/tests/xfs/069 b/tests/xfs/069
new file mode 100755 (executable)
index 0000000..82c5c6c
--- /dev/null
@@ -0,0 +1,83 @@
+#! /bin/bash
+# FS QA Test No. 069
+#
+# Determine whether the extent size hint can be set on directories
+# with allocated extents correctly.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014 Google Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+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()
+{
+    cd /
+    rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/punch
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs xfs
+_supported_os Linux
+_require_scratch
+
+_scratch_mkfs_xfs >/dev/null 2>&1
+_scratch_mount
+
+small=$SCRATCH_MNT/small
+big=$SCRATCH_MNT/big
+
+# sanity check on a small directory
+mkdir $small
+# expect that an empty directory has no extents
+$XFS_IO_PROG -c "bmap" $small | _filter_scratch
+# and that we can set an extent size on it
+$XFS_IO_PROG -c 'extsize 8m' $small
+# and finally check that the extent size update has taken place
+$XFS_IO_PROG -c "extsize" $small | _filter_scratch
+
+# now create a 'big' (with extents) directory
+mkdir $big
+for idx in {0..1000}; do
+    touch $big/$idx
+done
+$XFS_IO_PROG -c 'bmap -vp' $big | _filter_bmap | \
+    grep -q '^0: .*data'
+[ $? -eq 0 ] || echo "Can't force allocating extents!" 1>&2
+
+# expect that we can set the extent size on $big as well
+$XFS_IO_PROG -c 'extsize 8m' $big | _filter_scratch
+# and that it took effect
+$XFS_IO_PROG -c 'extsize' $big | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/069.out b/tests/xfs/069.out
new file mode 100644 (file)
index 0000000..f0b9823
--- /dev/null
@@ -0,0 +1,4 @@
+QA output created by 069
+SCRATCH_MNT/small: no extents
+[8388608] SCRATCH_MNT/small
+[8388608] SCRATCH_MNT/big
index 496630d988d5bdbe3f68abd43e034d049b6e3c76..585e7c640700c7c12af2c146736e5dd2864e9d9e 100644 (file)
@@ -66,6 +66,7 @@
 066 dump ioctl auto quick
 067 acl attr auto quick
 068 auto stress dump
+069 ioctl auto quick
 071 rw auto
 072 rw auto prealloc quick
 073 copy auto