diff options
author | 2025-01-17 06:55:08 +0100 | |
---|---|---|
committer | 2025-03-03 08:16:43 -0700 | |
commit | 272e20bb24dc895375ccc18a82596a7259b5a652 (patch) | |
tree | 04477d21d4398d375f4c2b72838e2f9b6c7b0c6a | |
parent | xfs: make metabtree reservations global (diff) | |
download | wireguard-linux-272e20bb24dc895375ccc18a82596a7259b5a652.tar.xz wireguard-linux-272e20bb24dc895375ccc18a82596a7259b5a652.zip |
xfs: reduce metafile reservations
There is no point in reserving more space than actually available
on the data device for the worst case scenario that is unlikely to
happen. Reserve at most 1/4th of the data device blocks, which is
still a heuristic.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
-rw-r--r-- | fs/xfs/libxfs/xfs_metafile.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_metafile.c b/fs/xfs/libxfs/xfs_metafile.c index 88f011750add..225923e463c4 100644 --- a/fs/xfs/libxfs/xfs_metafile.c +++ b/fs/xfs/libxfs/xfs_metafile.c @@ -260,6 +260,7 @@ xfs_metafile_resv_init( struct xfs_rtgroup *rtg = NULL; xfs_filblks_t used = 0, target = 0; xfs_filblks_t hidden_space; + xfs_rfsblock_t dblocks_avail = mp->m_sb.sb_dblocks / 4; int error = 0; if (!xfs_has_metadir(mp)) @@ -297,6 +298,8 @@ xfs_metafile_resv_init( */ if (used > target) target = used; + else if (target > dblocks_avail) + target = dblocks_avail; hidden_space = target - used; error = xfs_dec_fdblocks(mp, hidden_space, true); |