From patchwork Wed Nov 25 11:02:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Rajendra X-Patchwork-Id: 7697581 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 76299BF90C for ; Wed, 25 Nov 2015 11:04:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98FB6208DA for ; Wed, 25 Nov 2015 11:04:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7546B20881 for ; Wed, 25 Nov 2015 11:04:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752120AbbKYLEl (ORCPT ); Wed, 25 Nov 2015 06:04:41 -0500 Received: from e23smtp01.au.ibm.com ([202.81.31.143]:49763 "EHLO e23smtp01.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752121AbbKYLEj (ORCPT ); Wed, 25 Nov 2015 06:04:39 -0500 Received: from localhost by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 25 Nov 2015 21:04:37 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp01.au.ibm.com (202.81.31.207) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 25 Nov 2015 21:04:35 +1000 X-IBM-Helo: d23dlp01.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 d23dlp01.au.ibm.com (Postfix) with ESMTP id CC58C2CE8054; Wed, 25 Nov 2015 22:04:34 +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 tAPB4AUR35192974; Wed, 25 Nov 2015 22:04:18 +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 tAPB42nA020239; Wed, 25 Nov 2015 22:04:02 +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 tAPB3tOb019669; Wed, 25 Nov 2015 22:03:59 +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 01/12] Filter xfs_io and od's output in units of FS block size and the CPU's page size Date: Wed, 25 Nov 2015 16:32:55 +0530 Message-Id: <1448449386-4186-2-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-1618-0000-0000-000003323569 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 The helpers will be used to make btrfs tests that assume 4k as the block size to work on non-4k blocksized filesystem instances as well. Signed-off-by: Chandan Rajendra --- common/filter | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ common/rc | 5 +++++ 2 files changed, 57 insertions(+) diff --git a/common/filter b/common/filter index af456c9..faa6f82 100644 --- a/common/filter +++ b/common/filter @@ -229,6 +229,45 @@ _filter_xfs_io_unique() common_line_filter | _filter_xfs_io } +_filter_xfs_io_units_modified() +{ + UNIT=$1 + UNIT_SIZE=$2 + + $AWK_PROG -v unit="$UNIT" -v unit_size=$UNIT_SIZE ' + /wrote/ { + split($2, bytes, "/") + + bytes_written = strtonum(bytes[1]) + + offset = strtonum($NF) + + unit_start = offset / unit_size + unit_start = int(unit_start) + unit_end = (offset + bytes_written - 1) / unit_size + unit_end = int(unit_end) + + printf("%ss modified: [%d - %d]\n", unit, unit_start, unit_end) + + next + } + ' +} + +_filter_xfs_io_blocks_modified() +{ + BLOCK_SIZE=$(get_block_size $SCRATCH_MNT) + + _filter_xfs_io_units_modified "Block" $BLOCK_SIZE +} + +_filter_xfs_io_pages_modified() +{ + PAGE_SIZE=$(get_page_size) + + _filter_xfs_io_units_modified "Page" $PAGE_SIZE +} + _filter_test_dir() { sed -e "s,$TEST_DEV,TEST_DEV,g" -e "s,$TEST_DIR,TEST_DIR,g" @@ -323,5 +362,18 @@ _filter_ro_mount() { -e "s/mount: cannot mount block device/mount: cannot mount/g" } +_filter_od() +{ + BLOCK_SIZE=$(get_block_size $SCRATCH_MNT) + $AWK_PROG -v block_size=$BLOCK_SIZE ' + /^[0-9]+/ { + offset = strtonum("0"$1); + $1 = sprintf("%o", offset / block_size); + print $0; + } + /\*/ + ' +} + # make sure this script returns success /bin/true diff --git a/common/rc b/common/rc index 4c2f42c..acda6cb 100644 --- a/common/rc +++ b/common/rc @@ -3151,6 +3151,11 @@ get_block_size() echo `stat -f -c %S $1` } +get_page_size() +{ + echo $(getconf PAGE_SIZE) +} + init_rc ################################################################################