filter: Introduce filter to filter out offset for xfs_io

Some test cases (AFAIK, btrfs RAID recovery test cases) read out
certain location to verify its data.

Such read is mostly OK, but the golden output contains the on-disk
offset, which can differ due to underlying chunk change.  (This time
is mkfs chunk layout change for btrfs)

So introduce macro _filter_xfs_io_offset to filter out the offset part
wrote 65536/65536 bytes at offset 136708096
                       ^^^^^^^^^^^^^^^^^^^^
And offset from "pread -v"
08260000:  aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa  ................
^^^^^^^^^

Only btrfs/14[0-3] are affected.

Reported-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Qu Wenruo
2018-01-11 16:01:11 +08:00
committed by Eryu Guan
parent 8f20e80747
commit 3651c38e0b
9 changed files with 173 additions and 153 deletions
+6 -3
View File
@@ -99,7 +99,8 @@ _scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
# chunk
_scratch_mount -o nospace_cache,nodatasum
$XFS_IO_PROG -f -d -c "pwrite -S 0xaa -b 128K 0 128K" "$SCRATCH_MNT/foobar" | _filter_xfs_io
$XFS_IO_PROG -f -d -c "pwrite -S 0xaa -b 128K 0 128K" "$SCRATCH_MNT/foobar" |\
_filter_xfs_io_offset
# step 2, corrupt the first 64k of one copy (on SCRATCH_DEV which is the first
# one in $SCRATCH_DEV_POOL
@@ -110,7 +111,8 @@ logical_in_btrfs=`${FILEFRAG_PROG} -v $SCRATCH_MNT/foobar | _filter_filefrag | c
physical_on_scratch=`get_physical ${logical_in_btrfs}`
_scratch_unmount
$XFS_IO_PROG -d -c "pwrite -S 0xbb -b 64K $physical_on_scratch 64K" $SCRATCH_DEV | _filter_xfs_io
$XFS_IO_PROG -d -c "pwrite -S 0xbb -b 64K $physical_on_scratch 64K" $SCRATCH_DEV |\
_filter_xfs_io_offset
_scratch_mount -o nospace_cache
@@ -135,7 +137,8 @@ stop_fail
_scratch_unmount
# check if the repair works
$XFS_IO_PROG -c "pread -v -b 512 $physical_on_scratch 512" $SCRATCH_DEV | _filter_xfs_io
$XFS_IO_PROG -c "pread -v -b 512 $physical_on_scratch 512" $SCRATCH_DEV |\
_filter_xfs_io_offset
_scratch_dev_pool_put
# success, all done