From patchwork Mon Nov 30 10:17:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Rajendra X-Patchwork-Id: 7723051 Return-Path: X-Original-To: patchwork-fstests@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 251F79F39B for ; Mon, 30 Nov 2015 10:18:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 034D12054C for ; Mon, 30 Nov 2015 10:18:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B9AE220549 for ; Mon, 30 Nov 2015 10:18:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752912AbbK3KSL (ORCPT ); Mon, 30 Nov 2015 05:18:11 -0500 Received: from e28smtp01.in.ibm.com ([122.248.162.1]:48610 "EHLO e28smtp01.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752606AbbK3KRq (ORCPT ); Mon, 30 Nov 2015 05:17:46 -0500 Received: from localhost by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Nov 2015 15:47:44 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp01.in.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 30 Nov 2015 15:47:42 +0530 X-IBM-Helo: d28dlp03.in.ibm.com X-IBM-MailFrom: chandan@linux.vnet.ibm.com X-IBM-RcptTo: fstests@vger.kernel.org;linux-btrfs@vger.kernel.org Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id 3482A125805F; Mon, 30 Nov 2015 15:47:58 +0530 (IST) Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay01.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tAUAHWvG42664138; Mon, 30 Nov 2015 15:47:34 +0530 Received: from d28av03.in.ibm.com (localhost [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tAUAHUn6016557; Mon, 30 Nov 2015 15:47:31 +0530 Received: from localhost.in.ibm.com ([9.124.158.154]) by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id tAUAHPBO016187; Mon, 30 Nov 2015 15:47:30 +0530 From: Chandan Rajendra To: fstests@vger.kernel.org Cc: Chandan Rajendra , linux-btrfs@vger.kernel.org, fdmanana@gmail.com, chandan@mykolab.com Subject: [PATCH 7/8] Fix btrfs/103 to work on non-4k block sized filesystems Date: Mon, 30 Nov 2015 15:47:23 +0530 Message-Id: <1448878644-16503-8-git-send-email-chandan@linux.vnet.ibm.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1448878644-16503-1-git-send-email-chandan@linux.vnet.ibm.com> References: <1448878644-16503-1-git-send-email-chandan@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15113010-4790-0000-0000-00000BE0CE82 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Filipe Manana --- tests/btrfs/103 | 44 +++++++++++------- tests/btrfs/103.out | 132 ++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 122 insertions(+), 54 deletions(-) diff --git a/tests/btrfs/103 b/tests/btrfs/103 index 3020c86..9d11d0f 100755 --- a/tests/btrfs/103 +++ b/tests/btrfs/103 @@ -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..." diff --git a/tests/btrfs/103.out b/tests/btrfs/103.out index f62de2f..8e31b5f 100644 --- a/tests/btrfs/103.out +++ b/tests/btrfs/103.out @@ -1,41 +1,101 @@ 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