From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Brian Foster <bfoster@redhat.com>
Cc: linux-xfs@vger.kernel.org, david@fromorbit.com, hch@lst.de
Subject: Re: [PATCH 5/5] xfs: xfs_defer_capture should absorb remaining transaction reservation
Date: Thu, 1 Oct 2020 10:52:57 -0700 [thread overview]
Message-ID: <20201001175257.GS49547@magnolia> (raw)
In-Reply-To: <20201001173256.GG112884@bfoster>
On Thu, Oct 01, 2020 at 01:32:56PM -0400, Brian Foster wrote:
> On Tue, Sep 29, 2020 at 10:43:44AM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > When xfs_defer_capture extracts the deferred ops and transaction state
> > from a transaction, it should record the transaction reservation type
> > from the old transaction so that when we continue the dfops chain, we
> > still use the same reservation parameters.
> >
> > Doing this means that the log item recovery functions get to determine
> > the transaction reservation instead of abusing tr_itruncate in yet
> > another part of xfs.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
>
> Much nicer, and FWIW this is pretty much the approach I was wondering
> about wrt to the block reservation in the previous patch..
>
> > fs/xfs/libxfs/xfs_defer.c | 9 +++++++++
> > fs/xfs/libxfs/xfs_defer.h | 1 +
> > fs/xfs/xfs_log_recover.c | 4 ++--
> > 3 files changed, 12 insertions(+), 2 deletions(-)
> >
> >
> > diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c
> > index 0cceebb390c4..4caaf5527403 100644
> > --- a/fs/xfs/libxfs/xfs_defer.c
> > +++ b/fs/xfs/libxfs/xfs_defer.c
> > @@ -579,6 +579,15 @@ xfs_defer_ops_capture(
> > dfc->dfc_blkres = tp->t_blk_res - tp->t_blk_res_used;
> > tp->t_blk_res = tp->t_blk_res_used;
> >
> > + /*
> > + * Preserve the transaction reservation type. The logcount is
> > + * hardwired to 1 to so that we can make forward progress in recovery
> > + * no matter how full the log might be, at a cost of more regrants.
> > + */
> > + dfc->dfc_tres.tr_logres = tp->t_log_res;
> > + dfc->dfc_tres.tr_logcount = 1;
> > + dfc->dfc_tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
>
> Any real need to allocate these last two fields in every captured chain
> when they're basically hardcoded? If not, it might be a bit more
> efficient to put an xfs_trans_res on the stack in
> xlog_finish_defer_ops() and just save the logres value here.
Ok, will do.
--D
>
> Brian
>
> > +
> > return dfc;
> > }
> >
> > diff --git a/fs/xfs/libxfs/xfs_defer.h b/fs/xfs/libxfs/xfs_defer.h
> > index b1c7b761afd5..c447c79bbe74 100644
> > --- a/fs/xfs/libxfs/xfs_defer.h
> > +++ b/fs/xfs/libxfs/xfs_defer.h
> > @@ -76,6 +76,7 @@ struct xfs_defer_capture {
> > struct list_head dfc_dfops;
> > unsigned int dfc_tpflags;
> > unsigned int dfc_blkres;
> > + struct xfs_trans_res dfc_tres;
> > };
> >
> > /*
> > diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> > index b06c9881a13d..46e750279634 100644
> > --- a/fs/xfs/xfs_log_recover.c
> > +++ b/fs/xfs/xfs_log_recover.c
> > @@ -2442,8 +2442,8 @@ xlog_finish_defer_ops(
> > int error = 0;
> >
> > list_for_each_entry_safe(dfc, next, capture_list, dfc_list) {
> > - error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0,
> > - 0, XFS_TRANS_RESERVE, &tp);
> > + error = xfs_trans_alloc(mp, &dfc->dfc_tres, 0, 0,
> > + XFS_TRANS_RESERVE, &tp);
> > if (error)
> > return error;
> >
> >
>
next prev parent reply other threads:[~2020-10-01 17:55 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-29 17:43 [PATCH v4 0/5] xfs: fix how we deal with new intents during recovery Darrick J. Wong
2020-09-29 17:43 ` [PATCH 1/5] xfs: remove xfs_defer_reset Darrick J. Wong
2020-10-01 17:30 ` Brian Foster
2020-09-29 17:43 ` [PATCH 2/5] xfs: remove XFS_LI_RECOVERED Darrick J. Wong
2020-10-01 17:30 ` Brian Foster
2020-10-02 7:16 ` Christoph Hellwig
2020-09-29 17:43 ` [PATCH 3/5] xfs: proper replay of deferred ops queued during log recovery Darrick J. Wong
2020-10-01 17:31 ` Brian Foster
2020-10-01 17:41 ` Darrick J. Wong
2020-10-02 7:18 ` Christoph Hellwig
2020-09-29 17:43 ` [PATCH 4/5] xfs: xfs_defer_capture should absorb remaining block reservation Darrick J. Wong
2020-10-01 17:32 ` Brian Foster
2020-10-01 17:46 ` Darrick J. Wong
2020-10-02 4:20 ` [PATCH v4.2 " Darrick J. Wong
2020-10-02 7:22 ` Christoph Hellwig
2020-10-02 10:39 ` Brian Foster
2020-09-29 17:43 ` [PATCH 5/5] xfs: xfs_defer_capture should absorb remaining transaction reservation Darrick J. Wong
2020-10-01 17:32 ` Brian Foster
2020-10-01 17:52 ` Darrick J. Wong [this message]
2020-10-02 4:21 ` [PATCH v4.2 " Darrick J. Wong
2020-10-02 7:24 ` Christoph Hellwig
2020-10-02 7:32 ` Christoph Hellwig
2020-10-02 10:39 ` Brian Foster
-- strict thread matches above, loose matches on Subject: below --
2020-10-05 18:19 [PATCH v5 0/5] xfs: fix how we deal with new intents during recovery Darrick J. Wong
2020-10-05 18:20 ` [PATCH 5/5] xfs: xfs_defer_capture should absorb remaining transaction reservation Darrick J. Wong
2020-10-06 6:22 ` 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=20201001175257.GS49547@magnolia \
--to=darrick.wong@oracle.com \
--cc=bfoster@redhat.com \
--cc=david@fromorbit.com \
--cc=hch@lst.de \
--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