Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 166333
b: refs/heads/master
c: d3ddec7
h: refs/heads/master
i:
  166331: 8714d00
v: v3
  • Loading branch information
Wu Fengguang authored and Jens Axboe committed Sep 25, 2009
1 parent f985d64 commit 705ce84
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3a2e9a5a2afc1a2d2c548b8987f133235cebe933
refs/heads/master: d3ddec7635b6fb37cb49e3553bdeea59642be653
28 changes: 17 additions & 11 deletions trunk/fs/fs-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ struct wb_writeback_args {
long nr_pages;
struct super_block *sb;
enum writeback_sync_modes sync_mode;
int for_kupdate;
int range_cyclic;
int for_kupdate:1;
int range_cyclic:1;
int for_background:1;
};

/*
Expand Down Expand Up @@ -257,6 +258,15 @@ void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages)
.range_cyclic = 1,
};

/*
* We treat @nr_pages=0 as the special case to do background writeback,
* ie. to sync pages until the background dirty threshold is reached.
*/
if (!nr_pages) {
args.nr_pages = LONG_MAX;
args.for_background = 1;
}

bdi_alloc_queue_work(bdi, &args);
}

Expand Down Expand Up @@ -720,20 +730,16 @@ static long wb_writeback(struct bdi_writeback *wb,

for (;;) {
/*
* Don't flush anything for non-integrity writeback where
* no nr_pages was given
* Stop writeback when nr_pages has been consumed
*/
if (!args->for_kupdate && args->nr_pages <= 0 &&
args->sync_mode == WB_SYNC_NONE)
if (args->nr_pages <= 0)
break;

/*
* If no specific pages were given and this is just a
* periodic background writeout and we are below the
* background dirty threshold, don't do anything
* For background writeout, stop when we are below the
* background dirty threshold
*/
if (args->for_kupdate && args->nr_pages <= 0 &&
!over_bground_thresh())
if (args->for_background && !over_bground_thresh())
break;

wbc.more_io = 0;
Expand Down
6 changes: 3 additions & 3 deletions trunk/mm/page-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,10 +593,10 @@ static void balance_dirty_pages(struct address_space *mapping,
* background_thresh, to keep the amount of dirty memory low.
*/
if ((laptop_mode && pages_written) ||
(!laptop_mode && ((nr_writeback = global_page_state(NR_FILE_DIRTY)
+ global_page_state(NR_UNSTABLE_NFS))
(!laptop_mode && ((global_page_state(NR_FILE_DIRTY)
+ global_page_state(NR_UNSTABLE_NFS))
> background_thresh)))
bdi_start_writeback(bdi, nr_writeback);
bdi_start_writeback(bdi, 0);
}

void set_page_dirty_balance(struct page *page, int page_mkwrite)
Expand Down

0 comments on commit 705ce84

Please sign in to comment.