diff options
author | Darrick J. Wong <djwong@kernel.org> | 2021-09-01 11:15:56 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2021-12-15 17:29:11 -0800 |
commit | cf2256c853689eff006fcaaf8100c2d2052671d4 (patch) | |
tree | 3dc848f07d254993fc19aa979a6ed9a796ee8105 /fs/xfs/xfs_fsops.c | |
parent | 80e8ea43e8818125fdeb254f1f89f6482b1f33bb (diff) |
xfs: allow inode-based btrees to reserve space in the data devicereserve-rt-metadata-space_2021-12-15
Create a new space reservation scheme so that btree metadata for the
realtime volume can reserve space in the data device to avoid space
underruns.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/xfs_fsops.c')
-rw-r--r-- | fs/xfs/xfs_fsops.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index 126f3474c1f6..e528a0cd845f 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c @@ -20,6 +20,7 @@ #include "xfs_ag.h" #include "xfs_ag_resv.h" #include "xfs_trace.h" +#include "xfs_rtalloc.h" /* * Write new AG headers to disk. Non-transactional, but need to be @@ -580,6 +581,20 @@ xfs_fs_reserve_ag_blocks( xfs_warn(mp, "Error %d reserving per-AG metadata reserve pool.", error); xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); + return error; + } + + if (xfs_has_realtime(mp)) { + int err2 = xfs_rt_resv_init(mp); + + if (err2 && err2 != -ENOSPC) { + xfs_warn(mp, + "Error %d reserving realtime metadata reserve pool.", err2); + xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); + } + + if (err2 && !error) + error = err2; } return error; @@ -595,6 +610,9 @@ xfs_fs_unreserve_ag_blocks( struct xfs_perag *pag; xfs_agnumber_t agno; + if (xfs_has_realtime(mp)) + xfs_rt_resv_free(mp); + for_each_perag(mp, agno, pag) xfs_ag_resv_free(pag); } |