]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
xfs/{030,033,178}: forcibly disable metadata directory trees
authorDarrick J. Wong <djwong@kernel.org>
Thu, 21 Nov 2024 00:27:21 +0000 (16:27 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 23 Jan 2025 21:19:54 +0000 (13:19 -0800)
The golden output for thests tests encode the xfs_repair output when we
fuzz various parts of the filesystem.  With metadata directory trees
enabled, however, the golden output changes dramatically to reflect
reconstruction of the metadata directory tree.

To avoid regressions, add a helper to force metadata directories off via
MKFS_OPTIONS.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
common/xfs
tests/xfs/030
tests/xfs/033
tests/xfs/178

index 02f569c971a194f35cc108fd5cf273b9cc7207cf..85cd9a1348e385921ca9eae0611e59b1a888844f 100644 (file)
@@ -1902,3 +1902,28 @@ _scratch_xfs_find_metafile()
        echo "inode $sb_field"
        return 0
 }
+
+# Force metadata directories off.
+_scratch_xfs_force_no_metadir()
+{
+       # Remove any mkfs-time quota options because those are only supported
+       # with metadir=1
+       for opt in uquota gquota pquota; do
+               echo "$MKFS_OPTIONS" | grep -q -w "$opt" || continue
+
+               MKFS_OPTIONS="$(echo "$MKFS_OPTIONS" | sed -e "s/,$opt//g" -e "s/ $opt/ /g")"
+               MOUNT_OPTIONS="$MOUNT_OPTIONS -o $opt"
+       done
+
+       # Replace any explicit metadir option with metadir=0
+       if echo "$MKFS_OPTIONS" | grep -q 'metadir='; then
+               MKFS_OPTIONS="$(echo "$MKFS_OPTIONS" | sed -e 's/metadir=[0-9]*/metadir=0/g' -e 's/metadir\([, ]\)/metadir=0\1/g')"
+               return
+       fi
+
+       # Inject metadir=0 if there isn't one in MKFS_OPTIONS and mkfs supports
+       # that option.
+       if grep -q 'metadir=' $MKFS_XFS_PROG; then
+               MKFS_OPTIONS="-m metadir=0 $MKFS_OPTIONS"
+       fi
+}
index 7ce5ffce38693caa5c64a69e424adc4b36d92045..22fbdb2fdbc999e25296d37b20b25187cec660de 100755 (executable)
@@ -48,6 +48,7 @@ _check_ag()
 
 _require_scratch
 _require_no_large_scratch_dev
+_scratch_xfs_force_no_metadir
 
 DSIZE="-dsize=100m,agcount=6"
 
index d7b02a9c51b3f0b7cb162dc0739163441fdf1132..e0b0dd58212d61571db5c1ea18410a37f27d1345 100755 (executable)
@@ -51,6 +51,7 @@ _filter_bad_ids()
 
 _require_scratch
 _require_no_large_scratch_dev
+_scratch_xfs_force_no_metadir
 
 # devzero blows away 512byte blocks, so make 512byte inodes (at least)
 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
index a22e626706ec49e585d05ada770f5a99b2606253..0cc0e3f5bb88b4e1505fcd8751b2078a5319e7ea 100755 (executable)
@@ -50,6 +50,7 @@ _dd_repair_check()
 #             fix filesystem, new mkfs.xfs will be fine.
 
 _require_scratch
+_scratch_xfs_force_no_metadir
 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
 
 # By executing the followint tmp file, will get on the mkfs options stored in