From: Dave Chinner <david@fromorbit.com>
To: Brian Foster <bfoster@redhat.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/4] mkfs: introduce new delayed write buffer list
Date: Fri, 7 Sep 2018 10:21:41 +1000 [thread overview]
Message-ID: <20180907002141.GJ27618@dastard> (raw)
In-Reply-To: <20180906133214.GC3311@bfoster>
On Thu, Sep 06, 2018 at 09:32:15AM -0400, Brian Foster wrote:
> On Wed, Sep 05, 2018 at 06:19:31PM +1000, Dave Chinner wrote:
> > diff --git a/libxfs/trans.c b/libxfs/trans.c
> > index 2bb0d3b8e2d1..c3da46479efa 100644
> > --- a/libxfs/trans.c
> > +++ b/libxfs/trans.c
> > @@ -728,10 +728,11 @@ inode_item_done(
> >
> > static void
> > buf_item_done(
> > - xfs_buf_log_item_t *bip)
> > + struct xfs_buf_log_item *bip,
> > + struct list_head *delwri_list)
> > {
> > - xfs_buf_t *bp;
> > - int hold;
> > + struct xfs_buf *bp;
> > + bool hold;
> > extern kmem_zone_t *xfs_buf_item_zone;
> >
> > bp = bip->bli_buf;
> > @@ -745,7 +746,13 @@ buf_item_done(
> > fprintf(stderr, "flushing/staling buffer %p (hold=%d)\n",
> > bp, hold);
> > #endif
> > - libxfs_writebuf_int(bp, 0);
> > + if (delwri_list) {
> > + /* delwri list needs to hold on to the buffer here */
> > + libxfs_buf_delwri_add(bp, 0, delwri_list);
> > + hold = true;
>
> This seems a bit flakey.
Yup, it's a nasty hack to avoid having to put proper reference
counting into the userspace xfs_bufs.
> IIUC, the hold is set here because the delwri
> queue either needs the reference until after I/O completion (or it
> dropped the callers reference already if the buffer were already present
> on the queue). If BLI_HOLD is set in this case, however, haven't we
> basically stolen the caller's reference?
Yes, that's precisely why it's a nasty hack.
> I'm guessing this probably doesn't ever happen in the limited scope of
> mkfs, so consider that an interface design nit for now.
Right, that's how I got away with it here. :P
> I suppose a more
> robust mechanism might more closely resemble the kernel approach where
> the delwri_queue() acquires its own reference on the buf (somehow or
> another as applied to the xfsprogs buffer management system, I don't
> have it all paged in atm).
The right approach is to port the kernel buffer cache implementation
to libxfs and implement bio_submit() and the bio completion
callbacks via an AIO engine. Then we can add an AIL and convert all
the open coded libxfs_write() calls in this mkfs code to transaction
joins as ordered buffers. That way we don't need the delwri list
hack into xfs_trans_commit() - we just push the AIL every so
often...
That's a lot more work than this proof of concept, though.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2018-09-07 5:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-05 8:19 [RFCRAP PATCH 0/4 v2] mkfs.xfs IO scalability Dave Chinner
2018-09-05 8:19 ` [PATCH 1/4] mkfs: stop zeroing old superblocks excessively Dave Chinner
2018-09-06 13:31 ` Brian Foster
2018-09-07 0:04 ` Dave Chinner
2018-09-07 11:05 ` Brian Foster
2018-09-05 8:19 ` [PATCH 2/4] mkfs: rework AG header initialisation ordering Dave Chinner
2018-09-06 13:31 ` Brian Foster
2018-09-07 0:08 ` Dave Chinner
2018-09-05 8:19 ` [PATCH 3/4] mkfs: introduce new delayed write buffer list Dave Chinner
2018-09-06 13:32 ` Brian Foster
2018-09-07 0:21 ` Dave Chinner [this message]
2018-09-05 8:19 ` [PATCH 4/4] mkfs: Use AIO for batched writeback Dave Chinner
2018-09-06 13:32 ` Brian Foster
2018-09-07 0:30 ` Dave Chinner
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=20180907002141.GJ27618@dastard \
--to=david@fromorbit.com \
--cc=bfoster@redhat.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).