fstests: generic/352 should accomodate other pwrite behaviors
PATCH v2 1/1 fstests: generic/352 should accomodate other pwrite behaviors
xfs_io pwrite issues a series of block size writes, but there is no guarantee that the resulting extent(s) will be singular or contiguous. This behavior is acceptable, but the test is flawed in that it expects a single extent for a pwrite.
Modify test to accept any layout for the reflinked logical range.
--- tests/generic/352 | 9 +++++---- tests/generic/352.out | 6 ++---- 2 files changed, 7 insertions(+), 8 deletions(-)
tests/generic/352 +5 -4
@@ -28,14 +28,15 @@ _require_xfs_io_command "fiemap" _scratch_mkfs > /dev/null 2>&1 _scratch_mount -blocksize=$((128 * 1024)) +blocksize=$(_get_file_block_size $SCRATCH_MNT) _require_congruent_file_oplen $SCRATCH_MNT $blocksize file="$SCRATCH_MNT/tmp" # Golden output is for $LOAD_FACTOR == 1 case orig_nr=8192 -orig_last_extent=$(($orig_nr * $blocksize / 512)) -orig_end=$(($orig_last_extent + $blocksize / 512 - 1)) +orig_blocksize=4096 +orig_last_extent=$(($orig_nr * $orig_blocksize / 512)) +orig_end=$(($orig_last_extent + $orig_blocksize / 512 - 1)) # Real output nr=$(($orig_nr * $LOAD_FACTOR))
@@ -43,7 +44,7 @@ last_extent=$(($nr * $blocksize / 512)) end=$(($last_extent + $blocksize / 512 - 1)) # write the initial block for later reflink -_pwrite_byte 0xcdcdcdcd 0 $blocksize $file | _filter_xfs_io +_pwrite_byte 0xcdcdcdcd 0 $blocksize $file | _filter_xfs_io > /dev/null # use reflink to create the rest of the file, whose all extents are all # pointing to the first extent
tests/generic/352.out +2 -4
@@ -1,5 +1,3 @@ QA output created by 352 -wrote 131072/131072 bytes at offset 0 -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -0: [0..2097151]: shared -1: [2097152..2097407]: shared|last +0: [0..65535]: shared +1: [65536..65543]: shared|last
Signature · 1 line
2.41.0
Quoted 6 lines · Bill O'Donnell
xfs_iopwrite issues a series of block size writes, but there is no guarantee that the resulting extent(s) will be singular or contiguous. This behavior is acceptable, but the test is flawed in that it expects a single extent for a pwrite.Modify test to accept any layout for the reflinked logical range.
I think this is no longer what the change does, right? You've now changed it so that it only pwrites (and reflinks) a single block rather than multiple, to avoid dealing with fragmentation issues.
Quoted 12 lines
Signed-off-by Bill O'Donnell <[email protected]>--- tests/generic/352 | 9 +++++---- tests/generic/352.out | 6 ++---- 2 files changed, 7 insertions(+), 8 deletions(-)tests/generic/352 +0
-0
tests/generic/352 _require_xfs_io_command "fiemap" · line 35
Quoted 9 lines
tests/generic/352 +1
-1@@ -28,14 +28,15 @@ _require_xfs_io_command "fiemap" _scratch_mkfs > /dev/null 2>&1 _scratch_mount -blocksize=$((128 * 1024)) +blocksize=$(_get_file_block_size $SCRATCH_MNT) _require_congruent_file_oplen $SCRATCH_MNT $blocksize file="$SCRATCH_MNT/tmp" # Golden output is for $LOAD_FACTOR == 1 case
$LOAD_FACTOR == 1 and 4k block size case, now - this is a little tricky so worth documenting IMHO.
Quoted 10 lines
tests/generic/352 +3
-2orig_nr=8192 -orig_last_extent=$(($orig_nr * $blocksize / 512)) -orig_end=$(($orig_last_extent + $blocksize / 512 - 1)) +orig_blocksize=4096 +orig_last_extent=$(($orig_nr * $orig_blocksize / 512)) +orig_end=$(($orig_last_extent + $orig_blocksize / 512 - 1)) # Real output nr=$(($orig_nr * $LOAD_FACTOR))
tests/generic/352 last_extent=$(($nr * $blocksize / 512)) · line 47
Quoted 5 lines
tests/generic/352 +1
-1@@ -43,7 +44,7 @@ last_extent=$(($nr * $blocksize / 512)) end=$(($last_extent + $blocksize / 512 - 1)) # write the initial block for later reflink -_pwrite_byte 0xcdcdcdcd 0 $blocksize $file | _filter_xfs_io +_pwrite_byte 0xcdcdcdcd 0 $blocksize $file | _filter_xfs_io > /dev/null
I think it's fine to exclude the non-matching lines of xfs_io output, but there's no reason to run it through the filter if you send it all to /dev/null anyway, so could just drop the filter here.
Other than those nitpicks, I think this looks fine now.
-Eric
Quoted 15 lines
tests/generic/352 +0
-0# use reflink to create the rest of the file, whose all extents are all # pointing to the first extenttests/generic/352.out +2
-4@@ -1,5 +1,3 @@ QA output created by 352 -wrote 131072/131072 bytes at offset 0 -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -0: [0..2097151]: shared -1: [2097152..2097407]: shared|last +0: [0..65535]: shared +1: [65536..65543]: shared|last