[PATCH 3/7] writeback: update wb->last_active on written pages/inodes

From: Wu Fengguang
Date: Thu Oct 20 2011 - 11:39:36 EST


From: Jan Kara <jack@xxxxxxx>

The writeback last_active value should be updated on not only written
pages, but also cleaned inodes.

Signed-off-by: Jan Kara <jack@xxxxxxx>
Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx>
---
fs/fs-writeback.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

--- linux-next.orig/fs/fs-writeback.c 2011-10-20 21:39:48.000000000 +0800
+++ linux-next/fs/fs-writeback.c 2011-10-20 22:36:59.000000000 +0800
@@ -744,6 +744,7 @@ static long wb_writeback(struct bdi_writ
unsigned long oldest_jif;
struct inode *inode;
long progress;
+ long total_progress = 0;

oldest_jif = jiffies;
work->older_than_this = &oldest_jif;
@@ -787,6 +788,7 @@ static long wb_writeback(struct bdi_writ
else
progress = __writeback_inodes_wb(wb, work);
trace_writeback_written(wb->bdi, work);
+ total_progress += progress;

wb_update_bandwidth(wb, wb_start);

@@ -820,7 +822,8 @@ static long wb_writeback(struct bdi_writ
}
spin_unlock(&wb->list_lock);

- return nr_pages - work->nr_pages;
+ trace_writeback_pages_written(nr_pages - work->nr_pages);
+ return total_progress;
}

/*
@@ -954,7 +957,7 @@ int bdi_writeback_thread(void *data)
{
struct bdi_writeback *wb = data;
struct backing_dev_info *bdi = wb->bdi;
- long pages_written;
+ long progress;

current->flags |= PF_SWAPWRITE;
set_freezable();
@@ -974,11 +977,9 @@ int bdi_writeback_thread(void *data)
*/
del_timer(&wb->wakeup_timer);

- pages_written = wb_do_writeback(wb, 0);
-
- trace_writeback_pages_written(pages_written);
+ progress = wb_do_writeback(wb, 0);

- if (pages_written)
+ if (progress)
wb->last_active = jiffies;

set_current_state(TASK_INTERRUPTIBLE);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/