]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
common/populate: correct the parent pointer name creation formulae
authorDarrick J. Wong <djwong@kernel.org>
Mon, 3 Feb 2025 22:00:27 +0000 (14:00 -0800)
committerZorro Lang <zlang@kernel.org>
Tue, 18 Feb 2025 04:42:39 +0000 (12:42 +0800)
The formulae used to compute the number of parent pointers that we have
to create in a child file in order to generate a particular xattr
structure are not even close to correct -- the first one needs a bit of
adjustment, but the second one is way off and creates far too many
files.

Fix the computation, and document where the magic numbers come from.

Cc: <fstests@vger.kernel.org> # v2024.06.27
Fixes: 0c02207d61af9a ("populate: create hardlinks for parent pointers")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/populate

index 4cf9c0691956a3de12700164e9fad1e43c73885c..c907e04efd0ea9d2538285f361709e0fb01d1be0 100644 (file)
@@ -473,13 +473,18 @@ _scratch_xfs_populate() {
                __populate_create_dir "${SCRATCH_MNT}/PPTRS" 1 '' \
                        --hardlink --format "two_%d"
 
-               # Create one xattr leaf block of parent pointers
-               nr="$((blksz * 2 / 16))"
+               # Create one xattr leaf block of parent pointers.  The name is
+               # 8 bytes and, the handle is 12 bytes, which rounds up to 24
+               # bytes per record, plus xattr structure overhead.
+               nr="$((blksz / 24))"
                __populate_create_dir "${SCRATCH_MNT}/PPTRS" ${nr} '' \
                        --hardlink --format "many%04d"
 
-               # Create multiple xattr leaf blocks of large parent pointers
-               nr="$((blksz * 16 / 16))"
+               # Create multiple xattr leaf blocks of large parent pointers.
+               # The name is 256 bytes and the handle is 12 bytes, which
+               # rounds up to 272 bytes per record, plus xattr structure
+               # overhead.
+               nr="$((blksz * 2 / 272))"
                __populate_create_dir "${SCRATCH_MNT}/PPTRS" ${nr} '' \
                        --hardlink --format "y%0254d"