public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: Dave Chinner <david@fromorbit.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Jan Kara <jack@suse.cz>, Christoph Hellwig <hch@infradead.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 14/18] writeback: make writeback_control.nr_to_write straight
Date: Fri, 20 May 2011 15:26:22 +0800	[thread overview]
Message-ID: <20110520072622.GA14117@localhost> (raw)
In-Reply-To: <20110520071518.GA10953@localhost>

On Fri, May 20, 2011 at 03:15:18PM +0800, Wu Fengguang wrote:
> On Fri, May 20, 2011 at 02:52:07PM +0800, Dave Chinner wrote:
> > On Fri, May 20, 2011 at 12:07:40PM +0800, Wu Fengguang wrote:
> > > On Fri, May 20, 2011 at 07:29:10AM +0800, Dave Chinner wrote:
> > > > On Fri, May 20, 2011 at 06:06:44AM +0800, Wu Fengguang wrote:
> > > > > :                 writeback_single_inode(inode, wb, &wbc);
> > > > > :                 work->nr_pages -= write_chunk - wbc.nr_to_write;
> > > > > :                 wrote += write_chunk - wbc.nr_to_write;
> > > > > :                 if (wbc.pages_skipped) {
> > > > > :                         /*
> > > > > :                          * writeback is not making progress due to locked
> > > > > :                          * buffers.  Skip this inode for now.
> > > > > :                          */
> > > > > :                         redirty_tail(inode, wb);
> > > > > : -               }
> > > > > : +               } else if (!(inode->i_state & I_DIRTY))
> > > > > : +                       wrote++;
> > > > > 
> > > > > It looks a bit more clean to do
> > > > > 
> > > > > :                 wrote += write_chunk - wbc.nr_to_write;
> > > > > : +               if (!(inode->i_state & I_DIRTY))
> > > > > : +                       wrote++;
> > > > > :                 if (wbc.pages_skipped) {
> > > > > :                         /*
> > > > > :                          * writeback is not making progress due to locked
> > > > > :                          * buffers.  Skip this inode for now.
> > > > > :                          */
> > > > > :                         redirty_tail(inode, wb);
> > > > > :                 }
> > > > 
> > > > But it's still in the wrong place - such post-write inode dirty
> > > > processing is supposed to be isolated to writeback_single_inode().
> > > > Spreading it across multiple locations is not, IMO, the nicest thing
> > > > to do...
> > > 
> > > Strictly speaking, it's post inspecting :)
> > > 
> > > It does look reasonable and safe to move the pages_skipped post
> > > processing into writeback_single_inode(). See the below patch.
> > 
> > <sigh>
> > 
> > That's not what I was referring to. The wbc.pages_skipped check is
> > fine where it is.
> > 
> > > 
> > > When doing this chunk,
> > > 
> > > -			if (wbc->nr_to_write <= 0) {
> > > +			if (wbc->nr_to_write <= 0 && wbc->pages_skipped == 0) {
> > > 
> > > I wonder in general sense (without knowing enough FS internals)
> > > whether ->pages_skipped is that useful: if some locked buffer is
> > > blocking all subsequent pages, then ->nr_to_write won't be able to
> > > drop to zero.  So the (wbc->pages_skipped == 0) test seems redundant..
> > > 
> > > Thanks,
> > > Fengguang
> > > ---
> > > Subject: writeback: move pages_skipped post processing into writeback_single_inode()
> > > Date: Fri May 20 11:42:42 CST 2011
> > > 
> > > It's more logical to isolate post-write processings in writeback_single_inode().
> > > 
> > > Note that it slightly changes behavior for write_inode_now() and sync_inode(),
> > > which used to ignore pages_skipped.
> > > 
> > > Proposed-by: Dave Chinner <david@fromorbit.com>
> > 
> > No, I didn't propose the change you've made in this patch. I've been
> > asking you to fix the original patch, not proposing new changes to
> > some other code.  Please don't add my name to random tags in patches
> > without asking me first.
> 
> OK, sorry, I'll keep that in mind in future.
> 
> > So, for the third time, please fix the original patch by moving the
> > new "inode now clean" accounting to the "inode-now-clean" logic
> > branch in writeback_single_inode().
> > 
> >         if (!(inode->i_state & I_FREEING)) {
> >                 if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) {
> > .....
> >                 } else if (inode->i_state & I_DIRTY) {
> > .....
> >                 } else {
> > 			/*
> > 			 * account for it here with all the other
> > 			 * inode-now-clean manipulations that we need
> > 			 * to do!
> > 			 */
> 
> That's what the original "writeback: introduce
> writeback_control.inodes_cleaned" does. Given that it's opposed to add
> writeback_control.inodes_cleaned, the only option remained is to add
> one more argument "long *inode_cleaned" to writeback_single_inode()
> like this.
> 
> Well it looks ugly and I wonder if you have any prettier version in
> mind. This ugliness is the main reason I resist to do the change.

The other option is to make use of a *bit* field wbc->inode_cleaned.
It still adds one more writeback_control field *logically* and several
new lines of code, but kills a bit stack overheads.

Thanks,
Fengguang

  reply	other threads:[~2011-05-20  7:26 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-19 21:45 [PATCH 00/18] writeback fixes and cleanups for 2.6.40 (v3) Wu Fengguang
2011-05-19 21:45 ` [PATCH 01/18] writeback: introduce .tagged_writepages for the WB_SYNC_NONE sync stage Wu Fengguang
2011-05-19 21:45 ` [PATCH 02/18] writeback: update dirtied_when for synced inode to prevent livelock Wu Fengguang
2011-05-19 21:45 ` [PATCH 03/18] writeback: introduce writeback_control.inodes_cleaned Wu Fengguang
2011-05-19 21:45 ` [PATCH 04/18] writeback: try more writeback as long as something was written Wu Fengguang
2011-05-19 21:45 ` [PATCH 05/18] writeback: the kupdate expire timestamp should be a moving target Wu Fengguang
2011-05-19 21:45 ` [PATCH 06/18] writeback: sync expired inodes first in background writeback Wu Fengguang
2011-05-19 21:45 ` [PATCH 07/18] writeback: refill b_io iff empty Wu Fengguang
2011-05-19 21:45 ` [PATCH 08/18] writeback: split inode_wb_list_lock into bdi_writeback.list_lock Wu Fengguang
2011-05-19 21:45 ` [PATCH 09/18] writeback: elevate queue_io() into wb_writeback() Wu Fengguang
2011-05-19 21:45 ` [PATCH 10/18] writeback: avoid extra sync work at enqueue time Wu Fengguang
2011-05-19 21:45 ` [PATCH 11/18] writeback: add bdi_dirty_limit() kernel-doc Wu Fengguang
2011-05-19 21:45 ` [PATCH 12/18] writeback: skip balance_dirty_pages() for in-memory fs Wu Fengguang
2011-05-19 21:45 ` [PATCH 13/18] writeback: remove writeback_control.more_io Wu Fengguang
2011-05-19 21:45 ` [PATCH 14/18] writeback: make writeback_control.nr_to_write straight Wu Fengguang
2011-05-19 22:06   ` Wu Fengguang
2011-05-19 23:29     ` Dave Chinner
2011-05-20  4:07       ` Wu Fengguang
2011-05-20  6:52         ` Dave Chinner
2011-05-20  7:15           ` Wu Fengguang
2011-05-20  7:26             ` Wu Fengguang [this message]
2011-05-19 21:45 ` [PATCH 15/18] writeback: remove .nonblocking and .encountered_congestion Wu Fengguang
2011-05-19 21:45 ` [PATCH 16/18] writeback: trace event writeback_single_inode Wu Fengguang
2011-05-19 21:45 ` [PATCH 17/18] writeback: trace event writeback_queue_io Wu Fengguang
2011-05-19 21:45 ` [PATCH 18/18] writeback: rearrange the wb_writeback() loop Wu Fengguang
2011-05-23  9:07 ` [PATCH 00/18] writeback fixes and cleanups for 2.6.40 (v3) Christoph Hellwig
2011-05-23  9:28   ` Wu Fengguang
2011-05-24  3:28     ` Wu Fengguang
2011-06-01 22:31       ` Andrew Morton
2011-06-02  2:29         ` Wu Fengguang
2011-06-07 12:13           ` writeback merge status, was " Christoph Hellwig
2011-06-07 20:15             ` Andrew Morton
2011-06-07 21:11               ` Wu Fengguang

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=20110520072622.GA14117@localhost \
    --to=fengguang.wu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@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