From 9be65e9745d264d4f142eb87b4c7727467918973 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 19 Jul 2011 15:05:31 -0700 Subject: [PATCH] Add _require_fallocate helper A helper to determine if the filesystem supports fallocate(2). Tests which rely on this functionality have been updated to use this helper function allowing the tests to be skipped. --- 075 | 2 ++ 112 | 2 ++ 213 | 1 + 214 | 1 + 223 | 1 + 228 | 1 + 243 | 1 + common.rc | 22 ++++++++++++++++++++++ 8 files changed, 31 insertions(+) diff --git a/075 b/075 index 0f0a6ed25..c1bb71889 100755 --- a/075 +++ b/075 @@ -127,6 +127,8 @@ _process_args() _supported_fs generic _supported_os IRIX Linux +_require_fallocate + size10=`expr 10 \* 1024 \* 1024` # 10 megabytes filelen=$size10 numops1=1000 diff --git a/112 b/112 index 557350ac3..f55a19c10 100755 --- a/112 +++ b/112 @@ -125,6 +125,8 @@ _process_args() _supported_fs generic _supported_os Linux +_require_fallocate + [ -x $here/ltp/aio-stress ] || \ _notrun "fsx not built with AIO for this platform" diff --git a/213 b/213 index 9982dd48d..a38d96740 100755 --- a/213 +++ b/213 @@ -55,6 +55,7 @@ _supported_os Linux rm -f $seq.full +_require_fallocate _require_xfs_io_falloc # check there's enough freespace on $TEST_DIR ... (1GiB + 1MiB) diff --git a/214 b/214 index cef7626e7..49c91cf3b 100755 --- a/214 +++ b/214 @@ -54,6 +54,7 @@ _supported_os Linux rm -f $seq.full rm -f $TEST_DIR/ouch* +_require_fallocate _require_xfs_io_falloc # Ok, off we go. diff --git a/223 b/223 index 2e0a24511..8930a5614 100755 --- a/223 +++ b/223 @@ -47,6 +47,7 @@ _supported_fs generic _supported_os Linux _require_scratch +_require_fallocate _require_xfs_io_falloc rm -f $seq.full diff --git a/228 b/228 index fa230b073..4e3bdf612 100755 --- a/228 +++ b/228 @@ -54,6 +54,7 @@ _supported_os Linux rm -f $seq.full # Sanity check to see if fallocate works +_require_fallocate _require_xfs_io_falloc # Check if we have good enough space available diff --git a/243 b/243 index 48f79327e..6779ed393 100755 --- a/243 +++ b/243 @@ -120,6 +120,7 @@ _check_ext4_eof_flag() # Prerequisites for the test run. _supported_fs ext4 xfs btrfs gfs2 _supported_os Linux +_require_fallocate _require_xfs_io_falloc # Real QA test starts here. diff --git a/common.rc b/common.rc index 60d2254d7..b50c695f8 100644 --- a/common.rc +++ b/common.rc @@ -982,6 +982,28 @@ _require_sparse_files() esac } +# +# Check if the filesystem supports fallocate. +# +_require_fallocate() +{ + if [ ! -x /bin/fallocate -a ! -x /usr/bin/fallocate -a ! -x /sbin/fallocate ]; then + _notrun "fallocate command not found" + fi + + # + # Test if fallocate supports fallocate. + # + fallocate -l 65536 $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1 + cat $TEST_DIR/syscalltest.out >> $here/$seq.full + + if grep -q 'Operation not supported' $TEST_DIR/syscalltest.out; then + _notrun "fallocate not supported by this filesystem type: $FSTYP" + fi + + rm -f $TEST_DIR/syscalltest.out +} + # check that a FS on a device is mounted # if so, return mount point #