public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
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 11/12] Fix btrfs/103 to work on non-4k block sized filesystems
Date: Wed, 25 Nov 2015 16:33:05 +0530	[thread overview]
Message-ID: <1448449386-4186-12-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/103     | 47 +++++++++++++++++++++++++++++------------------
 tests/btrfs/103.out | 48 ++++++++++++------------------------------------
 2 files changed, 41 insertions(+), 54 deletions(-)

diff --git a/tests/btrfs/103 b/tests/btrfs/103
index 3020c86..a807900 100755
--- a/tests/btrfs/103
+++ b/tests/btrfs/103
@@ -56,31 +56,34 @@ test_clone_and_read_compressed_extent()
 	_scratch_mkfs >>$seqres.full 2>&1
 	_scratch_mount $mount_opts
 
+	BLOCK_SIZE=$(get_block_size $SCRATCH_MNT)
+
 	# Create a test file with a single extent that is compressed (the
 	# data we write into it is highly compressible no matter which
 	# compression algorithm is used, zlib or lzo).
-	$XFS_IO_PROG -f -c "pwrite -S 0xaa 0K 4K"        \
-			-c "pwrite -S 0xbb 4K 8K"        \
-			-c "pwrite -S 0xcc 12K 4K"       \
-			$SCRATCH_MNT/foo | _filter_xfs_io
+	$XFS_IO_PROG -f -c "pwrite -S 0xaa 0K $((1 * $BLOCK_SIZE))" \
+		-c "pwrite -S 0xbb $((1 * $BLOCK_SIZE)) $((2 * $BLOCK_SIZE))" \
+		-c "pwrite -S 0xcc $((3 * $BLOCK_SIZE)) $((1 * $BLOCK_SIZE))" \
+		$SCRATCH_MNT/foo | _filter_xfs_io_blocks_modified
+
 
 	# Now clone our extent into an adjacent offset.
-	$CLONER_PROG -s $((4 * 1024)) -d $((16 * 1024)) -l $((8 * 1024)) \
-		$SCRATCH_MNT/foo $SCRATCH_MNT/foo
+	$CLONER_PROG -s $((1 * $BLOCK_SIZE)) -d $((4 * $BLOCK_SIZE)) \
+		     -l $((2 * $BLOCK_SIZE)) $SCRATCH_MNT/foo $SCRATCH_MNT/foo
 
 	# Same as before but for this file we clone the extent into a lower
 	# file offset.
-	$XFS_IO_PROG -f -c "pwrite -S 0xaa 8K 4K"         \
-			-c "pwrite -S 0xbb 12K 8K"        \
-			-c "pwrite -S 0xcc 20K 4K"        \
-			$SCRATCH_MNT/bar | _filter_xfs_io
+	$XFS_IO_PROG -f \
+		-c "pwrite -S 0xaa $((2 * $BLOCK_SIZE)) $((1 * $BLOCK_SIZE))" \
+		-c "pwrite -S 0xbb $((3 * $BLOCK_SIZE)) $((2 * $BLOCK_SIZE))" \
+		-c "pwrite -S 0xcc $((5 * $BLOCK_SIZE)) $((1 * $BLOCK_SIZE))" \
+		$SCRATCH_MNT/bar | _filter_xfs_io_blocks_modified
 
-	$CLONER_PROG -s $((12 * 1024)) -d 0 -l $((8 * 1024)) \
+	$CLONER_PROG -s $((3 * $BLOCK_SIZE)) -d 0 -l $((2 * $BLOCK_SIZE)) \
 		$SCRATCH_MNT/bar $SCRATCH_MNT/bar
 
-	echo "File digests before unmounting filesystem:"
-	md5sum $SCRATCH_MNT/foo | _filter_scratch
-	md5sum $SCRATCH_MNT/bar | _filter_scratch
+	foo_orig_hash=$(md5sum $SCRATCH_MNT/foo | cut -f 1 -d ' ')
+	bar_orig_hash=$(md5sum $SCRATCH_MNT/bar | cut -f 1 -d ' ')
 
 	# Evicting the inode or clearing the page cache before reading again
 	# the file would also trigger the bug - reads were returning all bytes
