]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
fstests: fix fallocate commands that need the unshare switch
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 17 Oct 2016 22:09:28 +0000 (15:09 -0700)
committerEryu Guan <eguan@redhat.com>
Fri, 21 Oct 2016 15:20:14 +0000 (23:20 +0800)
We re-added the UNSHARE flag to fallocate, so go make sure that all
the unshare tests actually check that the installed copy of xfs_io
supports the 'funshare' command and that the underlying filesystem
understands the flag, and change the tests themselves to use
funshare.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
12 files changed:
common/rc
tests/generic/156
tests/generic/264
tests/xfs/132
tests/xfs/184
tests/xfs/192
tests/xfs/200
tests/xfs/204
tests/xfs/344
tests/xfs/345
tests/xfs/346
tests/xfs/347

index 041736dafd4e2a8ed5a70e24a5fb668ebb355580..a84efe49cbf4e2991b3ea6d541ec0c7cd81b9382 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -2042,7 +2042,7 @@ _require_xfs_io_command()
        "falloc" )
                testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $testfile 2>&1`
                ;;
-       "fpunch" | "fcollapse" | "zero" | "fzero" | "finsert" )
+       "fpunch" | "fcollapse" | "zero" | "fzero" | "finsert" | "funshare")
                testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
                        -c "$command 4k 8k" $testfile 2>&1`
                ;;
index 9e22a0244223b2325e7fac5f57daf402a24f7bc7..e062b56a36d38d49157499d2c3921a48e69e785b 100755 (executable)
@@ -54,15 +54,11 @@ _cleanup()
 . ./common/attr
 . ./common/reflink
 
-if [ $FSTYP = "btrfs" ]; then
-       _notrun "btrfs doesn't handle unshare on fallocate"
-fi
-
 # real QA test starts here
 _supported_os Linux
 _require_test_reflink
 _require_cp_reflink
-_require_xfs_io_command "falloc"
+_require_xfs_io_command "funshare"
 
 rm -f $seqres.full
 
@@ -89,18 +85,18 @@ _test_cycle_mount
 free_blocks1=$(stat -f $testdir -c '%f')
 
 echo "funshare part of a file"
-$XFS_IO_PROG -f -c "falloc 0 $((sz / 2))" $testdir/file2
+$XFS_IO_PROG -f -c "funshare 0 $((sz / 2))" $testdir/file2
 _test_cycle_mount
 
 echo "funshare some of the copies"
-$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file2
-$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file3
+$XFS_IO_PROG -f -c "funshare 0 $sz" $testdir/file2
+$XFS_IO_PROG -f -c "funshare 0 $sz" $testdir/file3
 _test_cycle_mount
 free_blocks2=$(stat -f $testdir -c '%f')
 
 echo "funshare the rest of the files"
-$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file4
-$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file1
+$XFS_IO_PROG -f -c "funshare 0 $sz" $testdir/file4
+$XFS_IO_PROG -f -c "funshare 0 $sz" $testdir/file1
 _test_cycle_mount
 free_blocks3=$(stat -f $testdir -c '%f')
 
index 631184cb124e3c7424110159c79db71d0aa9c78f..f90de0393521bcf5a8e850c6bd288cadcb55aef7 100755 (executable)
@@ -47,7 +47,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
-_require_xfs_io_command "falloc"
+_require_xfs_io_command "funshare"
 
 rm -f $seqres.full
 
@@ -75,7 +75,7 @@ md5sum $testdir/file2 | _filter_scratch
 md5sum $testdir/file2.chk | _filter_scratch
 
 echo "CoW and unmount"
-$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 3)) $blksz $((blksz * 3))" -c "falloc $((blksz * 2)) $blksz" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 3)) $blksz $((blksz * 3))" -c "funshare $((blksz * 2)) $blksz" $testdir/file2 >> $seqres.full
 _scratch_cycle_mount
 $XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 3)) $blksz $((blksz * 3))" $testdir/file2.chk >> $seqres.full
 _scratch_cycle_mount
