common/rc: introduce _require_scratch_delalloc()
[xfstests-dev.git] / common / rc
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()