public inbox for linux-kernel@vger.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 08/11] writeback: introduce queue_dirty()
Date: Fri, 28 Dec 2007 21:41:27 +0800	[thread overview]
Message-ID: <398849894.27936@ustc.edu.cn> (raw)
Message-ID: <20071228135122.779152029@mail.ustc.edu.cn> (raw)
In-Reply-To: 20071228134119.112899193@mail.ustc.edu.cn

[-- Attachment #1: writeback-queue_dirty.patch --]
[-- Type: text/plain, Size: 1876 bytes --]

Introduce queue_dirty() to enqueue a newly dirtied inode.
It helps remove duplicate code.

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 |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

--- linux-2.6.24-rc6-mm1.orig/fs/fs-writeback.c
+++ linux-2.6.24-rc6-mm1/fs/fs-writeback.c
@@ -23,10 +23,19 @@
 #include <linux/blkdev.h>
 #include <linux/backing-dev.h>
 #include <linux/buffer_head.h>
 #include "internal.h"
 
+/*
+ * Enqueue a newly dirtied inode.
+ */
+static void queue_dirty(struct inode *inode)
+{
+	inode->dirtied_when = jiffies;
+	list_move(&inode->i_list, &inode->i_sb->s_dirty);
+}
+
 /**
  *	__mark_inode_dirty -	internal function
  *	@inode: inode to mark
  *	@flags: what kind of dirty (i.e. I_DIRTY_SYNC)
  *	Mark an inode as dirty. Callers should use mark_inode_dirty or
@@ -120,14 +129,12 @@ void __mark_inode_dirty(struct inode *in
 
 		/*
 		 * If the inode was already on s_dirty/s_io/s_more_io, don't
 		 * reposition it (that would break s_dirty time-ordering).
 		 */
-		if (!was_dirty) {
-			inode->dirtied_when = jiffies;
-			list_move(&inode->i_list, &sb->s_dirty);
-		}
+		if (!was_dirty)
+			queue_dirty(inode);
 	}
 out:
 	spin_unlock(&inode_lock);
 }
 
@@ -438,14 +445,12 @@ int generic_sync_sb_inodes(struct super_
 		__iget(inode);
 		pages_skipped = wbc->pages_skipped;
 		err = __writeback_single_inode(inode, wbc);
 		if (!ret)
 			ret = err;
-		if (wbc->sync_mode == WB_SYNC_HOLD) {
-			inode->dirtied_when = jiffies;
-			list_move(&inode->i_list, &sb->s_dirty);
-		}
+		if (wbc->sync_mode == WB_SYNC_HOLD)
+			queue_dirty(inode);
 		if (current_is_pdflush())
 			writeback_release(bdi);
 		if (wbc->pages_skipped != pages_skipped) {
 			/*
 			 * writeback is not making progress due to locked

-- 

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

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20071228134119.112899193@mail.ustc.edu.cn>
2007-12-28 13:41 ` [PATCH 00/11] writeback bug fixes and simplifications Fengguang Wu
     [not found] ` <20071228135121.729972858@mail.ustc.edu.cn>
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
     [not found] ` <20071228135121.907366463@mail.ustc.edu.cn>
2007-12-28 13:41   ` [PATCH 02/11] writeback: requeue_io_wait() on blocked kupdate Fengguang Wu
     [not found] ` <20071228135122.055004293@mail.ustc.edu.cn>
2007-12-28 13:41   ` [PATCH 03/11] writeback: replace redirty_tail() on more-pages-to-sync Fengguang Wu
     [not found] ` <20071228135122.207057056@mail.ustc.edu.cn>
2007-12-28 13:41   ` [PATCH 04/11] writeback: requeue_io_wait() on locked inode Fengguang Wu
     [not found] ` <20071228135122.352597180@mail.ustc.edu.cn>
2007-12-28 13:41   ` [PATCH 05/11] writeback: requeue_io_wait() on congested blockdev Fengguang Wu
     [not found] ` <20071228135122.498901458@mail.ustc.edu.cn>
2007-12-28 13:41   ` [PATCH 06/11] writeback: requeue_io_wait() on locked buffers Fengguang Wu
     [not found] ` <20071228135122.639594456@mail.ustc.edu.cn>
2007-12-28 13:41   ` [PATCH 07/11] writeback: requeue_io() on redirtied inode Fengguang Wu
     [not found] ` <20071228135122.779152029@mail.ustc.edu.cn>
2007-12-28 13:41   ` Fengguang Wu [this message]
     [not found] ` <20071228135122.931500020@mail.ustc.edu.cn>
2007-12-28 13:41   ` [PATCH 09/11] writeback: replace redirty_tail() on memory-backed bdi Fengguang Wu
     [not found] ` <20071228135123.092384048@mail.ustc.edu.cn>
2007-12-28 13:41   ` [PATCH 10/11] writeback: remove redirty_tail() Fengguang Wu
     [not found] ` <20071228135123.237186756@mail.ustc.edu.cn>
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=398849894.27936@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox