[PATCH 1/7] common/filter: Add a helper function to filter offsets and sizes

Nirjhar Roy (IBM)
2025-07-29T06:23:27Z

_filter_xfs_io_size_offset() filters out the size and the offset
emitted by various subcommands of xfs_io like pwrite.

Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
---
common/filter | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/common/filter b/common/filter
index bbe13f4c..45188a5a 100644
--- a/common/filter
+++ b/common/filter
@@ -115,6 +115,20 @@ _filter_date()
-e 's/[A-Z][a-z][a-z] [A-z][a-z][a-z] *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]$/DATE/'
}

+# This filters out the offsets and bytes written with
+# various subcommands of xfs_io. For example
+# wrote 4096/4096 bytes at offset 1052672 will be
+# converted to
+# wrote SIZE/SIZE bytes at offset OFFSET.
+# usage: __filter_xfs_io_size_offset <offset> <size>
+_filter_xfs_io_size_offset()
+{
+ local offset="$1"
+ local size="$2"
+ sed -e "s#${size}/${size}#SIZE/SIZE#g" \
+ -e "s#offset ${offset}#offset OFFSET#g"
+}
+
# prints filtered output on stdout, values (use eval) on stderr
# Non XFS filesystems always return a 4k block size and a 256 byte inode.
_filter_mkfs()
--
2.34.1