common/rc: introduce _require_scratch_delalloc()
authorShiyang Ruan <ruansy.fnst@fujitsu.com>
Tue, 14 Dec 2021 08:19:02 +0000 (16:19 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sat, 25 Dec 2021 13:02:48 +0000 (21:02 +0800)
Check whether delalloc is supported on current device.

Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
18 files changed:
common/rc
tests/generic/194
tests/generic/195
tests/generic/199
tests/generic/200
tests/generic/293
tests/generic/295
tests/generic/540
tests/generic/541
tests/generic/542
tests/generic/543
tests/xfs/172
tests/xfs/223
tests/xfs/224
tests/xfs/228
tests/xfs/230
tests/xfs/257
tests/xfs/258

index 7973ceb5fdf8cdfee0b8d7795a8800fe971b8452..a419b3ba53f67f89041fe80e2e726985b87d986e 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -1748,6 +1748,19 @@ _require_scratch_16T_support()
        esac
 }
 
+# Require scratch fs supports delay allocation.
+_require_scratch_delalloc()
+{
+       _require_command "$FILEFRAG_PROG" filefrag
+
+       _scratch_mkfs > $seqres.full
+       _scratch_mount
+       $XFS_IO_PROG -f -c 'pwrite 0 64k' $SCRATCH_MNT/testy &> /dev/null
+       $FILEFRAG_PROG -v $SCRATCH_MNT/testy 2>&1 | grep -q delalloc || \
+               _notrun "test requires delayed allocation buffered writes"
+       _scratch_unmount
+}
+
 # this test needs a test partition - check we're ok & mount it
 #
 _require_test()
index ce8c31ac1c2862a52c089a3871500119dd4e1d9e..ff76438d85ca5c2db3bcdbe8e2dc0053f83ac287 100755 (executable)
@@ -28,6 +28,7 @@ _cleanup()
 
 # real QA test starts here
 _require_scratch_reflink
+_require_scratch_delalloc
 _require_xfs_io_command "falloc"
 _require_odirect
 
index da502c391b167899ab75e52e8cf3927dcb3b45fe..e087b99cbf65aeafbd58926d9e99c34978826999 100755 (executable)
@@ -28,6 +28,7 @@ _cleanup()
 
 # real QA test starts here
 _require_scratch_reflink
+_require_scratch_delalloc
 _require_xfs_io_command "falloc"
 
 echo "Format and mount"
index ab13f58edd4c7fa782b41f5df60e805244ca7258..2a8cafcc46492cda8ca4199a7dd17e6b6f105dee 100755 (executable)
@@ -31,6 +31,7 @@ _cleanup()
 
 # real QA test starts here
 _require_scratch_reflink
+_require_scratch_delalloc
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "fpunch"
 _require_cp_reflink
index deadfeaa8959d73d6a381010eb1e2d93cb669b07..a1a78ef40fd8337e5c2dcd3978e296facd9ce808 100755 (executable)
@@ -31,6 +31,7 @@ _cleanup()
 
 # real QA test starts here
 _require_scratch_reflink
+_require_scratch_delalloc
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "fpunch"
 _require_cp_reflink
index 74231b4d9a1e2c5b85a7a5402cdc027bb50374b0..0f1d84160866fb561ee00036dcf75d593a309bf0 100755 (executable)
@@ -24,6 +24,7 @@ _begin_fstest auto quick clone
 
 # real QA test starts here
 _require_scratch_reflink
+_require_scratch_delalloc
 _require_xfs_io_command "falloc"
 
 echo "Format and mount"
index b921c79baff8739098f42e5636536b54a6b3b6be..f66c18054013469e49c1dc62e07b05b04aef0768 100755 (executable)
@@ -24,6 +24,7 @@ _begin_fstest auto quick clone
 
 # real QA test starts here
 _require_scratch_reflink
+_require_scratch_delalloc
 _require_xfs_io_command "falloc"
 _require_odirect
 
index 69cf635fc1feb1338b1b51619ae6d2df8b4bc7b8..38e00f97e65e1af087605c6f8588213f4eb44134 100755 (executable)
@@ -26,6 +26,7 @@ _begin_fstest auto quick clone
 # real QA test starts here
 _supported_fs generic
 _require_scratch_reflink
+_require_scratch_delalloc
 _require_xfs_io_command "falloc"
 
 echo "Format and mount"
index 925f346e9f8d45df59b3d4abb7de0d22e8cc56c0..89b2adadef554d0c4391e6d20cfd3b3a92a2e4e9 100755 (executable)
@@ -26,6 +26,7 @@ _begin_fstest auto quick clone
 # real QA test starts here
 _supported_fs generic
 _require_scratch_reflink
