Patchwork [V2] xfstests: only run generic/300 on filesystems supporting fallocate()

login
register
mail settings
Submitter Eric Whitney
Date Sept. 21, 2013, 10:02 p.m.
Message ID <20130921220247.GE7855@wallace>
Download mbox | patch
Permalink /patch/276915/
State Not Applicable
Headers show

Comments

Eric Whitney - Sept. 21, 2013, 10:02 p.m.
Generic/300 fails when run on a test filesystem that does not support
fallocate(), as in the case of an ext4 filesystem created without the
extent feature or with the bigalloc feature.  It uses fio's falloc
ioengine to generate part of its I/O load, and both fallocates blocks
and punches holes.

Verify that the test filesystem supports fallocate() before proceeding
with the test, checking for both block allocation and hole punching
capabilities.  We need to use both _require_xfs_io_falloc and
_require_xfs_io_falloc_punch because the latter does not currently
test for block allocation support.  Also, delete any pre-existing test
output to avoid confusion with old results.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
---
 tests/generic/300 | 11 +++++++++++
 1 file changed, 11 insertions(+)

Patch

diff --git a/tests/generic/300 b/tests/generic/300
index 7c60728..1bb2837 100755
--- a/tests/generic/300
+++ b/tests/generic/300
@@ -44,6 +44,17 @@  _supported_os Linux
 _need_to_be_root
 _require_scratch
 
+# For this test, the test system's glibc and kernel and the test file system
+# must support both fallocating and hole punching.  We don't need xfs_io to
+# perform the test, but we can use it to verify these preconditions.  For now,
+# this allows us to avoid duplicating the following functions for fio or other
+# applications that might be used to generate I/O at the cost of picking up a
+# minor dependency on xfsprogs.
+_require_xfs_io_falloc
+_require_xfs_io_falloc_punch
+
+rm -f $seqres.full
+
 NUM_JOBS=$((4*LOAD_FACTOR))
 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
 if [ $((BLK_DEV_SIZE)) -gt 1048576 ]