btrfs/103: work on non-4k block sized filesystems
authorChandan Rajendra <chandan@linux.vnet.ibm.com>
Mon, 21 Dec 2015 07:01:46 +0000 (18:01 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 21 Dec 2015 07:01:46 +0000 (18:01 +1100)
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>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
tests/btrfs/103
tests/btrfs/103.out

index 3020c8680943d92430329eb9df83572914eafc21..9d11d0f5026593ce77a3eb244b52b00a4ac7ae29 100755 (executable)
@@ -56,31 +56,37 @@ 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
+       echo "File contents before unmounting filesystem:"
+       echo "foo:"
+       od -t x1 $SCRATCH_MNT/foo | _filter_od
+       echo "bar:"
+       od -t x1 $SCRATCH_MNT/bar | _filter_od
 
        # 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 +97,12 @@ 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
+       echo "File contents after mounting filesystem again:"
+       # Must match the same contents we got before.
+       echo "foo:"
+       od -t x1 $SCRATCH_MNT/foo | _filter_od
+       echo "bar:"
+       od -t x1 $SCRATCH_MNT/bar | _filter_od
 }
 
 echo -e "\nTesting with zlib compression..."
index f62de2f5d2afd45a4ffef1937dbfc0f33750f281..8e31b5fbe2724a04856f48b1d98648439866086e 100644 (file)
 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]
+File contents before unmounting filesystem:
+foo:
+0 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
+*
+1 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
+*
+3 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
+*
+4 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
+*
+6
+bar:
+0 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
+*
+2 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
+*
+3 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
+*
+5 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
+*
+6
+File contents after mounting filesystem again:
+foo:
+0 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
+*
+1 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
+*
+3 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
+*
+4 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
+*
+6
+bar:
+0 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
+*
+2 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
+*
+3 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
+*
+5 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
+*
+6
 
 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]
+File contents before unmounting filesystem:
+foo:
+0 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
+*
+1 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
+*
+3 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
+*
+4 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
+*
+6
+bar:
+0 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
+*
+2 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
+*
+3 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
+*
+5 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
+*
+6
+File contents after mounting filesystem again:
+foo:
+0 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
+*
+1 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
+*
+3 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
+*
+4 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
+*
+6
+bar:
+0 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
+*
+2 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
+*
+3 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
+*
+5 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
+*
+6