diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-12-30 14:19:36 -0800 |
---|---|---|
committer | Zorro Lang <zlang@kernel.org> | 2023-02-18 14:58:27 +0800 |
commit | 9ba85b9a6f0f3246b231519077df7f0ed313c302 (patch) | |
tree | ad89967c4480807be2e15a58bda6436cb31c97b7 | |
parent | 215075d03ddf916c7c3744581aa936a143a71ed9 (diff) |
populate: fix some weirdness in __populate_check_xfs_agbtree_heightv2023.02.19
Use a for loop to scan the AGs, and make all the variables local like
you'd expect them to be.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
-rw-r--r-- | common/populate | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/common/populate b/common/populate index 467252d7..b6f510f3 100644 --- a/common/populate +++ b/common/populate @@ -605,8 +605,8 @@ __populate_check_xfs_attr() { # Check that there's at least one per-AG btree with multiple levels __populate_check_xfs_agbtree_height() { - bt_type="$1" - nr_ags=$(_scratch_xfs_db -c 'sb 0' -c 'p agcount' | awk '{print $3}') + local bt_type="$1" + local agcount=$(_scratch_xfs_db -c 'sb 0' -c 'p agcount' | awk '{print $3}') case "${bt_type}" in "bno"|"cnt"|"rmap"|"refcnt") @@ -626,13 +626,14 @@ __populate_check_xfs_agbtree_height() { ;; esac - seq 0 $((nr_ags - 1)) | while read ag; do - bt_level=$(_scratch_xfs_db -c "${hdr} ${ag}" -c "p ${bt_prefix}level" | awk '{print $3}') + for ((agno = 0; agno < agcount; agno++)); do + bt_level=$(_scratch_xfs_db -c "${hdr} ${agno}" -c "p ${bt_prefix}level" | awk '{print $3}') + # "level" is really the btree height if [ "${bt_level}" -gt 1 ]; then - return 100 + return 0 fi done - test $? -eq 100 || __populate_fail "Failed to create ${bt_type} of sufficient height!" + __populate_fail "Failed to create ${bt_type} of sufficient height!" return 1 } |