_supported_fs generic
_supported_os Linux
_require_scratch
-_require_xfs_sysfs $(_short_dev $TEST_DEV)/drop_writes
+
+DROP_WRITES="drop_writes"
+# replace "drop_writes" with "fail_writes" for old kernel
+if [ -f /sys/fs/xfs/$(_short_dev $TEST_DEV)/fail_writes ];then
+ DROP_WRITES="fail_writes"
+fi
+_require_xfs_sysfs $(_short_dev $TEST_DEV)/${DROP_WRITES}
_scratch_mkfs >/dev/null 2>&1
_scratch_mount
$XFS_IO_PROG -f -c "pwrite 0 $bytes" $file >> $seqres.full 2>&1
# Enable write drops. All buffered writes are dropped from this point on.
-echo 1 > /sys/fs/xfs/$sdev/drop_writes
+echo 1 > /sys/fs/xfs/$sdev/$DROP_WRITES
# Write every other 4k range to split the larger delalloc extent into many more
# smaller extents. Use pwrite because with write failures enabled, all
$XFS_IO_PROG -c "pwrite $i 4k" $file >> $seqres.full 2>&1
done
-echo 0 > /sys/fs/xfs/$sdev/drop_writes
+echo 0 > /sys/fs/xfs/$sdev/$DROP_WRITES
_scratch_cycle_mount
$XFS_IO_PROG -c 'bmap -vp' $file | _filter_bmap
$XFS_IO_PROG -fc "pwrite ${offset}m 100m" $file >> $seqres.full 2>&1
punchoffset=$((offset + 75))
- echo 1 > /sys/fs/xfs/$sdev/drop_writes
+ echo 1 > /sys/fs/xfs/$sdev/$DROP_WRITES
$XFS_IO_PROG -c "pwrite ${punchoffset}m 4k" $file >> $seqres.full 2>&1
- echo 0 > /sys/fs/xfs/$sdev/drop_writes
+ echo 0 > /sys/fs/xfs/$sdev/$DROP_WRITES
done
echo "Silence is golden."