aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_rtalloc.c
diff options
context:
space:
mode:
authorDarrick J. Wong <[email protected]>2024-11-21 00:20:28 +0000
committerDarrick J. Wong <[email protected]>2024-12-23 21:06:05 +0000
commit8491a55cfc73ff5c2c637a70ade51d4d08abb90a (patch)
tree9073d76fe8600954e51c6b6d44b1b5692738b3d2 /fs/xfs/xfs_rtalloc.c
parentxfs: add realtime reverse map inode to metadata directory (diff)
downloadkernel-8491a55cfc73ff5c2c637a70ade51d4d08abb90a.tar.gz
kernel-8491a55cfc73ff5c2c637a70ade51d4d08abb90a.zip
xfs: add metadata reservations for realtime rmap btrees
Reserve some free blocks so that we will always have enough free blocks in the data volume to handle expansion of the realtime rmap btree. Signed-off-by: "Darrick J. Wong" <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
Diffstat (limited to 'fs/xfs/xfs_rtalloc.c')
-rw-r--r--fs/xfs/xfs_rtalloc.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 4cd2f32aa70a..2245f9ecaa33 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -22,6 +22,7 @@
#include "xfs_rtalloc.h"
#include "xfs_sb.h"
#include "xfs_rtbitmap.h"
+#include "xfs_rtrmap_btree.h"
#include "xfs_quota.h"
#include "xfs_log_priv.h"
#include "xfs_health.h"
@@ -1498,6 +1499,13 @@ void
xfs_rt_resv_free(
struct xfs_mount *mp)
{
+ struct xfs_rtgroup *rtg = NULL;
+ unsigned int i;
+
+ while ((rtg = xfs_rtgroup_next(mp, rtg))) {
+ for (i = 0; i < XFS_RTGI_MAX; i++)
+ xfs_metafile_resv_free(rtg->rtg_inodes[i]);
+ }
}
/* Reserve space for rt metadata inodes' space expansion. */
@@ -1505,7 +1513,20 @@ int
xfs_rt_resv_init(
struct xfs_mount *mp)
{
- return 0;
+ struct xfs_rtgroup *rtg = NULL;
+ xfs_filblks_t ask;
+ int error = 0;
+
+ while ((rtg = xfs_rtgroup_next(mp, rtg))) {
+ int err2;
+
+ ask = xfs_rtrmapbt_calc_reserves(mp);
+ err2 = xfs_metafile_resv_init(rtg_rmap(rtg), ask);
+ if (err2 && !error)
+ error = err2;
+ }
+
+ return error;
}
/*