diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2016-10-03 09:11:17 -0700 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2016-10-03 09:11:17 -0700 |
commit | af30dfa14411e9df0e69c6e46e8c6c467b88229d (patch) | |
tree | 00546ac7b561cc1d5bfc2e8c1a002fcf7663a2b8 | |
parent | 46eeb521b95247170d2db773bb4cc8fb3de1d85c (diff) | |
download | linux-stable-af30dfa14411e9df0e69c6e46e8c6c467b88229d.tar.gz linux-stable-af30dfa14411e9df0e69c6e46e8c6c467b88229d.tar.bz2 linux-stable-af30dfa14411e9df0e69c6e46e8c6c467b88229d.zip |
xfs: refcount btree add more reserved blocks
Since XFS reserves a small amount of space in each AG as the minimum
free space needed for an operation, save some more space in case we
touch the refcount btree.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | fs/xfs/libxfs/xfs_alloc.c | 13 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_format.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c index 275d3459e9e8..aa0e1ca7b6a5 100644 --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c @@ -52,10 +52,23 @@ STATIC int xfs_alloc_ag_vextent_size(xfs_alloc_arg_t *); STATIC int xfs_alloc_ag_vextent_small(xfs_alloc_arg_t *, xfs_btree_cur_t *, xfs_agblock_t *, xfs_extlen_t *, int *); +unsigned int +xfs_refc_block( + struct xfs_mount *mp) +{ + if (xfs_sb_version_hasrmapbt(&mp->m_sb)) + return XFS_RMAP_BLOCK(mp) + 1; + if (xfs_sb_version_hasfinobt(&mp->m_sb)) + return XFS_FIBT_BLOCK(mp) + 1; + return XFS_IBT_BLOCK(mp) + 1; +} + xfs_extlen_t xfs_prealloc_blocks( struct xfs_mount *mp) { + if (xfs_sb_version_hasreflink(&mp->m_sb)) + return xfs_refc_block(mp) + 1; if (xfs_sb_version_hasrmapbt(&mp->m_sb)) return XFS_RMAP_BLOCK(mp) + 1; if (xfs_sb_version_hasfinobt(&mp->m_sb)) diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h index 57c52a6c7bb8..622055bb283b 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h @@ -1455,6 +1455,8 @@ typedef __be32 xfs_rmap_ptr_t; */ #define XFS_REFC_CRC_MAGIC 0x52334643 /* 'R3FC' */ +unsigned int xfs_refc_block(struct xfs_mount *mp); + /* * BMAP Btree format definitions |