From 6867abf2a6c7f1b13ccfd59f5c65da764fdf11bc Mon Sep 17 00:00:00 2001 From: Wu Fengguang Date: Thu, 18 Nov 2010 14:38:33 -0600 Subject: [PATCH] --- yaml --- r: 274363 b: refs/heads/master c: b00949aa2df9970a912bf060bc95e99da356881c h: refs/heads/master i: 274361: 069734f625ce6c5d0fafaf0ce99267487f4ac656 274359: fcd09d5d8188c6d58c1aafd707c34a6d359e5241 v: v3 --- [refs] | 2 +- trunk/fs/fs-writeback.c | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 1763d88a3c69..397f8e7590ea 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 8927f66c4ede9a18b4b58f7e6f9debca67065f6b +refs/heads/master: b00949aa2df9970a912bf060bc95e99da356881c diff --git a/trunk/fs/fs-writeback.c b/trunk/fs/fs-writeback.c index 28076562ada0..6401cd76f109 100644 --- a/trunk/fs/fs-writeback.c +++ b/trunk/fs/fs-writeback.c @@ -658,14 +658,21 @@ long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages) return nr_pages - work.nr_pages; } -static inline bool over_bground_thresh(void) +static bool over_bground_thresh(struct backing_dev_info *bdi) { unsigned long background_thresh, dirty_thresh; global_dirty_limits(&background_thresh, &dirty_thresh); - return (global_page_state(NR_FILE_DIRTY) + - global_page_state(NR_UNSTABLE_NFS) > background_thresh); + if (global_page_state(NR_FILE_DIRTY) + + global_page_state(NR_UNSTABLE_NFS) > background_thresh) + return true; + + if (bdi_stat(bdi, BDI_RECLAIMABLE) > + bdi_dirty_limit(bdi, background_thresh)) + return true; + + return false; } /* @@ -727,7 +734,7 @@ static long wb_writeback(struct bdi_writeback *wb, * For background writeout, stop when we are below the * background dirty threshold */ - if (work->for_background && !over_bground_thresh()) + if (work->for_background && !over_bground_thresh(wb->bdi)) break; if (work->for_kupdate) { @@ -811,7 +818,7 @@ static unsigned long get_nr_dirty_pages(void) static long wb_check_background_flush(struct bdi_writeback *wb) { - if (over_bground_thresh()) { + if (over_bground_thresh(wb->bdi)) { struct wb_writeback_work work = { .nr_pages = LONG_MAX,