From eae2dd124fa141a1e1863af8c5835e8b34dc1642 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 8 May 2025 07:34:30 +0200 Subject: [PATCH] common: generalize _filter_agno Rename and move to common/xfs so that it can be reused for rgnos in new zoned tests. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Reviewed-by: Zorro Lang Signed-off-by: Zorro Lang --- common/filestreams | 11 +---------- common/xfs | 10 ++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/common/filestreams b/common/filestreams index bb845940..ace8f3b7 100644 --- a/common/filestreams +++ b/common/filestreams @@ -42,19 +42,10 @@ _do_stream() done } -_filter_agno() -{ - # the ag number is in column 4 of xfs_bmap output - perl -ne ' - $ag = (split /\s+/)[4] ; - if ($ag =~ /\d+/) {print "$ag "} ; - ' -} - _get_stream_ags() { local directory_name=$1 - local stream_ags=`xfs_bmap -vp ${directory_name}/* | _filter_agno` + local stream_ags=`xfs_bmap -vp ${directory_name}/* | _filter_bmap_gno` echo $stream_ags } diff --git a/common/xfs b/common/xfs index 39650bac..061ca586 100644 --- a/common/xfs +++ b/common/xfs @@ -2274,3 +2274,13 @@ _scratch_find_rt_metadir_entry() { return 1 } + +# extract the AG/RTG number from xfs_bmap output +_filter_bmap_gno() +{ + # The AG/RG number is in column 4 of xfs_bmap output + perl -ne ' + $ag = (split /\s+/)[4] ; + if ($ag =~ /\d+/) {print "$ag "} ; + ' +} -- 2.39.5