From: Chandan Rajendra <chandan@linux.vnet.ibm.com>
To: fstests@vger.kernel.org
Cc: Chandan Rajendra <chandan@linux.vnet.ibm.com>,
linux-btrfs@vger.kernel.org, fdmanana@gmail.com,
chandan@mykolab.com
Subject: [PATCH 09/12] Fix btrfs/097 to work on non-4k block sized filesystems
Date: Wed, 25 Nov 2015 16:33:03 +0530 [thread overview]
Message-ID: <1448449386-4186-10-git-send-email-chandan@linux.vnet.ibm.com> (raw)
In-Reply-To: <1448449386-4186-1-git-send-email-chandan@linux.vnet.ibm.com>
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/097 | 42 +++++++++++++++++++++++++-----------------
tests/btrfs/097.out | 7 +------
2 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/tests/btrfs/097 b/tests/btrfs/097
index d9138ea..915ff9d 100755
--- a/tests/btrfs/097
+++ b/tests/btrfs/097
@@ -57,22 +57,29 @@ mkdir $send_files_dir
_scratch_mkfs >>$seqres.full 2>&1
_scratch_mount
-# Create our test file with a single extent of 64K starting at file offset 128K.
-$XFS_IO_PROG -f -c "pwrite -S 0xaa 128K 64K" $SCRATCH_MNT/foo | _filter_xfs_io
+BLOCK_SIZE=$(get_block_size $SCRATCH_MNT)
+
+# Create our test file with a single extent of 16 blocks starting at a file
+# offset mapped by 32nd block.
+$XFS_IO_PROG -f -c "pwrite -S 0xaa $((32 * $BLOCK_SIZE)) $((16 * $BLOCK_SIZE))" \
+ $SCRATCH_MNT/foo | _filter_xfs_io_blocks_modified
_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap1
# Now clone parts of the original extent into lower offsets of the file.
#
# The first clone operation adds a file extent item to file offset 0 that points
-# to our initial extent with a data offset of 16K. The corresponding data back
-# reference in the extent tree has an offset of 18446744073709535232, which is
-# the result of file_offset - data_offset = 0 - 16K.
-#
-# The second clone operation adds a file extent item to file offset 16K that
-# points to our initial extent with a data offset of 48K. The corresponding data
-# back reference in the extent tree has an offset of 18446744073709518848, which
-# is the result of file_offset - data_offset = 16K - 48K.
+# to our initial extent with a data offset of 4 blocks. The corresponding data back
+# reference in the extent tree has a large value for the 'offset' field, which is
+# the result of file_offset - data_offset = 0 - (file offset of 4th block). For
+# example in case of 4k block size, it will be 0 - 16k = 18446744073709535232.
+
+# The second clone operation adds a file extent item to file offset mapped by
+# 4th block that points to our initial extent with a data offset of 12
+# blocks. The corresponding data back reference in the extent tree has a large
+# value for the 'offset' field, which is the result of file_offset - data_offset
+# = (file offset of 4th block) - (file offset of 12th block). For example in
+# case of 4k block size, it will be 16K - 48K = 18446744073709518848.
#
# Those large back reference offsets (result of unsigned arithmetic underflow)
# confused the back reference walking code (used by an incremental send and
@@ -83,10 +90,10 @@ _run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap1
# "BTRFS error (device sdc): did not find backref in send_root. inode=257, \
# offset=0, disk_byte=12845056 found extent=12845056"
#
-$CLONER_PROG -s $(((128 + 16) * 1024)) -d 0 -l $((16 * 1024)) \
- $SCRATCH_MNT/foo $SCRATCH_MNT/foo
-$CLONER_PROG -s $(((128 + 48) * 1024)) -d $((16 * 1024)) -l $((16 * 1024)) \
+$CLONER_PROG -s $(((32 + 4) * $BLOCK_SIZE)) -d 0 -l $((4 * $BLOCK_SIZE)) \
$SCRATCH_MNT/foo $SCRATCH_MNT/foo
+$CLONER_PROG -s $(((32 + 12) * $BLOCK_SIZE)) -d $((4 * $BLOCK_SIZE)) \
+ -l $((4 * $BLOCK_SIZE)) $SCRATCH_MNT/foo $SCRATCH_MNT/foo
_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap2
@@ -94,8 +101,7 @@ _run_btrfs_util_prog send $SCRATCH_MNT/mysnap1 -f $send_files_dir/1.snap
_run_btrfs_util_prog send -p $SCRATCH_MNT/mysnap1 $SCRATCH_MNT/mysnap2 \
-f $send_files_dir/2.snap
-echo "File digest in the original filesystem:"
-md5sum $SCRATCH_MNT/mysnap2/foo | _filter_scratch
+orig_hash=$(md5sum $SCRATCH_MNT/mysnap2/foo | cut -f 1 -d ' ')
# Now recreate the filesystem by receiving both send streams and verify we get
# the same file contents that the original filesystem had.
@@ -106,8 +112,10 @@ _scratch_mount
_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/1.snap
_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/2.snap
-echo "File digest in the new filesystem:"
-md5sum $SCRATCH_MNT/mysnap2/foo | _filter_scratch
+hash=$(md5sum $SCRATCH_MNT/mysnap2/foo | cut -f 1 -d ' ')
+if [ $orig_hash != $hash ]; then
+ echo "Btrfs send/receive failed: Mismatching hash values detected."
+fi
status=0
exit
diff --git a/tests/btrfs/097.out b/tests/btrfs/097.out
index 5e87eb2..c3a19c1 100644
--- a/tests/btrfs/097.out
+++ b/tests/btrfs/097.out
@@ -1,7 +1,2 @@
QA output created by 097
-wrote 65536/65536 bytes at offset 131072
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-File digest in the original filesystem:
-6c6079335cff141b8a31233ead04cbff SCRATCH_MNT/mysnap2/foo
-File digest in the new filesystem:
-6c6079335cff141b8a31233ead04cbff SCRATCH_MNT/mysnap2/foo
+Blocks modified: [32 - 47]
--
2.1.0
next prev parent reply other threads:[~2015-11-25 11:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-25 11:02 [PATCH 00/12] Fix Btrfs tests to work on non-4k block sized fs instances Chandan Rajendra
2015-11-25 11:02 ` [PATCH 01/12] Filter xfs_io and od's output in units of FS block size and the CPU's page size Chandan Rajendra
2015-11-25 11:02 ` [PATCH 02/12] Fix btrfs/017 to work on non-4k block sized filesystems Chandan Rajendra
2015-11-25 11:02 ` [PATCH 03/12] Fix btrfs/052 " Chandan Rajendra
2015-11-25 11:02 ` [PATCH 04/12] Fix btrfs/055 " Chandan Rajendra
2015-11-25 11:02 ` [PATCH 05/12] Fix btrfs/056 " Chandan Rajendra
2015-11-25 11:03 ` [PATCH 06/12] Fix btrfs/094 " Chandan Rajendra
2015-11-25 11:11 ` Filipe Manana
2015-11-25 11:47 ` Chandan Rajendra
2015-11-25 11:51 ` Filipe Manana
2015-11-25 12:03 ` Chandan Rajendra
2015-11-25 11:03 ` [PATCH 07/12] Fix btrfs/095 " Chandan Rajendra
2015-11-25 11:03 ` [PATCH 08/12] Fix btrfs/096 " Chandan Rajendra
2015-11-25 11:03 ` Chandan Rajendra [this message]
2015-11-25 11:03 ` [PATCH 10/12] Fix btrfs/098 " Chandan Rajendra
2015-11-25 11:03 ` [PATCH 11/12] Fix btrfs/103 " Chandan Rajendra
2015-11-25 11:03 ` [PATCH 12/12] Fix btrfs/106 " Chandan Rajendra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1448449386-4186-10-git-send-email-chandan@linux.vnet.ibm.com \
--to=chandan@linux.vnet.ibm.com \
--cc=chandan@mykolab.com \
--cc=fdmanana@gmail.com \
--cc=fstests@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox