From: Darrick J. Wong Date: Fri, 9 Aug 2024 13:18:18 +0000 (+0200) Subject: xfs: check that the rtrefcount maxlevels doesn't increase when growing fs X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d0bbe10d58698fc4486bcdadb655cf79de37f53c;p=users%2Fhch%2Fxfs.git xfs: check that the rtrefcount maxlevels doesn't increase when growing fs 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 --- diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index f8505e1b2baf..42d03d91fbf1 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c @@ -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 @@ -235,6 +236,7 @@ xfs_growfs_data_private( /* Compute new maxlevels for rt btrees. */ xfs_rtrmapbt_compute_maxlevels(mp); + xfs_rtrefcountbt_compute_maxlevels(mp); } return error; diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index e2c793fb1974..8bcab5ed050c 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c @@ -911,6 +911,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; @@ -1118,6 +1119,7 @@ xfs_growfs_check_rtgeom( nmp->m_features |= XFS_FEAT_REALTIME; xfs_rtrmapbt_compute_maxlevels(nmp); + xfs_rtrefcountbt_compute_maxlevels(nmp); xfs_trans_resv_calc(nmp, M_RES(nmp)); /*