index 7f7ebaa3537231b38c8df8623edf4a9ff7257275..ac8dc25f576801a0763f7fd7e253c9294dc87d83 100755 (executable)
@@ -63,7 +63,7 @@ _supported_os Linux
 _require_test_reflink
 _require_test_lsattr
 _require_cp_reflink
-_require_xfs_io_command "falloc"
+_require_xfs_io_command "funshare"
 
 rm -f $seqres.full
 
@@ -90,18 +90,18 @@ _test_cycle_mount
 free_blocks1=$(stat -f $testdir -c '%f')
 
 echo "funshare part of a file"
-$XFS_IO_PROG -f -c "falloc 0 $((sz / 2))" $testdir/file2
+$XFS_IO_PROG -f -c "funshare 0 $((sz / 2))" $testdir/file2
 _test_cycle_mount
 
 echo "funshare some of the copies"
-$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file2
-$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file3
+$XFS_IO_PROG -f -c "funshare 0 $sz" $testdir/file2
+$XFS_IO_PROG -f -c "funshare 0 $sz" $testdir/file3
 _test_cycle_mount
 free_blocks2=$(stat -f $testdir -c '%f')
 
 echo "funshare the rest of the files"
-$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file4
-$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file1
+$XFS_IO_PROG -f -c "funshare 0 $sz" $testdir/file4
+$XFS_IO_PROG -f -c "funshare 0 $sz" $testdir/file1
 _test_cycle_mount
 free_blocks3=$(stat -f $testdir -c '%f')
 
index e843b4eb5f8028fef62b1bf91cdbc0c9930459e8..08607019f67a450d88af89ef376c3297646cf8c3 100755 (executable)
@@ -51,6 +51,7 @@ _require_scratch_reflink
 _require_cp_reflink
 _require_fiemap
 _require_xfs_io_command "cowextsize"
+_require_xfs_io_command "funshare"
 
 rm -f $seqres.full
 
@@ -84,7 +85,7 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 $XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
 $XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $((filesize + 1))" -c "fdatasync" $testdir/file2 >> $seqres.full
-$XFS_IO_PROG -f -c "falloc 0 $((filesize + 1))" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "funshare 0 $((filesize + 1))" $testdir/file2 >> $seqres.full
 _scratch_cycle_mount
 
 echo "Compare files"
index 01f5e1c97c16c9fbdd7136498088421fb60476b7..e56c8605ae56877251730f45bbb4a703a9d31a91 100755 (executable)
@@ -51,6 +51,7 @@ _require_scratch_reflink
 _require_cp_reflink
 _require_fiemap
 _require_xfs_io_command "cowextsize"
+_require_xfs_io_command "funshare"
 _require_odirect
 
 rm -f $seqres.full
@@ -85,7 +86,7 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 $XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
 $XFS_IO_PROG -d -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" $testdir/file2 >> $seqres.full
-$XFS_IO_PROG -d -f -c "falloc 0 $filesize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -f -c "funshare 0 $filesize" $testdir/file2 >> $seqres.full
 _scratch_cycle_mount
 
 echo "Compare files"
index ebb6e736a87b426c7e7f06409d6cc5d8b21832ed..d4363a4264d57fe6e62c3f3e370cf086752270f6 100755 (executable)
@@ -53,6 +53,7 @@ _require_scratch_reflink
 _require_cp_reflink
 _require_fiemap
 _require_xfs_io_command "cowextsize"
+_require_xfs_io_command "funshare"
 
 rm -f $seqres.full
 
@@ -88,7 +89,7 @@ $XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
 cat $testdir/file2 > /dev/null
 $XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
 $XFS_IO_PROG -f -c "fadvise -d 0 $filesize" -c "fsync" $testdir/file2 >> $seqres.full
-$XFS_IO_PROG -f -c "falloc 0 $filesize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "funshare 0 $filesize" $testdir/file2 >> $seqres.full
 _scratch_cycle_mount
 
 echo "Compare files"
