Skip to content

Commit

Permalink
Add _require_fallocate helper
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
behlendorf committed Jul 22, 2011
1 parent cf28fbb commit 9be65e9
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions 075
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions 112
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions 213
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions 214
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions 223
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ _supported_fs generic
_supported_os Linux

_require_scratch
_require_fallocate
_require_xfs_io_falloc

rm -f $seq.full
Expand Down
1 change: 1 addition & 0 deletions 228
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions 243
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
22 changes: 22 additions & 0 deletions common.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down

0 comments on commit 9be65e9

Please sign in to comment.