fs/fs-writeback.c | 30 +++++++++++++++++++++++++++++- mm/page-writeback.c | 1 + 2 files changed, 30 insertions(+), 1 deletion(-) --- linux.orig/mm/page-writeback.c 2009-09-19 10:51:09.000000000 +0800 +++ linux/mm/page-writeback.c 2009-09-19 10:51:47.000000000 +0800 @@ -536,6 +536,7 @@ static void balance_dirty_pages(struct a pages_written += write_chunk - wbc.nr_to_write; get_dirty_limits(&background_thresh, &dirty_thresh, &bdi_thresh, bdi); + writeback_debug_report(pages_written, &wbc); } /* --- linux.orig/fs/fs-writeback.c 2009-09-19 10:51:46.000000000 +0800 +++ linux/fs/fs-writeback.c 2009-09-19 10:51:47.000000000 +0800 @@ -68,6 +68,33 @@ enum { #define WS_USED (1 << WS_USED_B) #define WS_ONSTACK (1 << WS_ONSTACK_B) +void print_writeback_control(struct writeback_control *wbc) +{ + printk(KERN_DEBUG + "global dirty=%lu writeback=%lu nfs=%lu " + "flags=%c%c towrite=%ld skipped=%ld " + "file=%lu written=%lu\n", + global_page_state(NR_FILE_DIRTY), + global_page_state(NR_WRITEBACK), + global_page_state(NR_UNSTABLE_NFS), + wbc->encountered_congestion ? 'C':'_', + wbc->more_io ? 'M':'_', + wbc->nr_to_write, + wbc->pages_skipped, + wbc->last_file, + wbc->last_file_written); +} + +void __writeback_debug_report(long n, struct writeback_control *wbc, + const char *file, int line, const char *func) +{ + printk(KERN_DEBUG "%s +%d %s(): comm=%s pid=%d n=%ld\n", + file, line, func, + current->comm, current->pid, + n); + print_writeback_control(wbc); +} + static inline bool bdi_work_on_stack(struct bdi_work *work) { return test_bit(WS_ONSTACK_B, &work->state); @@ -302,7 +329,7 @@ static void requeue_io(struct inode *ino */ static void requeue_partial_io(struct writeback_control *wbc, struct inode *inode) { - if (time_before(wbc->last_file_time + HZ, jiffies) || + if (time_before(wbc->last_file_time + 1000 * HZ, jiffies) || wbc->last_file_written == 0 || wbc->last_file_written >= MAX_WRITEBACK_PAGES) { requeue_io(inode); @@ -749,6 +776,7 @@ static long wb_writeback(struct bdi_writ args->nr_pages -= MAX_WRITEBACK_PAGES - wbc.nr_to_write; wrote += MAX_WRITEBACK_PAGES - wbc.nr_to_write; + writeback_debug_report(wrote, &wbc); /* * If we ran out of stuff to write, bail unless more_io got set */