reflink log reservations
Darrick J. Wong
darrick.wong at oracle.com
Thu Feb 4 12:05:51 CST 2016
On Thu, Feb 04, 2016 at 02:31:33PM +0100, Christoph Hellwig wrote:
> On Thu, Feb 04, 2016 at 12:16:20AM -0800, Darrick J. Wong wrote:
> > On Thu, Feb 04, 2016 at 08:46:17AM +0100, Christoph Hellwig wrote:
> > > Hi Darrick,
> > >
> > > I'm running into the following log reservation assert after a few
> > > xfstests runs over NFS. I'll try to understand the reservation
> > > calculations, but in case this is still fresh in your head here's
> > > a headsup:
> >
> > Hmm, interesting, I haven't seen /that/ one... my guess is that the
> > block reservation needs to be bumped up for the refcount tree.
>
> This seems to fix it for me:
>
> ---
> From 6e27eb42ece3a25f610690487b403a0091cafa26 Mon Sep 17 00:00:00 2001
> From: Christoph Hellwig <hch at lst.de>
> Date: Thu, 4 Feb 2016 13:50:16 +0100
> Subject: xfs: account for the refcount btree in the alloc/free log reservation
>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
> fs/xfs/libxfs/xfs_trans_resv.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_trans_resv.c b/fs/xfs/libxfs/xfs_trans_resv.c
> index d495f82..f4c2648 100644
> --- a/fs/xfs/libxfs/xfs_trans_resv.c
> +++ b/fs/xfs/libxfs/xfs_trans_resv.c
> @@ -65,12 +65,15 @@ xfs_calc_buf_res(
>
> /*
> * Per-extent log reservation for the allocation btree changes
> - * involved in freeing or allocating an extent. When rmap is not enabled,
> - * there are only two trees that will be modified (free space trees), and when
> - * rmap is enabled there will be three (freespace + rmap trees). The number of
> - * blocks reserved is based on the formula:
> + * involved in freeing or allocating an extent.
> *
> - * num trees * ((2 blocks/level * max depth) - 1)
> + * There are at least two trees that will be modified (free space trees), when
> + * rmap is enabled there will be an additional rmap tree, and when reflinks
> + * are enabled there will be a refcount btree as well
> + *
> + * The number of blocks reserved is based on the formula:
> + *
> + * num trees * ((2 blocks/level * max depth) - 1)
Huh, could've sworn I used to have a patch that does this... but I can't find
it, so it clearly fell out. Thanks for the patch.
--D
> */
> static uint
> xfs_allocfree_log_count(
> @@ -81,6 +84,8 @@ xfs_allocfree_log_count(
>
> if (xfs_sb_version_hasrmapbt(&mp->m_sb))
> num_trees++;
> + if (xfs_sb_version_hasreflink(&mp->m_sb))
> + num_trees++;
>
> return num_ops * num_trees * (2 * mp->m_ag_maxlevels - 1);
> }
> --
> 2.1.4
>
More information about the xfs
mailing list