linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH v2 6/7] xfs: refactor inode chunk alloc/free tx reservation
Date: Mon, 4 Dec 2017 07:17:11 -0500	[thread overview]
Message-ID: <20171204121711.GA35976@bfoster.bfoster> (raw)
In-Reply-To: <20171203215204.GU5858@dastard>

On Mon, Dec 04, 2017 at 08:52:04AM +1100, Dave Chinner wrote:
> On Thu, Nov 30, 2017 at 01:58:35PM -0500, Brian Foster wrote:
> > The reservation for the various forms of inode allocation is
> > scattered across several different functions. This includes two
> > variants of chunk allocation (v5 icreate transactions vs. older
> > create transactions) and the inode free transaction.
> > 
> > To clean up some of this code and clarify the purpose of specific
> > allocfree reservations, continue the pattern of defining helper
> > functions for smaller operational units of broader transactions.
> > Refactor the reservation into an inode chunk alloc/free helper that
> > considers the various conditions based on filesystem format.
> > 
> > An inode chunk free involves an extent free and buffer
> > invalidations. The latter requires reservation for log headers only.
> > An inode chunk allocation modifies the free space btrees and logs
> > the chunk on v4 supers. v5 supers initialize the inode chunk using
> > ordered buffers and so do not log the chunk.
> > 
> > As a side effect of this refactoring, add one more allocfree res to
> > the ifree transaction. Technically this does not serve a specific
> > purpose because inode chunks are freed via deferred operations and
> > thus occur after a transaction roll. tr_ifree has a bit of a history
> > of tx overruns caused by too many agfl fixups during sustained file
> > deletion workloads, so add this extra reservation as a form of
> > padding nonetheless.
> > 
> > Signed-off-by: Brian Foster <bfoster@redhat.com>
> 
> Minor quibble below, otherwise looks fine.
> 
> Reviewed-by: Dave Chinner <dchinner@redhat.com>
> 
> > ---
> >  fs/xfs/libxfs/xfs_trans_resv.c | 67 ++++++++++++++++++++++++++++++++----------
> >  1 file changed, 52 insertions(+), 15 deletions(-)
> > 
> > diff --git a/fs/xfs/libxfs/xfs_trans_resv.c b/fs/xfs/libxfs/xfs_trans_resv.c
> > index 19f3a226a357..432dd7d7afea 100644
> > --- a/fs/xfs/libxfs/xfs_trans_resv.c
> > +++ b/fs/xfs/libxfs/xfs_trans_resv.c
> > @@ -34,6 +34,9 @@
> >  #include "xfs_trans_space.h"
> >  #include "xfs_trace.h"
> >  
> > +#define _ALLOC	true
> > +#define _FREE	false
> > +
> >  /*
> >   * A buffer has a format structure overhead in the log in addition
> >   * to the data, so we need to take this into account when reserving
> 
> These are defined at the top of the file so most functions see
> them (i.e. scope is the file wide)....
> 
> > @@ -795,6 +829,9 @@ xfs_calc_sb_reservation(
> >  	return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
> >  }
> >  
> > +#undef _ALLOC
> > +#undef _FREE
> > +
> >  void
> >  xfs_trans_resv_calc(
> >  	struct xfs_mount	*mp,
> 
> ... so why bother undef'ing them seemingly at random in the middle of
> the file? Doesn't seem necessary, and will just be more code to
> move around in future...
> 

The intent was to limit them to the reservation calculation functions,
just for clarity I suppose. It just happens to encompass most of the
file and start at the top (just about everything within the ifdef/undef
is local scope). I'm fine with it either way, however. I'll post a v3
without the undefs.. thanks for the review!

Brian

> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-12-04 12:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-30 18:58 [PATCH v2 0/7] xfs: inode transaction reservation fixups Brian Foster
2017-11-30 18:58 ` [PATCH v2 1/7] xfs: print transaction log reservation on overrun Brian Foster
2017-12-07 21:34   ` Darrick J. Wong
2017-11-30 18:58 ` [PATCH v2 2/7] xfs: include inobt buffers in ifree tx log reservation Brian Foster
2017-12-03 21:44   ` Dave Chinner
2017-12-07 21:40   ` Darrick J. Wong
2017-11-30 18:58 ` [PATCH v2 3/7] xfs: fix up agi unlinked list reservations Brian Foster
2017-12-03 21:45   ` Dave Chinner
2017-12-07 21:41   ` Darrick J. Wong
2017-11-30 18:58 ` [PATCH v2 4/7] xfs: truncate transaction does not modify the inobt Brian Foster
2017-12-03 21:46   ` Dave Chinner
2017-12-07 21:44   ` Darrick J. Wong
2017-11-30 18:58 ` [PATCH v2 5/7] xfs: include an allocfree res for inobt modifications Brian Foster
2017-12-07 21:47   ` Darrick J. Wong
2017-11-30 18:58 ` [PATCH v2 6/7] xfs: refactor inode chunk alloc/free tx reservation Brian Foster
2017-12-03 21:52   ` Dave Chinner
2017-12-04 12:17     ` Brian Foster [this message]
2017-12-04 12:21   ` [PATCH v3 " Brian Foster
2017-12-07 21:53     ` Darrick J. Wong
2017-11-30 18:58 ` [PATCH v2 7/7] xfs: eliminate duplicate icreate tx reservation functions Brian Foster
2017-12-03 21:54   ` Dave Chinner
2017-12-07 21:57   ` Darrick J. Wong
2018-01-08 14:08 ` [PATCH v2 0/7] xfs: inode transaction reservation fixups Brian Foster
2018-01-08 18:06   ` Darrick J. Wong

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=20171204121711.GA35976@bfoster.bfoster \
    --to=bfoster@redhat.com \
    --cc=david@fromorbit.com \
    --cc=linux-xfs@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).