]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
mkfs: set agblklog when we're verifying minimum log size
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 13 Jul 2017 16:51:25 +0000 (11:51 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 13 Jul 2017 16:51:25 +0000 (11:51 -0500)
In e5cc9d560a ("mkfs: set agsize prior to calculating minimum log
size"), we set the ag size in the superblock structure so that we can
calculate the maximum btree height correctly.  The btree heights are
used to calculate transaction reservation sizes; these sizes are used to
compute the minimum log length; and the minimum log length is checked by
the kernel.

Unfortunately, I didn't realize that some of the btree sizing functions
also depend on the agblklog (log2 of the ag size), so we've been
underestimating the minimum log length allowable, which results in mkfs
formatting filesystems that the kernel refuses to mount.

This can be trivially reproduced by formatting a small (~800M) volume
with rmap and reflink turned on.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
mkfs/maxtrres.c

index fba7818ab17095066c36ea3fd119399e7dcb374b..69ec67a92e3b8bbee16b83846659a317d8f0c65c 100644 (file)
@@ -54,6 +54,7 @@ max_trans_res(
        sbp->sb_blocklog = blocklog;
        sbp->sb_blocksize = 1 << blocklog;
        sbp->sb_agblocks = agsize;
+       sbp->sb_agblklog = (uint8_t)libxfs_log2_roundup((unsigned int)agsize);
        sbp->sb_inodelog = inodelog;
        sbp->sb_inopblog = blocklog - inodelog;
        sbp->sb_inodesize = 1 << inodelog;