]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xfs: check that the rtrefcount maxlevels doesn't increase when growing fs
authorDarrick J. Wong <djwong@kernel.org>
Thu, 21 Nov 2024 00:21:04 +0000 (16:21 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 23 Dec 2024 21:06:14 +0000 (13:06 -0800)
The size of filesystem transaction reservations depends on the maximum
height (maxlevels) of the realtime btrees.  Since we don't want a grow
operation to increase the reservation size enough that we'll fail the
minimum log size checks on the next mount, constrain growfs operations
if they would cause an increase in the rt refcount btree maxlevels.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_fsops.c
fs/xfs/xfs_rtalloc.c

index 9df5a09c0acd3b3c7d4966869a7d660b67aa6f5e..455298503d010209a7cdfbff8f0af81309c66a4c 100644 (file)
@@ -23,6 +23,7 @@
 #include "xfs_trace.h"
 #include "xfs_rtalloc.h"
 #include "xfs_rtrmap_btree.h"
+#include "xfs_rtrefcount_btree.h"
 
 /*
  * Write new AG headers to disk. Non-transactional, but need to be
@@ -231,6 +232,7 @@ xfs_growfs_data_private(
 
                /* Compute new maxlevels for rt btrees. */
                xfs_rtrmapbt_compute_maxlevels(mp);
+               xfs_rtrefcountbt_compute_maxlevels(mp);
        }
 
        return error;
index f5a3d5f8c948d8d376564a5dbd96083b3866b4bd..a5de5405800a222e85e145e4d7d23b127b43fd4d 100644 (file)
@@ -995,6 +995,7 @@ xfs_growfs_rt_bmblock(
         */
        mp->m_features |= XFS_FEAT_REALTIME;
        xfs_rtrmapbt_compute_maxlevels(mp);
+       xfs_rtrefcountbt_compute_maxlevels(mp);
 
        kfree(nmp);
        return 0;
@@ -1178,6 +1179,7 @@ xfs_growfs_check_rtgeom(
        nmp->m_sb.sb_dblocks = dblocks;
 
        xfs_rtrmapbt_compute_maxlevels(nmp);
+       xfs_rtrefcountbt_compute_maxlevels(nmp);
        xfs_trans_resv_calc(nmp, M_RES(nmp));
 
        /*