Re: [PATCH 6/8] xfs: don't chain ioends during writepage submission

Dave Chinner
2016-02-11T06:39:34Z

On Wed, Feb 10, 2016 at 03:36:09AM -0800, Christoph Hellwig wrote:
> > + LIST_HEAD(submit_list);
> > + struct xfs_ioend *ioend, *next;
> > struct buffer_head *bh, *head;
> > ssize_t len = 1 << inode->i_blkbits;
> > int error = 0;
> > int uptodate = 1;
> > int count = 0;
>
> The count variable is pointless now - we only check for it being
> non-zero, and we can do the same with a list_emptry on submit_list.

Actually, it's not pointless - we need it to determine what to
with the page. We have to start writeback on the page if there were
no errors, but the number of buffers we added to the ioend
determines if we need to end page writeback immediately (i.e. no
buffers added). This is spearate to whether we allocated a new ioend
on the page and hence have an ioend to submit on the submit_list.

That said, looking at this did point out a bug in this
version of the patch - if no buffers were added to the ioends, then
we didn't clear the dirty bit on the page and transition through the
writeback state, as the original code was doing. I did trip over
this in a test run, so it's a real problem that needed to be fixed.

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com