All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fengguang Wu <wfg@mail.ustc.edu.cn>
To: Andrew Morton <akpm@osdl.org>
Cc: Peter Zijlstra <peterz@infradead.org>, Michael Rubin <mrubin@google.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 11/11] writeback: __sync_single_inode() code cleanup
Date: Fri, 28 Dec 2007 21:41:30 +0800	[thread overview]
Message-ID: <398849895.60612@ustc.edu.cn> (raw)
Message-ID: <20071228135123.237186756@mail.ustc.edu.cn> (raw)
In-Reply-To: 20071228134119.112899193@mail.ustc.edu.cn

[-- Attachment #1: writeback-simplify-x.patch --]
[-- Type: text/plain, Size: 1654 bytes --]

Make the if-else straight in __sync_single_inode().
No behavior change.

Cc: Michael Rubin <mrubin@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn>
---
 fs/fs-writeback.c |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

--- linux-2.6.24-rc6-mm1.orig/fs/fs-writeback.c
+++ linux-2.6.24-rc6-mm1/fs/fs-writeback.c
@@ -248,37 +248,36 @@ __sync_single_inode(struct inode *inode,
 	if (wait) {
 		int err = filemap_fdatawait(mapping);
 		if (ret == 0)
 			ret = err;
 	}
 
 	spin_lock(&inode_lock);
 	inode->i_state &= ~I_SYNC;
 	if (!(inode->i_state & I_FREEING)) {
-		if (!(inode->i_state & I_DIRTY) &&
-		    mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) {
+		if (inode->i_state & I_DIRTY) {
+			/*
+			 * Someone redirtied the inode while were writing back
+			 * the pages.
+			 */
+			requeue_io(inode);
+		} else if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) {
 			/*
 			 * We didn't write back all the pages.  nfs_writepages()
 			 * sometimes bales out without doing anything.
 			 */
 			inode->i_state |= I_DIRTY_PAGES;
 			if (wbc->nr_to_write > 0)
 				/* somehow blocked: wait and retry */
 				requeue_io_wait(inode);
 			else
 				/* slice used up: queue for next turn */
 				requeue_io(inode);
-		} else if (inode->i_state & I_DIRTY) {
-			/*
-			 * Someone redirtied the inode while were writing back
-			 * the pages.
-			 */
-			requeue_io(inode);
 		} else if (atomic_read(&inode->i_count)) {
 			/*
 			 * The inode is clean, inuse
 			 */
 			list_move(&inode->i_list, &inode_in_use);
 		} else {
 			/*
 			 * The inode is clean, unused
 			 */

-- 

  parent reply	other threads:[~2007-12-28 13:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-28 13:41 [PATCH 00/11] writeback bug fixes and simplifications Fengguang Wu
2007-12-28 13:41 ` Fengguang Wu
2007-12-28 13:41 ` [PATCH 01/11] writeback: introduce s_more_io_wait for inodes to be re-synced after a while Fengguang Wu
2007-12-28 13:41   ` Fengguang Wu
2007-12-28 13:41 ` [PATCH 02/11] writeback: requeue_io_wait() on blocked kupdate Fengguang Wu
2007-12-28 13:41   ` Fengguang Wu
2007-12-28 13:41 ` [PATCH 03/11] writeback: replace redirty_tail() on more-pages-to-sync Fengguang Wu
2007-12-28 13:41   ` Fengguang Wu
2007-12-28 13:41 ` [PATCH 04/11] writeback: requeue_io_wait() on locked inode Fengguang Wu
2007-12-28 13:41   ` Fengguang Wu
2007-12-28 13:41 ` [PATCH 05/11] writeback: requeue_io_wait() on congested blockdev Fengguang Wu
2007-12-28 13:41   ` Fengguang Wu
2007-12-28 13:41 ` [PATCH 06/11] writeback: requeue_io_wait() on locked buffers Fengguang Wu
2007-12-28 13:41   ` Fengguang Wu
2007-12-28 13:41 ` [PATCH 07/11] writeback: requeue_io() on redirtied inode Fengguang Wu
2007-12-28 13:41   ` Fengguang Wu
2007-12-28 13:41 ` [PATCH 08/11] writeback: introduce queue_dirty() Fengguang Wu
2007-12-28 13:41   ` Fengguang Wu
2007-12-28 13:41 ` [PATCH 09/11] writeback: replace redirty_tail() on memory-backed bdi Fengguang Wu
2007-12-28 13:41   ` Fengguang Wu
2007-12-28 13:41 ` [PATCH 10/11] writeback: remove redirty_tail() Fengguang Wu
2007-12-28 13:41   ` Fengguang Wu
2007-12-28 13:41 ` Fengguang Wu [this message]
2007-12-28 13:41   ` [PATCH 11/11] writeback: __sync_single_inode() code cleanup Fengguang Wu

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=398849895.60612@ustc.edu.cn \
    --to=wfg@mail.ustc.edu.cn \
    --cc=akpm@osdl.org \
    --cc=mrubin@google.com \
    --cc=peterz@infradead.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 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.