From patchwork Thu Jun 20 21:36:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 11008225 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25E1E924 for ; Thu, 20 Jun 2019 21:38:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A227287FA for ; Thu, 20 Jun 2019 21:38:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E69B288FA; Thu, 20 Jun 2019 21:38:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1F17287FA for ; Thu, 20 Jun 2019 21:38:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726328AbfFTVii (ORCPT ); Thu, 20 Jun 2019 17:38:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:47138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726008AbfFTVii (ORCPT ); Thu, 20 Jun 2019 17:38:38 -0400 Received: from ebiggers-linuxstation.mtv.corp.google.com (unknown [104.132.1.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3094A2084A; Thu, 20 Jun 2019 21:38:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561066717; bh=/TqjxXaacZLBl0M7a8866fUvjTCYt+qsAku09GMwzaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rG3C7MUEr0Yhda6R/BLbL+18hBUT5WtHy9dhgeZ8rhA2v8aHrgWvC3wU8TDuVHB57 +pQdh2GSzulC1jBiaAmlKER/6HHFRZkyycwG0hJXACVd+ePZAORoVRWAnz8ATsSQhs 48SM6gkjmgFqR0b7+jWPDrDXrOEgx5q5ap4N2y8A= From: Eric Biggers To: fstests@vger.kernel.org Cc: linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Jaegeuk Kim , "Theodore Y . Ts'o" , Victor Hsieh Subject: [RFC PATCH v2 1/8] common/filter: add _filter_xfs_io_fiemap() Date: Thu, 20 Jun 2019 14:36:07 -0700 Message-Id: <20190620213614.113685-2-ebiggers@kernel.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190620213614.113685-1-ebiggers@kernel.org> References: <20190620213614.113685-1-ebiggers@kernel.org> MIME-Version: 1.0 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Biggers Add _filter_xfs_io_fiemap() to clean up the output of 'xfs_io -c fiemap'. This will be used by a function in common/verity. Signed-off-by: Eric Biggers --- common/filter | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/common/filter b/common/filter index ed082d24..9ad43ff4 100644 --- a/common/filter +++ b/common/filter @@ -541,6 +541,30 @@ _filter_filefrag() $flags, "\n"' } +# Clean up the extents list output of 'xfs_io -c fiemap', e.g. +# +# file: +# 0: [0..79]: 628365312..628365391 +# 1: [80..159]: hole +# 2: [160..319]: 628365472..628365631 +# => +# 0 79 628365312 628365391 +# 160 319 628365472 628365631 +# +# The fields are: +# +# first_logical_block last_logical_block first_physical_block last_physical_block +# +# Blocks are 512 bytes, and holes are omitted. +# +_filter_xfs_io_fiemap() +{ + grep -E '^[[:space:]]+[0-9]+:' \ + | grep -v '\' \ + | sed -E 's/^[[:space:]]+[0-9]+://' \ + | tr '][.:' ' ' +} + # We generate WARNINGs on purpose when applications mix buffered/mmap IO with # direct IO on the same file. This is a helper for _check_dmesg() to filter out # such warnings.