>From 82ca2acf976736b5dc638d6a5ab31a82a76364ae Mon Sep 17 00:00:00 2001 From: Brian Foster Date: Mon, 29 Feb 2016 09:04:25 -0500 Subject: [PATCH 2/2] tests/xfs: update indlen res. test to use fail writes mechanism This test originally used zero range operations to reproduce problematic indirect delalloc reservations on XFS. Zero range has since been updated such that it cannot be used to reproduce the problem. Instead, a buffered write failure mechanism has been added to XFS to facilitate reproducing this problem. Update the test to use the buffered write failure mechanism to split delalloc extents and reproduce the original indlen reservation problem. Signed-off-by: Brian Foster --- tests/xfs/289 | 28 +++++++++++++++++++--------- tests/xfs/289.out | 4 +--- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/tests/xfs/289 b/tests/xfs/289 index 33cf060..5da332b 100755 --- a/tests/xfs/289 +++ b/tests/xfs/289 @@ -44,6 +44,7 @@ _cleanup() # get standard environment, filters and checks . ./common/rc +. ./common/punch # real QA test starts here rm -f $seqres.full @@ -52,33 +53,42 @@ rm -f $seqres.full _supported_fs generic _supported_os Linux _require_scratch -_require_xfs_io_command "fzero" +_require_xfs_sysfs $(_short_dev $TEST_DEV)/fail_writes _scratch_mkfs >/dev/null 2>&1 _scratch_mount +sdev=$(_short_dev $SCRATCH_DEV) file=$SCRATCH_MNT/file.$seq bytes=$((64 * 1024)) # create sequential delayed allocation $XFS_IO_PROG -f -c "pwrite 0 $bytes" $file >> $seqres.full 2>&1 -# Zero every other 4k range to split the larger delalloc extent into many more -# smaller extents. Use zero instead of hole punch because the former does not -# force writeback (and hence delalloc conversion). It can simply discard -# delalloc blocks and convert the ranges to unwritten. +# Enable write failures. All buffered writes fail from this point on. +echo 1 > /sys/fs/xfs/$sdev/fail_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 +# preexisting delalloc blocks in the range of the I/O are tossed without +# discretion. This allows manipulation of the delalloc extent without conversion +# to real blocks (and thus releasing the indirect reservation). endoff=$((bytes - 4096)) for i in $(seq 0 8192 $endoff); do - $XFS_IO_PROG -c "fzero -k $i 4k" $file >> $seqres.full 2>&1 + $XFS_IO_PROG -c "pwrite $i 4k" $file >> $seqres.full 2>&1 done -# now zero the opposite set to remove remaining delalloc extents +# now pwrite the opposite set to remove remaining delalloc extents for i in $(seq 4096 8192 $endoff); do - $XFS_IO_PROG -c "fzero -k $i 4k" $file >> $seqres.full 2>&1 + $XFS_IO_PROG -c "pwrite $i 4k" $file >> $seqres.full 2>&1 done +echo 0 > /sys/fs/xfs/$sdev/fail_writes + +echo "Silence is golden." + _scratch_cycle_mount -hexdump $file +$XFS_IO_PROG -c 'bmap -vp' $file | _filter_bmap status=0 exit diff --git a/tests/xfs/289.out b/tests/xfs/289.out index bdcf195..72e60f9 100644 --- a/tests/xfs/289.out +++ b/tests/xfs/289.out @@ -1,4 +1,2 @@ QA output created by 289 -0000000 0000 0000 0000 0000 0000 0000 0000 0000 -* -0010000 +Silence is golden. -- 2.4.3