summaryrefslogtreecommitdiff
path: root/fs/xfs
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-07-14 11:16:06 -0700
committerDarrick J. Wong <djwong@kernel.org>2022-11-09 19:08:11 -0800
commitbac8ea958c394ecf40a71edcf98c3b5dc79ba5f2 (patch)
tree1bc7224a107e7ae789ee9576f84d04c9333ee442 /fs/xfs
parent53302f4d249c3071ded3f05657254fa2ff2fea96 (diff)
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 <djwong@kernel.org>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_fsops.c2
-rw-r--r--fs/xfs/xfs_rtalloc.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index c4be738e2d8f..47495a3d5428 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -24,6 +24,7 @@
#include "xfs_rtgroup.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
@@ -225,6 +226,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 48c7cc28b7f2..7f1ee9432e71 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -1172,6 +1172,7 @@ xfs_growfs_check_rtgeom(
fake_mp->m_features |= XFS_FEAT_REALTIME;
xfs_rtrmapbt_compute_maxlevels(fake_mp);
+ xfs_rtrefcountbt_compute_maxlevels(fake_mp);
xfs_trans_resv_calc(fake_mp, M_RES(fake_mp));
min_logfsbs = xfs_log_calc_minimum_size(fake_mp);
@@ -1474,6 +1475,7 @@ error_cancel:
*/
mp->m_features |= XFS_FEAT_REALTIME;
xfs_rtrmapbt_compute_maxlevels(mp);
+ xfs_rtrefcountbt_compute_maxlevels(mp);
}
if (error)
goto out_free;