From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH v2 2/6] xfs: defer agfl block frees when dfops is available
Date: Wed, 9 May 2018 12:31:19 -0400 [thread overview]
Message-ID: <20180509163118.GB66101@bfoster.bfoster> (raw)
In-Reply-To: <20180509160418.GS11261@magnolia>
On Wed, May 09, 2018 at 09:04:18AM -0700, Darrick J. Wong wrote:
> On Wed, Apr 18, 2018 at 09:31:15AM -0400, Brian Foster wrote:
...
> >
> > Signed-off-by: Brian Foster <bfoster@redhat.com>
> > ---
> > fs/xfs/libxfs/xfs_alloc.c | 51 ++++++++++++++++++++++++++++++---
> > fs/xfs/libxfs/xfs_defer.h | 1 +
> > fs/xfs/xfs_trace.h | 2 ++
> > fs/xfs/xfs_trans.c | 11 ++++++--
> > fs/xfs/xfs_trans.h | 1 +
> > fs/xfs/xfs_trans_extfree.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++
> > 6 files changed, 129 insertions(+), 7 deletions(-)
> >
...
> > diff --git a/fs/xfs/xfs_trans_extfree.c b/fs/xfs/xfs_trans_extfree.c
> > index ab438647592a..f5620796ae25 100644
> > --- a/fs/xfs/xfs_trans_extfree.c
> > +++ b/fs/xfs/xfs_trans_extfree.c
> > @@ -231,9 +231,79 @@ static const struct xfs_defer_op_type xfs_extent_free_defer_type = {
> > .cancel_item = xfs_extent_free_cancel_item,
> > };
> >
> > +/*
> > + * AGFL blocks are accounted differently in the reserve pools and are not
> > + * inserted into the busy extent list.
> > + */
> > +STATIC int
> > +xfs_agfl_free_finish_item(
> > + struct xfs_trans *tp,
> > + struct xfs_defer_ops *dop,
> > + struct list_head *item,
> > + void *done_item,
> > + void **state)
> > +{
> > + struct xfs_mount *mp = tp->t_mountp;
> > + struct xfs_efd_log_item *efdp = done_item;
> > + struct xfs_extent_free_item *free;
> > + struct xfs_extent *extp;
> > + struct xfs_buf *agbp;
> > + int error;
> > + xfs_agnumber_t agno;
> > + xfs_agblock_t agbno;
> > + uint next_extent;
> > +
> > + free = container_of(item, struct xfs_extent_free_item, xefi_list);
> > + ASSERT(free->xefi_blockcount == 1);
> > + agno = XFS_FSB_TO_AGNO(mp, free->xefi_startblock);
> > + agbno = XFS_FSB_TO_AGBNO(mp, free->xefi_startblock);
> > +
> > + trace_xfs_agfl_free_deferred(mp, agno, 0, agbno, free->xefi_blockcount);
> > +
> > + error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp);
> > + if (!error)
> > + error = xfs_free_agfl_block(tp, agno, agbno, agbp,
> > + &free->xefi_oinfo);
> > +
> > + /*
> > + * Mark the transaction dirty, even on error. This ensures the
> > + * transaction is aborted, which:
> > + *
> > + * 1.) releases the EFI and frees the EFD
> > + * 2.) shuts down the filesystem
> > + */
> > + tp->t_flags |= XFS_TRANS_DIRTY;
> > + efdp->efd_item.li_desc->lid_flags |= XFS_LID_DIRTY;
>
> FWIW I think this becomes:
>
> set_bit(XFS_LI_DIRTY, &efdp->efd_item.li_flags);
>
> after Dave's series to remove log item descriptors, afaict.
> Will fix it up when I pull that into the branch.
>
Looks right, thanks!
Brian
> --D
>
> > +
> > + next_extent = efdp->efd_next_extent;
> > + ASSERT(next_extent < efdp->efd_format.efd_nextents);
> > + extp = &(efdp->efd_format.efd_extents[next_extent]);
> > + extp->ext_start = free->xefi_startblock;
> > + extp->ext_len = free->xefi_blockcount;
> > + efdp->efd_next_extent++;
> > +
> > + kmem_free(free);
> > + return error;
> > +}
> > +
> > +
> > +/* sub-type with special handling for AGFL deferred frees */
> > +static const struct xfs_defer_op_type xfs_agfl_free_defer_type = {
> > + .type = XFS_DEFER_OPS_TYPE_AGFL_FREE,
> > + .max_items = XFS_EFI_MAX_FAST_EXTENTS,
> > + .diff_items = xfs_extent_free_diff_items,
> > + .create_intent = xfs_extent_free_create_intent,
> > + .abort_intent = xfs_extent_free_abort_intent,
> > + .log_item = xfs_extent_free_log_item,
> > + .create_done = xfs_extent_free_create_done,
> > + .finish_item = xfs_agfl_free_finish_item,
> > + .cancel_item = xfs_extent_free_cancel_item,
> > +};
> > +
> > /* Register the deferred op type. */
> > void
> > xfs_extent_free_init_defer_op(void)
> > {
> > xfs_defer_init_op_type(&xfs_extent_free_defer_type);
> > + xfs_defer_init_op_type(&xfs_agfl_free_defer_type);
> > }
> > --
> > 2.13.6
> >
> > --
> > 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
> --
> 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
next prev parent reply other threads:[~2018-05-09 16:31 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-18 13:31 [PATCH v2 0/6] xfs: defer agfl block frees Brian Foster
2018-04-18 13:31 ` [PATCH v2 1/6] xfs: create agfl block free helper function Brian Foster
2018-05-08 0:35 ` Darrick J. Wong
2018-04-18 13:31 ` [PATCH v2 2/6] xfs: defer agfl block frees when dfops is available Brian Foster
2018-05-08 1:10 ` Darrick J. Wong
2018-05-08 12:31 ` Brian Foster
2018-05-08 18:04 ` Darrick J. Wong
2018-05-09 11:18 ` Brian Foster
2018-05-09 14:34 ` Darrick J. Wong
2018-05-09 15:41 ` Brian Foster
2018-05-09 15:56 ` Darrick J. Wong
2018-05-09 16:04 ` Darrick J. Wong
2018-05-09 16:31 ` Brian Foster [this message]
2018-04-18 13:31 ` [PATCH v2 3/6] xfs: defer agfl block frees from deferred ops processing context Brian Foster
2018-05-08 1:11 ` Darrick J. Wong
2018-04-18 13:31 ` [PATCH v2 4/6] xfs: defer agfl frees from inode inactivation Brian Foster
2018-04-18 13:31 ` [PATCH v2 5/6] xfs: defer frees from common inode allocation paths Brian Foster
2018-04-18 13:31 ` [PATCH v2 6/6] xfs: defer agfl frees from directory op transactions Brian Foster
2018-05-08 1:12 ` Darrick J. Wong
2018-05-08 12:33 ` Brian Foster
2018-05-08 14:53 ` 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=20180509163118.GB66101@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=darrick.wong@oracle.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).