From patchwork Wed Nov 25 11:03:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Rajendra X-Patchwork-Id: 7697761 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 813F3BF90C for ; Wed, 25 Nov 2015 11:05:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 91EA6208E3 for ; Wed, 25 Nov 2015 11:05:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7FDE5208E2 for ; Wed, 25 Nov 2015 11:05:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752207AbbKYLFe (ORCPT ); Wed, 25 Nov 2015 06:05:34 -0500 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:33649 "EHLO e23smtp08.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753261AbbKYLFD (ORCPT ); Wed, 25 Nov 2015 06:05:03 -0500 Received: from localhost by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 25 Nov 2015 21:05:01 +1000 Received: from d23dlp03.au.ibm.com (202.81.31.214) by e23smtp08.au.ibm.com (202.81.31.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 25 Nov 2015 21:04:58 +1000 X-IBM-Helo: d23dlp03.au.ibm.com X-IBM-MailFrom: chandan@linux.vnet.ibm.com X-IBM-RcptTo: fstests@vger.kernel.org;linux-btrfs@vger.kernel.org Received: from d23relay08.au.ibm.com (d23relay08.au.ibm.com [9.185.71.33]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 9B828357804F; Wed, 25 Nov 2015 22:04:58 +1100 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay08.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tAPB4XoB38207724; Wed, 25 Nov 2015 22:04:42 +1100 Received: from d23av02.au.ibm.com (localhost [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tAPB4Ps1020822; Wed, 25 Nov 2015 22:04:26 +1100 Received: from localhost.in.ibm.com ([9.77.202.94]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id tAPB3tOi019669; Wed, 25 Nov 2015 22:04:23 +1100 From: Chandan Rajendra To: fstests@vger.kernel.org Cc: Chandan Rajendra , linux-btrfs@vger.kernel.org, fdmanana@gmail.com, chandan@mykolab.com Subject: [PATCH 08/12] Fix btrfs/096 to work on non-4k block sized filesystems Date: Wed, 25 Nov 2015 16:33:02 +0530 Message-Id: <1448449386-4186-9-git-send-email-chandan@linux.vnet.ibm.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1448449386-4186-1-git-send-email-chandan@linux.vnet.ibm.com> References: <1448449386-4186-1-git-send-email-chandan@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15112511-0029-0000-0000-000002828681 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 --- tests/btrfs/096 | 45 +++++++++++++++++++++++++-------------------- tests/btrfs/096.out | 15 +++++---------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/tests/btrfs/096 b/tests/btrfs/096 index f5b3a7f..896a209 100755 --- a/tests/btrfs/096 +++ b/tests/btrfs/096 @@ -51,30 +51,35 @@ rm -f $seqres.full _scratch_mkfs >>$seqres.full 2>&1 _scratch_mount -# Create our test files. File foo has the same 2K of data at offset 4K as file -# bar has at its offset 0. -$XFS_IO_PROG -f -s -c "pwrite -S 0xaa 0 4K" \ - -c "pwrite -S 0xbb 4k 2K" \ - -c "pwrite -S 0xcc 8K 4K" \ - $SCRATCH_MNT/foo | _filter_xfs_io +BLOCK_SIZE=$(get_block_size $SCRATCH_MNT) -# File bar consists of a single inline extent (2K size). -$XFS_IO_PROG -f -s -c "pwrite -S 0xbb 0 2K" \ - $SCRATCH_MNT/bar | _filter_xfs_io +# Create our test files. File foo has the same 2k of data at offset $BLOCK_SIZE +# as file bar has at its offset 0. +$XFS_IO_PROG -f -s -c "pwrite -S 0xaa 0 $BLOCK_SIZE" \ + -c "pwrite -S 0xbb $BLOCK_SIZE 2k" \ + -c "pwrite -S 0xcc $(($BLOCK_SIZE * 2)) $BLOCK_SIZE" \ + $SCRATCH_MNT/foo | _filter_xfs_io_blocks_modified -# Now call the clone ioctl to clone the extent of file bar into file foo at its -# offset 4K. This made file foo have an inline extent at offset 4K, something -# which the btrfs code can not deal with in future IO operations because all -# inline extents are supposed to start at an offset of 0, resulting in all sorts -# of chaos. -# So here we validate that the clone ioctl returns an EOPNOTSUPP, which is what -# it returns for other cases dealing with inlined extents. -$CLONER_PROG -s 0 -d $((4 * 1024)) -l $((2 * 1024)) \ +# File bar consists of a single inline extent (2k in size). +$XFS_IO_PROG -f -s -c "pwrite -S 0xbb 0 2k" \ + $SCRATCH_MNT/bar | _filter_xfs_io_blocks_modified + +# Now call the clone ioctl to clone the extent of file bar into file +# foo at its $BLOCK_SIZE offset. This made file foo have an inline +# extent at offset $BLOCK_SIZE, something which the btrfs code can not +# deal with in future IO operations because all inline extents are +# supposed to start at an offset of 0, resulting in all sorts of +# chaos. +# So here we validate that the clone ioctl returns an EOPNOTSUPP, +# which is what it returns for other cases dealing with inlined +# extents. +$CLONER_PROG -s 0 -d $BLOCK_SIZE -l 2048 \ $SCRATCH_MNT/bar $SCRATCH_MNT/foo -# Because of the inline extent at offset 4K, the following write made the kernel -# crash with a BUG_ON(). -$XFS_IO_PROG -c "pwrite -S 0xdd 6K 2K" $SCRATCH_MNT/foo | _filter_xfs_io +# Because of the inline extent at offset $BLOCK_SIZE, the following +# write made the kernel crash with a BUG_ON(). +$XFS_IO_PROG -c "pwrite -S 0xdd $(($BLOCK_SIZE + 2048)) 2k" \ + $SCRATCH_MNT/foo | _filter_xfs_io_blocks_modified status=0 exit diff --git a/tests/btrfs/096.out b/tests/btrfs/096.out index 235198d..2a4251e 100644 --- a/tests/btrfs/096.out +++ b/tests/btrfs/096.out @@ -1,12 +1,7 @@ QA output created by 096 -wrote 4096/4096 bytes at offset 0 -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -wrote 2048/2048 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 8192 -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -wrote 2048/2048 bytes at offset 0 -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Blocks modified: [0 - 0] +Blocks modified: [1 - 1] +Blocks modified: [2 - 2] +Blocks modified: [0 - 0] clone failed: Operation not supported -wrote 2048/2048 bytes at offset 6144 -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Blocks modified: [1 - 1]