From: Darrick J. Wong <djwong@xxxxxxxxxx> We've established in this patchset that the "alloc_set_aside" pool is actually used to ensure that a bmbt split always succeeds so that the filesystem won't run out of space mid-transaction and crash. Rename the variable and the function to be a little more suggestive of the purpose of this quantity. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx> --- fs/xfs/libxfs/xfs_alloc.c | 4 ++-- fs/xfs/libxfs/xfs_alloc.h | 2 +- fs/xfs/xfs_fsops.c | 2 +- fs/xfs/xfs_log_recover.c | 2 +- fs/xfs/xfs_mount.c | 2 +- fs/xfs/xfs_mount.h | 5 +++-- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c index 747b3e45303f..a4a6cca1ffd1 100644 --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c @@ -110,7 +110,7 @@ xfs_prealloc_blocks( * AGFL and enough to handle a potential split of a file's bmap btree. */ unsigned int -xfs_alloc_set_aside( +xfs_bmbt_split_setaside( struct xfs_mount *mp) { unsigned int bmbt_splits; @@ -127,7 +127,7 @@ xfs_alloc_set_aside( * - the AG superblock, AGF, AGI and AGFL * - the AGF (bno and cnt) and AGI btree root blocks, and optionally * the AGI free inode and rmap btree root blocks. - * - blocks on the AGFL according to xfs_alloc_set_aside() limits + * - blocks on the AGFL according to xfs_bmbt_split_setaside() limits * - the rmapbt root block * * The AG headers are sector sized, so the amount of space they take up is diff --git a/fs/xfs/libxfs/xfs_alloc.h b/fs/xfs/libxfs/xfs_alloc.h index d4c057b764f9..7d676c1c66bc 100644 --- a/fs/xfs/libxfs/xfs_alloc.h +++ b/fs/xfs/libxfs/xfs_alloc.h @@ -88,7 +88,7 @@ typedef struct xfs_alloc_arg { #define XFS_ALLOC_NOBUSY (1 << 2)/* Busy extents not allowed */ /* freespace limit calculations */ -unsigned int xfs_alloc_set_aside(struct xfs_mount *mp); +unsigned int xfs_bmbt_split_setaside(struct xfs_mount *mp); unsigned int xfs_alloc_ag_max_usable(struct xfs_mount *mp); xfs_extlen_t xfs_alloc_longest_free_extent(struct xfs_perag *pag, diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index 863e6389c6ff..b1840daf89c2 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c @@ -190,7 +190,7 @@ xfs_growfs_data_private( if (nagimax) mp->m_maxagi = nagimax; xfs_set_low_space_thresholds(mp); - mp->m_alloc_set_aside = xfs_alloc_set_aside(mp); + mp->m_bmbt_split_setaside = xfs_bmbt_split_setaside(mp); if (delta > 0) { /* diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 96c997ed2ec8..30e22cd943c2 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -3351,7 +3351,7 @@ xlog_do_recover( xfs_warn(mp, "Failed post-recovery per-ag init: %d", error); return error; } - mp->m_alloc_set_aside = xfs_alloc_set_aside(mp); + mp->m_bmbt_split_setaside = xfs_bmbt_split_setaside(mp); xlog_recover_check_summary(log); diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index c9fd5219d377..e9fb61b2290a 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -656,7 +656,7 @@ xfs_mountfs( * Compute the amount of space to set aside to handle btree splits near * ENOSPC now that we have calculated the btree maxlevels. */ - mp->m_alloc_set_aside = xfs_alloc_set_aside(mp); + mp->m_bmbt_split_setaside = xfs_bmbt_split_setaside(mp); mp->m_ag_max_usable = xfs_alloc_ag_max_usable(mp); /* diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index da1b7056e743..b948f4002e7f 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h @@ -134,7 +134,8 @@ typedef struct xfs_mount { uint m_refc_maxlevels; /* max refcount btree level */ unsigned int m_agbtree_maxlevels; /* max level of all AG btrees */ xfs_extlen_t m_ag_prealloc_blocks; /* reserved ag blocks */ - uint m_alloc_set_aside; /* space we can't use */ + /* space reserved to ensure bmbt splits always succeed */ + unsigned int m_bmbt_split_setaside; uint m_ag_max_usable; /* max space per AG */ int m_dalign; /* stripe unit */ int m_swidth; /* stripe width */ @@ -491,7 +492,7 @@ static inline uint64_t xfs_fdblocks_unavailable( struct xfs_mount *mp) { - return mp->m_alloc_set_aside + atomic64_read(&mp->m_allocbt_blks); + return mp->m_bmbt_split_setaside + atomic64_read(&mp->m_allocbt_blks); } extern int xfs_mod_fdblocks(struct xfs_mount *mp, int64_t delta,