index 6e5b896f63016bc64353bf6b1423d2daab2b4a70..3dbaf95d5d164bb5e20894c574447a89f1bce11b 100755 (executable)
@@ -53,6 +53,7 @@ _require_scratch_reflink
 _require_cp_reflink
 _require_fiemap
 _require_xfs_io_command "cowextsize"
+_require_xfs_io_command "funshare"
 _require_odirect
 
 rm -f $seqres.full
@@ -89,7 +90,7 @@ $XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
 cat $testdir/file2 > /dev/null
 $XFS_IO_PROG -d -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
 $XFS_IO_PROG -f -c "fadvise -d 0 $filesize" -c "fsync" $testdir/file2 >> $seqres.full
-$XFS_IO_PROG -f -c "falloc 0 $filesize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "funshare 0 $filesize" $testdir/file2 >> $seqres.full
 _scratch_cycle_mount
 
 echo "Compare files"
index 25bff1af0fecb729eb25563c6feff606a76766ea..229e22acabd906ae20ad67571e64f5998083d835 100755 (executable)
@@ -51,6 +51,7 @@ _require_scratch_reflink
 _require_cp_reflink
 _require_fiemap
 _require_xfs_io_command "cowextsize"
+_require_xfs_io_command "funshare"
 _require_odirect
 
 rm -f $seqres.full
@@ -85,7 +86,7 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 $XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
 $XFS_IO_PROG -d -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" $testdir/file2 >> $seqres.full
-$XFS_IO_PROG -d -f -c "falloc -u 0 $filesize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -f -c "funshare 0 $filesize" $testdir/file2 >> $seqres.full
 _scratch_cycle_mount
 
 echo "Compare files"
index edb4443fafb0acb3e6b21648ddad83eba079f9d5..4e3132436fd6327e94fe6a023799081c1bdb3cd7 100755 (executable)
@@ -50,6 +50,7 @@ _require_scratch_reflink
 _require_cp_reflink
 _require_fiemap
 _require_xfs_io_command "cowextsize"
+_require_xfs_io_command "funshare"
 
 rm -f $seqres.full
 
@@ -83,7 +84,7 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 $XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
 $XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
-$XFS_IO_PROG -f -c "falloc -u 0 $filesize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "funshare 0 $filesize" $testdir/file2 >> $seqres.full
 _scratch_cycle_mount
 
 echo "Compare files"
index d0463eb503ba6ff46b3fa888ac99b3d1488e92c6..7d7075a3951ea4a1c45ae114a04dcd6bdb6bc1ec 100755 (executable)
@@ -51,6 +51,7 @@ _require_scratch_reflink
 _require_cp_reflink
 _require_fiemap
 _require_xfs_io_command "cowextsize"
+_require_xfs_io_command "funshare"
 _require_odirect
 
 rm -f $seqres.full
@@ -88,7 +89,7 @@ seq 1 10 | while read i; do
        $XFS_IO_PROG -d -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" $testdir/file2 >> $seqres.full
        _scratch_cycle_mount
 done
-$XFS_IO_PROG -f -c "falloc -u 0 $filesize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "funshare 0 $filesize" $testdir/file2 >> $seqres.full
 _scratch_cycle_mount
 
 echo "Compare files"
index 15782168ab94ee635737f4c50159470fadf50e6e..e4f9635a0c587bdea5441d29917942c225c7ce2f 100755 (executable)
@@ -51,6 +51,7 @@ _require_scratch_reflink
 _require_cp_reflink
 _require_fiemap
 _require_xfs_io_command "cowextsize"
+_require_xfs_io_command "funshare"
 
 rm -f $seqres.full
 
@@ -87,7 +88,7 @@ seq 1 10 | while read i; do
        $XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" $testdir/file2 >> $seqres.full
        _scratch_cycle_mount
 done
-$XFS_IO_PROG -f -c "falloc -u 0 $filesize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "funshare 0 $filesize" $testdir/file2 >> $seqres.full
 _scratch_cycle_mount
 
 echo "Compare files"