[PATCH 02/12] Fix btrfs/017 to work on non-4k block sized filesystems

Chandan Rajendra
2015-11-25T11:04:43Z

This commit makes use of the new _filter_xfs_io_blocks_modified filtering
function to print information in terms of file blocks rather than file
offset.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
---
tests/btrfs/017 | 16 ++++++++++++----
tests/btrfs/017.out | 3 +--
2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/tests/btrfs/017 b/tests/btrfs/017
index f8855e3..34c5f0a 100755
--- a/tests/btrfs/017
+++ b/tests/btrfs/017
@@ -63,13 +63,21 @@ rm -f $seqres.full
_scratch_mkfs "--nodesize 65536" >>$seqres.full 2>&1
_scratch_mount

-$XFS_IO_PROG -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo | _filter_xfs_io
+BLOCK_SIZE=$(get_block_size $SCRATCH_MNT)
+EXTENT_SIZE=$((2 * $BLOCK_SIZE))
+
+$XFS_IO_PROG -f -d -c "pwrite 0 $EXTENT_SIZE" $SCRATCH_MNT/foo \
+ | _filter_xfs_io_blocks_modified

_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap

-$CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
-$CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
-$CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2
+$CLONER_PROG -s 0 -d 0 -l $EXTENT_SIZE $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
+
+$CLONER_PROG -s 0 -d 0 -l $EXTENT_SIZE $SCRATCH_MNT/foo \
+ $SCRATCH_MNT/snap/foo-reflink
+
+$CLONER_PROG -s 0 -d 0 -l $EXTENT_SIZE $SCRATCH_MNT/foo \
+ $SCRATCH_MNT/snap/foo-reflink2

_run_btrfs_util_prog quota enable $SCRATCH_MNT
_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
diff --git a/tests/btrfs/017.out b/tests/btrfs/017.out
index f940f3a..503eb88 100644
--- a/tests/btrfs/017.out
+++ b/tests/btrfs/017.out
@@ -1,5 +1,4 @@
QA output created by 017
-wrote 8192/8192 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+Blocks modified: [0 - 1]
65536 65536
65536 65536
--
2.1.0