public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>, xfs@oss.sgi.com
Subject: Re: reflink log reservations
Date: Thu, 4 Feb 2016 14:31:33 +0100	[thread overview]
Message-ID: <20160204133133.GA28701@lst.de> (raw)
In-Reply-To: <20160204081620.GL20038@birch.djwong.org>

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@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@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)
  */
 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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2016-02-04 13:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-04  7:46 reflink log reservations Christoph Hellwig
2016-02-04  8:16 ` Darrick J. Wong
2016-02-04 13:31   ` Christoph Hellwig [this message]
2016-02-04 18:05     ` Darrick J. Wong
2016-02-09 16:31       ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160204133133.GA28701@lst.de \
    --to=hch@lst.de \
    --cc=darrick.wong@oracle.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox