From patchwork Mon Nov 30 10:16:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Rajendra X-Patchwork-Id: 7722871 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 A8AB49F39B for ; Mon, 30 Nov 2015 10:17:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B8F5D2053B for ; Mon, 30 Nov 2015 10:17:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C4B9820549 for ; Mon, 30 Nov 2015 10:17:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751933AbbK3KRd (ORCPT ); Mon, 30 Nov 2015 05:17:33 -0500 Received: from e28smtp04.in.ibm.com ([122.248.162.4]:56168 "EHLO e28smtp04.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751159AbbK3KR0 (ORCPT ); Mon, 30 Nov 2015 05:17:26 -0500 Received: from localhost by e28smtp04.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Nov 2015 15:47:24 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp04.in.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 30 Nov 2015 15:47:21 +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 2EC051258019; Mon, 30 Nov 2015 15:47:38 +0530 (IST) Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay01.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tAUAHEDF23068784; Mon, 30 Nov 2015 15:47:14 +0530 Received: from d28av04.in.ibm.com (localhost [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tAUAHDYJ013923; Mon, 30 Nov 2015 15:47:14 +0530 Received: from localhost.in.ibm.com ([9.124.158.154]) by d28av04.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id tAUAHCkY013815; Mon, 30 Nov 2015 15:47:13 +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 V2 1/5] Filter xfs_io and od's output in units of FS block size Date: Mon, 30 Nov 2015 15:46:56 +0530 Message-Id: <1448878620-16382-2-git-send-email-chandan@linux.vnet.ibm.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1448878620-16382-1-git-send-email-chandan@linux.vnet.ibm.com> References: <1448878620-16382-1-git-send-email-chandan@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15113010-0013-0000-0000-000008C80A64 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 The helpers introduced in this commit 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 Reviewed-by: Filipe Manana --- common/filter | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/common/filter b/common/filter index af456c9..05f2fab 100644 --- a/common/filter +++ b/common/filter @@ -229,6 +229,38 @@ _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_test_dir() { sed -e "s,$TEST_DEV,TEST_DEV,g" -e "s,$TEST_DIR,TEST_DIR,g" @@ -323,5 +355,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