summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>2023-12-13 03:35:23 -0800
committerZorro Lang <zlang@kernel.org>2024-01-14 20:39:09 +0800
commit807b93a1cec7bca34dce301856bd0a4573fcdc9e (patch)
treeb39a95e0d1db3e75efca31fd47b47fabae15bc68 /common
parent08dbb837f1a84f76c42fdfb8f403dec064467f0a (diff)
common: add filter for btrfs raid-stripe dump
Reviewed-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Anand Jain <anand.jain@oracle.com> [ add trailing whitespace and the version filter ] Signed-off-by: Zorro Lang <zlang@kernel.org>
Diffstat (limited to 'common')
-rw-r--r--common/filter.btrfs15
1 files changed, 15 insertions, 0 deletions
diff --git a/common/filter.btrfs b/common/filter.btrfs
index 8c6fe579..8ab76fcb 100644
--- a/common/filter.btrfs
+++ b/common/filter.btrfs
@@ -126,5 +126,20 @@ _filter_btrfs_cloner_error()
sed -e "s/\(clone failed:\) Operation not supported/\1 Invalid argument/g"
}
+# filter output of "btrfs inspect-internal dump-tree -t raid-stripe"
+_filter_stripe_tree()
+{
+ _filter_trailing_whitespace | _filter_btrfs_version |\
+ sed -E -e "s/leaf [0-9]+ items [0-9]+ free space [0-9]+ generation [0-9]+ owner RAID_STRIPE_TREE/leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE/" \
+ -e "s/leaf [0-9]+ flags 0x1\(WRITTEN\) backref revision 1/leaf XXXXXXXXX flags 0x1\(WRITTEN\) backref revision 1/" \
+ -e "s/checksum stored [0-9a-f]+/checksum stored <CHECKSUM>/" \
+ -e "s/checksum calced [0-9a-f]+/checksum calced <CHECKSUM>/" \
+ -e "s/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/<UUID>/" \
+ -e "s/item ([0-9]+) key \([0-9]+ RAID_STRIPE ([0-9]+)\) itemoff [0-9]+ itemsize ([0-9]+)/item \1 key \(XXXXXX RAID_STRIPE \2\) itemoff XXXXX itemsize \3/" \
+ -e "s/stripe ([0-9]+) devid ([0-9]+) physical [0-9]+/stripe \1 devid \2 physical XXXXXXXXX/" \
+ -e "s/total bytes [0-9]+/total bytes XXXXXXXX/" \
+ -e "s/bytes used [0-9]+/bytes used XXXXXX/"
+}
+
# make sure this script returns success
/bin/true