xfstests 252: add test for fallocate with hole punching

Move the major test meat of 242 into common.punch, and reuse it for
a new testcase the exercises the new fallocate implementation

Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Josef Bacik
2011-04-15 15:19:59 -04:00
committed by Christoph Hellwig
parent 3a4b6e0192
commit b16ef33889
6 changed files with 291 additions and 139 deletions
+27
View File
@@ -847,6 +847,33 @@ _require_xfs_io_falloc()
_notrun "xfs_io fallocate command failed (old kernel/wrong fs?)"
}
# check that xfs_io, kernel and filesystem all support fallocate with hole
# punching
_require_xfs_io_falloc_punch()
{
testfile=$TEST_DIR/$$.falloc
testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
-c "fpunch 4k 8k" $testfile 2>&1`
rm -f $testfile 2>&1 > /dev/null
echo $testio | grep -q "not found" && \
_notrun "xfs_io fallocate punch support is missing"
echo $testio | grep -q "Operation not supported" && \
_notrun "xfs_io fallocate punch command failed (no fs support?)"
}
# check that xfs_io, kernel and filesystem support fiemap
_require_xfs_io_fiemap()
{
testfile=$TEST_DIR/$$.fiemap
testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
-c "fiemap -v" $testfile 2>&1`
rm -f $testfile 2>&1 > /dev/null
echo $testio | grep -q "not found" && \
_notrun "xfs_io fiemap support is missing"
echo $testio | grep -q "Operation not supported" && \
_notrun "xfs_io fiemap command failed (no fs support?)"
}
# Check that a fs has enough free space (in 1024b blocks)
#
_require_fs_space()