@@ -91,10 +94,18 @@ test_clone_and_read_compressed_extent()
 	# ranges that point to the same compressed extent.
 	_scratch_remount
 
-	echo "File digests after mounting filesystem again:"
-	# Must match the same digests we got before.
-	md5sum $SCRATCH_MNT/foo | _filter_scratch
-	md5sum $SCRATCH_MNT/bar | _filter_scratch
+	foo_hash=$(md5sum $SCRATCH_MNT/foo | cut -f 1 -d ' ')
+	bar_hash=$(md5sum $SCRATCH_MNT/bar | cut -f 1 -d ' ')
+
+	if [ $foo_orig_hash != $foo_hash ]; then
+		echo "Read operation failed on $SCRATCH_MNT/foo: "\
+		     "Mimatching hash values detected."
+	fi
+
+	if [ $bar_orig_hash != $bar_hash ]; then
+		echo "Read operation failed on $SCRATCH_MNT/bar: "\
+		     "Mimatching hash values detected."
+	fi
 }
 
 echo -e "\nTesting with zlib compression..."
diff --git a/tests/btrfs/103.out b/tests/btrfs/103.out
index f62de2f..964b70f 100644
--- a/tests/btrfs/103.out
+++ b/tests/btrfs/103.out
@@ -1,41 +1,17 @@
 QA output created by 103
 
 Testing with zlib compression...
-wrote 4096/4096 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 8192/8192 bytes at offset 4096
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 4096/4096 bytes at offset 12288
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 4096/4096 bytes at offset 8192
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 8192/8192 bytes at offset 12288
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 4096/4096 bytes at offset 20480
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-File digests before unmounting filesystem:
-4b985a45790261a706c3ddbf22c5f765  SCRATCH_MNT/foo
-fd331e6b7a9ab105f48f71b53162d5b5  SCRATCH_MNT/bar
-File digests after mounting filesystem again:
-4b985a45790261a706c3ddbf22c5f765  SCRATCH_MNT/foo
-fd331e6b7a9ab105f48f71b53162d5b5  SCRATCH_MNT/bar
+Blocks modified: [0 - 0]
+Blocks modified: [1 - 2]
+Blocks modified: [3 - 3]
+Blocks modified: [2 - 2]
+Blocks modified: [3 - 4]
+Blocks modified: [5 - 5]
 
 Testing with lzo compression...
-wrote 4096/4096 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 8192/8192 bytes at offset 4096
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 4096/4096 bytes at offset 12288
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 4096/4096 bytes at offset 8192
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 8192/8192 bytes at offset 12288
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 4096/4096 bytes at offset 20480
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-File digests before unmounting filesystem:
-4b985a45790261a706c3ddbf22c5f765  SCRATCH_MNT/foo
-fd331e6b7a9ab105f48f71b53162d5b5  SCRATCH_MNT/bar
-File digests after mounting filesystem again:
-4b985a45790261a706c3ddbf22c5f765  SCRATCH_MNT/foo
-fd331e6b7a9ab105f48f71b53162d5b5  SCRATCH_MNT/bar
+Blocks modified: [0 - 0]
+Blocks modified: [1 - 2]
+Blocks modified: [3 - 3]
+Blocks modified: [2 - 2]
+Blocks modified: [3 - 4]
+Blocks modified: [5 - 5]
-- 
2.1.0


  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 ` [PATCH 09/12] Fix btrfs/097 " Chandan Rajendra
2015-11-25 11:03 ` [PATCH 10/12] Fix btrfs/098 " Chandan Rajendra
2015-11-25 11:03 ` Chandan Rajendra [this message]
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-12-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