+_require_scratch_delalloc
 _require_xfs_io_command "falloc"
 
 echo "Format and mount"
index e3e627a8b8237d257657247c158689f71e4dd655..e7682f593ebaf2b9f32aeb67f7a0fc24802423e6 100755 (executable)
@@ -26,6 +26,7 @@ _begin_fstest auto quick clone
 # real QA test starts here
 _supported_fs generic
 _require_scratch_reflink
+_require_scratch_delalloc
 _require_xfs_io_command "falloc"
 
 echo "Format and mount"
index 047bedd5e0ae77b3e69869eb7b847802eec6bd5e..624cfc410856f3c83f25bb7031a475017e85fa7d 100755 (executable)
@@ -26,6 +26,7 @@ _begin_fstest auto quick clone
 # real QA test starts here
 _supported_fs generic
 _require_scratch_reflink
+_require_scratch_delalloc
 _require_xfs_io_command "falloc"
 
 echo "Format and mount"
index c049530536e093a1255510d9ec3b8b452c828db1..56c2583b9d60eae0c46ae73a8e58fc52c89cbc99 100755 (executable)
@@ -16,7 +16,6 @@ _begin_fstest rw filestreams
 
 # real QA test starts here
 _supported_fs xfs
-_require_command "$FILEFRAG_PROG" filefrag
 _require_scratch
 
 # The first _test_streams call sets up the filestreams allocator to fail and
@@ -36,16 +35,7 @@ _require_scratch
 # rescan thresholds and will keep pushing out the expiration time, with the
 # result that the filestreams allocator succeeds in maintaining the streams.
 # The test considers this a failure.
-#
-# Make sure that a regular buffered write produces delalloc reservations.
-# This effectively disables the test for files with extent size hints or DAX
-# mode set.
-_scratch_mkfs > $seqres.full
-_scratch_mount
-$XFS_IO_PROG -f -c 'pwrite 0 64k' $SCRATCH_MNT/testy &> /dev/null
-$FILEFRAG_PROG -v $SCRATCH_MNT/testy 2>&1 | grep -q delalloc || \
-       _notrun "test requires delayed allocation buffered writes"
-_scratch_unmount
+_require_scratch_delalloc
 
 _check_filestreams_support || _notrun "filestreams not available"
 
index f002f1de6b6c88d8c40a00658bd3ab43c8a9f9af..11dbad14d84397ed9f4e4ea7ed96bd5b068bce7a 100755 (executable)
@@ -22,6 +22,7 @@ _begin_fstest auto quick clone
 
 # real QA test starts here
 _require_scratch_reflink
+_require_scratch_delalloc
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "cowextsize"
 _require_odirect
index 11a54fa353fc3e701c8ecd910e850fc6cf88b5d2..f8bab07ee6757236ec50248cd50db699fdbb0c52 100755 (executable)
@@ -22,6 +22,7 @@ _begin_fstest auto quick clone
 
 # real QA test starts here
 _require_scratch_reflink
+_require_scratch_delalloc
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "cowextsize"
 
index 5c644c0f98cc73999c5a29a9de6a8f40c5304b88..f2f2f6a92d504694a5e1d9d2e13451ca8e66496e 100755 (executable)
@@ -25,6 +25,7 @@ _begin_fstest auto quick clone punch
 
 # real QA test starts here
 _require_scratch_reflink
+_require_scratch_delalloc
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "fpunch"
index 53e8dd78f3c0e87eb018968b9e82c9b14bd10992..15f6b6849c3c0ccc11243a904f802fd4b2b9df0d 100755 (executable)
@@ -25,6 +25,7 @@ _begin_fstest auto quick clone punch
 
 # real QA test starts here
 _require_scratch_reflink
+_require_scratch_delalloc
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "fpunch"
index acd55c220269e633771f46999b694fca0bc4a133..6a58f0ac7070566581dea01ef7fe76cfe4196245 100755 (executable)
@@ -25,6 +25,7 @@ _begin_fstest auto quick clone
 
 # real QA test starts here
 _require_scratch_reflink
+_require_scratch_delalloc
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "cowextsize"
 
index 25e8eb605d72068d375171063604787d59b64b66..2865cdf9cd0996c2c0f4c22d573b29be307624a8 100755 (executable)
@@ -25,6 +25,7 @@ _begin_fstest auto quick clone
 
 # real QA test starts here
 _require_scratch_reflink
+_require_scratch_delalloc
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "cowextsize"
 _require_odirect