From: Darrick J. Wong Date: Tue, 25 Oct 2016 00:49:22 +0000 (+1100) Subject: xfs: refcount btree add more reserved blocks X-Git-Tag: v4.9.0-rc1~110 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2a96beb95cb6fbb9c073a8371e29c1a2103a22b2;p=thirdparty%2Fxfsprogs-dev.git xfs: refcount btree add more reserved blocks Source kernel commit: af30dfa14411e9df0e69c6e46e8c6c467b88229d 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 Reviewed-by: Christoph Hellwig --- diff --git a/libxfs/xfs_alloc.c b/libxfs/xfs_alloc.c index 5f46460e5..ee72d137f 100644 --- a/libxfs/xfs_alloc.c +++ b/libxfs/xfs_alloc.c @@ -48,10 +48,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/libxfs/xfs_format.h b/libxfs/xfs_format.h index 04af78129..8910602d2 100644 --- a/libxfs/xfs_format.h +++ b/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