All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 5/5] xfs: don't chain ioends during writepage submission
Date: Wed, 10 Feb 2016 08:18:17 -0500	[thread overview]
Message-ID: <20160210131816.GB48974@bfoster.bfoster> (raw)
In-Reply-To: <20160209215900.GH14668@dastard>

On Wed, Feb 10, 2016 at 08:59:00AM +1100, Dave Chinner wrote:
> On Tue, Feb 09, 2016 at 09:23:55AM -0500, Brian Foster wrote:
> > On Mon, Feb 08, 2016 at 04:44:18PM +1100, Dave Chinner wrote:
> > > @@ -738,29 +726,22 @@ xfs_writepage_submit(
> > >  	struct writeback_control *wbc,
> > >  	int			status)
> > >  {
> > > -	struct blk_plug		plug;
> > > -
> > > -	/* Reserve log space if we might write beyond the on-disk inode size. */
> > > -	if (!status && wpc->ioend && wpc->ioend->io_type != XFS_IO_UNWRITTEN &&
> > > -	    xfs_ioend_is_append(wpc->ioend))
> > > -		status = xfs_setfilesize_trans_alloc(wpc->ioend);
> > > -
> > > -	if (wpc->iohead) {
> > > -		blk_start_plug(&plug);
> > > -		xfs_submit_ioend(wbc, wpc->iohead, status);
> > > -		blk_finish_plug(&plug);
> > > -	}
> > 
> > We've dropped our plug here but I don't see anything added in
> > xfs_vm_writepages(). Shouldn't we have one there now that ioends are
> > submitted as we go? generic_writepages() uses one around its
> > write_cache_pages() call..
> 
> It's not really necessary, as we now have higher level plugging in
> the writeback go will get flushed on context switch, and if we don't
> have a high level plug (e.g. fsync triggered writeback), then we
> submit the IO immediately, just like flushing the plug here would do
> anyway....
> 

Ok, I'm digging around the wb code a bit and I see plugs in/around
wb_writeback(), so I assume that's what you're referring to in the first
case. I'm not quite following the fsync case though...

In the current upstream code, fsync() leads to the following call chain:

  filemap_write_and_wait_range()
    __filemap_fdatawrite_range()
      do_writepages()
        xfs_vm_writepages()
          generic_writepages()
            blk_start_plug()
            write_cache_pages()
            blk_finish_plug()

After this series, we have the following:

  filemap_write_and_wait_range()
    __filemap_fdatawrite_range()
      do_writepages()
        xfs_vm_writepages() 
          write_cache_pages()

... with no plug that I can see. What am I missing?
      
...
> > > -	else {
> > > +		while (ioend_to_submit) {
> > > +			struct xfs_ioend *next = ioend_to_submit->io_list;
> > > +
> > > +			ioend_to_submit->io_list = NULL;
> > > +			xfs_submit_ioend(wbc, ioend_to_submit, 0);
> > > +			ioend_to_submit = next;
> > > +		}
> > > +	} else {
> > >  		xfs_aops_discard_page(page);
> > >  		ClearPageUptodate(page);
> > >  		unlock_page(page);
> > 
> > If we have an error and count == 0, we know that ioend_to_submit is NULL
> > because that is only potentially set once the first buffer is added.
> > That said, this doesn't mean that we don't have an ioend waiting on the
> > wpc. If we do, we still return the error and the ioend is errored out.
> > 
> > I wonder if that is really necessary if we haven't added any buffers
> > from the page..? Could we submit the ioend properly in that case? OTOH,
> > that might complicate the error reporting and an error here might be
> > serious enough that it isn't worth it, as opposed to just making sure we
> > clean up everything appropriately.
> 
> The way I've done it is the same as the existing code - on error the
> entire ioend chain that has been built is errored out. I'd prefer to
> keep it that way right now to minimise the potential behavioural
> changes of the patch series. We can look to changing to partial
> submission in a separate patch set if it makes sense to do so.
> 

I noticed that the existing code is roughly equivalent, so that's fair I
think. Thanks.

Brian

> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com

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

  reply	other threads:[~2016-02-10 13:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-08  5:44 [PATCH 0/5 v3] xfs: get rid of xfs_cluster_write() Dave Chinner
2016-02-08  5:44 ` [PATCH 1/5] xfs: remove nonblocking mode from xfs_vm_writepage Dave Chinner
2016-02-08  5:44 ` [PATCH 2/5] xfs: Introduce writeback context for writepages Dave Chinner
2016-02-09 13:39   ` Christoph Hellwig
2016-02-09 21:48     ` Dave Chinner
2016-02-09 23:16       ` Dave Chinner
2016-02-09 14:22   ` Brian Foster
2016-02-09 21:51     ` Dave Chinner
2016-02-08  5:44 ` [PATCH 3/5] xfs: xfs_cluster_write is redundant Dave Chinner
2016-02-09 13:40   ` Christoph Hellwig
2016-02-08  5:44 ` [PATCH 4/5] xfs: factor mapping out of xfs_do_writepage Dave Chinner
2016-02-09 13:40   ` Christoph Hellwig
2016-02-08  5:44 ` [PATCH 5/5] xfs: don't chain ioends during writepage submission Dave Chinner
2016-02-09 13:49   ` Christoph Hellwig
2016-02-09 21:52     ` Dave Chinner
2016-02-09 14:23   ` Brian Foster
2016-02-09 21:59     ` Dave Chinner
2016-02-10 13:18       ` Brian Foster [this message]
2016-02-10 21:09         ` Dave Chinner
2016-02-11 12:24           ` Brian Foster

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=20160210131816.GB48974@bfoster.bfoster \
    --to=bfoster@redhat.com \
    --cc=david@fromorbit.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.