@@ -1686,3 +1686,40 @@ _xfs_get_inode_core_bytes()
echo 96
fi
}
+
+# Find us the path to the AG header containing a per-AG btree with a specific
+# height.
+_scratch_xfs_find_agbtree_height() {
+ local bt_type="$1"
+ local bt_height="$2"
+ local agcount=$(_xfs_mount_agcount $SCRATCH_DEV)
+
+ case "${bt_type}" in
+ "bno"|"cnt"|"rmap"|"refcnt")
+ hdr="agf"
+ bt_prefix="${bt_type}"
+ ;;
+ "ino")
+ hdr="agi"
+ bt_prefix=""
+ ;;
+ "fino")
+ hdr="agi"
+ bt_prefix="free_"
+ ;;
+ *)
+ _fail "Don't know about AG btree ${bt_type}"
+ ;;
+ esac
+
+ 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}" -eq "${bt_height}" ]; then
+ echo "${hdr} ${agno}"
+ return 0
+ fi
+ done
+
+ return 1
+}
@@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \
+ _fail "could not find two-level bnobt"
+
echo "Fuzz bnobt recs"
-_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing bnobt recs"
# success, all done
@@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \
+ _fail "could not find two-level bnobt"
+
echo "Fuzz bnobt recs"
-_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing bnobt recs"
# success, all done
@@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \
+ _fail "could not find two-level bnobt"
+
echo "Fuzz bnobt keyptr"
-_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr bnoroot' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr bnoroot' >> $seqres.full
echo "Done fuzzing bnobt keyptr"
# success, all done
@@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \
+ _fail "could not find two-level bnobt"
+
echo "Fuzz bnobt keyptr"
-_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr bnoroot' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr bnoroot' >> $seqres.full
echo "Done fuzzing bnobt keyptr"
# success, all done
@@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'cnt' 2)" || \
+ _fail "could not find two-level cntbt"
+
echo "Fuzz cntbt"
-_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr cntroot' 'addr ptrs[1]' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr cntroot' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing cntbt"
# success, all done
@@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'cnt' 2)" || \
+ _fail "could not find two-level cntbt"
+
echo "Fuzz cntbt"
-_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr cntroot' 'addr ptrs[1]' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr cntroot' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing cntbt"
# success, all done
@@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'ino' 2)" || \
+ _fail "could not find two-level inobt"
+
echo "Fuzz inobt"
-_scratch_xfs_fuzz_metadata '' 'offline' 'agi 0' 'addr root' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr root' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing inobt"
# success, all done
@@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'ino' 2)" || \
+ _fail "could not find two-level inobt"
+
echo "Fuzz inobt"
-_scratch_xfs_fuzz_metadata '' 'online' 'agi 1' 'addr root' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr root' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing inobt"
# success, all done
@@ -25,8 +25,11 @@ _require_xfs_finobt
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'fino' 2)" || \
+ _fail "could not find two-level finobt"
+
echo "Fuzz finobt"
-_scratch_xfs_fuzz_metadata '' 'offline' 'agi 0' 'addr free_root' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr free_root' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing finobt"
# success, all done
@@ -25,8 +25,11 @@ _require_xfs_finobt
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'fino' 2)" || \
+ _fail "could not find two-level finobt"
+
echo "Fuzz finobt"
-_scratch_xfs_fuzz_metadata '' 'online' 'agi 0' 'addr free_root' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr free_root' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing finobt"
# success, all done
@@ -25,8 +25,11 @@ _require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \
+ _fail "could not find two-level rmapbt"
+
echo "Fuzz rmapbt recs"
-_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing rmapbt recs"
# success, all done
@@ -25,8 +25,11 @@ _require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \
+ _fail "could not find two-level rmapbt"
+
echo "Fuzz rmapbt recs"
-_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing rmapbt recs"
# success, all done
@@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \
+ _fail "could not find two-level rmapbt"
+
echo "Fuzz rmapbt keyptr"
-_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr rmaproot' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr rmaproot' >> $seqres.full
echo "Done fuzzing rmapbt keyptr"
# success, all done
@@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \
+ _fail "could not find two-level rmapbt"
+
echo "Fuzz rmapbt keyptr"
-_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr rmaproot' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr rmaproot' >> $seqres.full
echo "Done fuzzing rmapbt keyptr"
# success, all done
@@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \
+ _fail "could not find two-level refcountbt"
+
echo "Fuzz refcountbt"
-_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr refcntroot' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr refcntroot' >> $seqres.full
echo "Done fuzzing refcountbt"
# success, all done
@@ -4,7 +4,7 @@
#
# FS QA Test No. 373
#
-# Populate a XFS filesystem and fuzz every refcountbt field.
+# Populate a XFS filesystem and fuzz every refcountbt key/pointer field.
# Use xfs_scrub to fix the corruption.
#
. ./common/preamble
@@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \
+ _fail "could not find two-level refcountbt"
+
echo "Fuzz refcountbt"
-_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr refcntroot' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr refcntroot' >> $seqres.full
echo "Done fuzzing refcountbt"
# success, all done
@@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \
+ _fail "could not find two-level refcountbt"
+
echo "Fuzz refcountbt"
-_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing refcountbt"
# success, all done
@@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \
+ _fail "could not find two-level refcountbt"
+
echo "Fuzz refcountbt"
-_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing refcountbt"
# success, all done
@@ -25,8 +25,11 @@ _disable_dmesg_check
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \
+ _fail "could not find two-level bnobt"
+
echo "Fuzz bnobt recs"
-_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing bnobt recs"
# success, all done
@@ -25,8 +25,11 @@ _disable_dmesg_check
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \
+ _fail "could not find two-level bnobt"
+
echo "Fuzz bnobt keyptr"
-_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr bnoroot' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr bnoroot' >> $seqres.full
echo "Done fuzzing bnobt keyptr"
# success, all done
@@ -25,8 +25,11 @@ _disable_dmesg_check
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'cnt' 2)" || \
+ _fail "could not find two-level cntbt"
+
echo "Fuzz cntbt"
-_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr cntroot' 'addr ptrs[1]' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr cntroot' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing cntbt"
# success, all done
@@ -25,8 +25,11 @@ _disable_dmesg_check
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'ino' 2)" || \
+ _fail "could not find two-level inobt"
+
echo "Fuzz inobt"
-_scratch_xfs_fuzz_metadata '' 'none' 'agi 1' 'addr root' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr root' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing inobt"
# success, all done
@@ -26,8 +26,11 @@ _require_xfs_finobt
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'fino' 2)" || \
+ _fail "could not find two-level finobt"
+
echo "Fuzz finobt"
-_scratch_xfs_fuzz_metadata '' 'none' 'agi 0' 'addr free_root' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr free_root' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing finobt"
# success, all done
@@ -26,8 +26,11 @@ _disable_dmesg_check
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \
+ _fail "could not find two-level rmapbt"
+
echo "Fuzz rmapbt recs"
-_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing rmapbt recs"
# success, all done
@@ -26,8 +26,11 @@ _disable_dmesg_check
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \
+ _fail "could not find two-level rmapbt"
+
echo "Fuzz rmapbt keyptr"
-_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr rmaproot' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr rmaproot' >> $seqres.full
echo "Done fuzzing rmapbt keyptr"
# success, all done
@@ -4,7 +4,7 @@
#
# FS QA Test No. 464
#
-# Populate a XFS filesystem and fuzz every refcountbt field.
+# Populate a XFS filesystem and fuzz every refcountbt key/pointer field.
# Do not fix the filesystem, to test metadata verifiers.
. ./common/preamble
@@ -27,8 +27,11 @@ _disable_dmesg_check
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \
+ _fail "could not find two-level refcountbt"
+
echo "Fuzz refcountbt"
-_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr refcntroot' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr refcntroot' >> $seqres.full
echo "Done fuzzing refcountbt"
# success, all done
@@ -27,8 +27,11 @@ _disable_dmesg_check
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
+path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \
+ _fail "could not find two-level refcountbt"
+
echo "Fuzz refcountbt"
-_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full
+_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full
echo "Done fuzzing refcountbt"
# success, all done