linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: <linux-fsdevel@vger.kernel.org>
Cc: Jan Kara <jack@suse.cz>, Dave Chinner <david@fromorbit.com>,
	Christoph Hellwig <hch@infradead.org>,
	Wu Fengguang <fengguang.wu@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 4/7] writeback: Retry kupdate work early if we need to retry some inode writeback
Date: Thu, 20 Oct 2011 23:22:44 +0800	[thread overview]
Message-ID: <20111020153706.134518256@intel.com> (raw)
In-Reply-To: 20111020152240.751936131@intel.com

[-- Attachment #1: 0001-writeback-Retry-kupdate-work-early-if-we-need-to-ret.patch --]
[-- Type: text/plain, Size: 1978 bytes --]

From: Jan Kara <jack@suse.cz>

In case we could not do any writeback for some inodes, trigger next kupdate
work early so that writeback on these inodes is not delayed for the whole
dirty_writeback_interval.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 fs/fs-writeback.c |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

--- linux-next.orig/fs/fs-writeback.c	2011-10-20 22:36:59.000000000 +0800
+++ linux-next/fs/fs-writeback.c	2011-10-20 22:42:24.000000000 +0800
@@ -886,7 +886,7 @@ static long wb_check_old_data_flush(stru
 
 	expired = wb->last_old_flush +
 			msecs_to_jiffies(dirty_writeback_interval * 10);
-	if (time_before(jiffies, expired))
+	if (time_before(jiffies, expired) && list_empty(&wb->b_more_io_wait))
 		return 0;
 
 	wb->last_old_flush = jiffies;
@@ -958,6 +958,10 @@ int bdi_writeback_thread(void *data)
 	struct bdi_writeback *wb = data;
 	struct backing_dev_info *bdi = wb->bdi;
 	long progress;
+	unsigned int pause = 1;
+	unsigned int max_pause = dirty_writeback_interval ?
+			msecs_to_jiffies(dirty_writeback_interval * 10) :
+			HZ;
 
 	current->flags |= PF_SWAPWRITE;
 	set_freezable();
@@ -979,8 +983,10 @@ int bdi_writeback_thread(void *data)
 
 		progress = wb_do_writeback(wb, 0);
 
-		if (progress)
+		if (progress) {
 			wb->last_active = jiffies;
+			pause = 1;
+		}
 
 		set_current_state(TASK_INTERRUPTIBLE);
 		if (!list_empty(&bdi->work_list) || kthread_should_stop()) {
@@ -988,8 +994,11 @@ int bdi_writeback_thread(void *data)
 			continue;
 		}
 
-		if (wb_has_dirty_io(wb) && dirty_writeback_interval)
-			schedule_timeout(msecs_to_jiffies(dirty_writeback_interval * 10));
+		if (!list_empty(&wb->b_more_io_wait) && pause < max_pause) {
+			schedule_timeout(pause);
+			pause <<= 1;
+		} else if (wb_has_dirty_io(wb) && dirty_writeback_interval)
+			schedule_timeout(max_pause);
 		else {
 			/*
 			 * We have nothing to do, so can go sleep without any

  parent reply	other threads:[~2011-10-20 15:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-20 15:22 [PATCH 0/7] writeback: avoid touching dirtied_when on blocked inodes Wu Fengguang
2011-10-20 15:22 ` [PATCH 1/7] writeback: introduce queue b_more_io_wait Wu Fengguang
2011-10-20 23:23   ` Jan Kara
2011-10-20 15:22 ` [PATCH 2/7] writeback: avoid redirtying when ->write_inode failed to clear I_DIRTY Wu Fengguang
2011-10-20 23:24   ` Jan Kara
2011-10-20 15:22 ` [PATCH 3/7] writeback: update wb->last_active on written pages/inodes Wu Fengguang
2011-10-20 15:22 ` Wu Fengguang [this message]
2011-10-20 15:22 ` [PATCH 5/7] writeback: requeue_io_wait() on pages_skipped inode Wu Fengguang
2011-10-20 23:25   ` Jan Kara
2011-10-20 15:22 ` [PATCH 6/7] writeback: requeue_io_wait() on blocked inode Wu Fengguang
2011-10-20 23:31   ` Jan Kara
2011-10-20 15:22 ` [PATCH 7/7] writeback: requeue_io_wait() when failed to grab superblock Wu Fengguang
2011-10-20 23:25   ` Jan Kara
2011-10-20 23:21 ` [PATCH 0/7] writeback: avoid touching dirtied_when on blocked inodes Jan Kara
2011-10-21 10:40   ` Wu Fengguang
2011-10-21 19:54     ` Jan Kara
2011-10-22  3:11       ` Wu Fengguang
2011-10-22  5:38         ` Wu Fengguang
2011-10-22  6:59           ` Wu Fengguang
2011-10-22  7:07             ` Wu Fengguang
2011-10-22  7:46           ` Wu Fengguang
2011-10-22  4:46 ` 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=20111020153706.134518256@intel.com \
    --to=fengguang.wu@intel.com \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).