]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: reduce metafile reservations
authorChristoph Hellwig <hch@lst.de>
Tue, 8 Apr 2025 07:06:53 +0000 (09:06 +0200)
committerChristoph Hellwig <hch@lst.de>
Mon, 14 Apr 2025 05:25:38 +0000 (07:25 +0200)
Source kernel commit: 272e20bb24dc895375ccc18a82596a7259b5a652

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>
Signed-off-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_metafile.c

index 1216a0e5169e6cb55b513d1ca0edf5d193cded16..6ded87d09ab755b692faf116e3bc5f01d1e3a64c 100644 (file)
@@ -258,6 +258,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))
@@ -295,6 +296,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);