[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190701182547.165856-2-ebiggers@kernel.org>
Date: Mon, 1 Jul 2019 11:25:40 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: fstests@...r.kernel.org
Cc: linux-fscrypt@...r.kernel.org, linux-ext4@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net,
Jaegeuk Kim <jaegeuk@...nel.org>,
"Theodore Y . Ts'o" <tytso@....edu>,
Victor Hsieh <victorhsieh@...gle.com>
Subject: [RFC PATCH v3 1/8] common/filter: add _filter_xfs_io_fiemap()
From: Eric Biggers <ebiggers@...gle.com>
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 <ebiggers@...gle.com>
---
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 '\<hole\>' \
+ | 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.
--
2.22.0.410.gd8fdbe21b5-goog
Powered by blists - more mailing lists