>From 15f3c6f15891121ff8ca06e214f75c4bac9f2f80 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Fri, 21 Oct 2011 01:15:43 +0200 Subject: [PATCH] writeback: requeue_io_wait() when I_SYNC is set If writeback skips inode because it is already under writeback (I_SYNC flag is set), we can now use requeue_io_wait() instead of requeue_io() and remove special busyloop prevention in wb_writeback(). Signed-off-by: Jan Kara --- fs/fs-writeback.c | 21 +++++++++------------ 1 files changed, 9 insertions(+), 12 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 89b9b70..4e5cae0 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -14,6 +14,7 @@ */ #include +#include #include #include #include @@ -391,7 +392,7 @@ writeback_single_inode(struct inode *inode, struct bdi_writeback *wb, * completed a full scan of b_io. */ if (wbc->sync_mode != WB_SYNC_ALL) { - requeue_io(inode, wb); + requeue_io_wait(inode, wb); trace_writeback_single_inode_requeue(inode, wbc, nr_to_write); return 0; @@ -725,7 +726,6 @@ static long wb_writeback(struct bdi_writeback *wb, unsigned long wb_start = jiffies; long nr_pages = work->nr_pages; unsigned long oldest_jif; - struct inode *inode; long progress; long total_progress = 0; @@ -791,17 +791,14 @@ static long wb_writeback(struct bdi_writeback *wb, if (list_empty(&wb->b_more_io)) break; /* - * Nothing written. Wait for some inode to - * become available for writeback. Otherwise - * we'll just busyloop. + * Nothing written but some inodes were moved to b_more_io. + * This should not happen as we can easily busyloop. */ - if (!list_empty(&wb->b_more_io)) { - trace_writeback_wait(wb->bdi, work); - inode = wb_inode(wb->b_more_io.prev); - spin_lock(&inode->i_lock); - inode_wait_for_writeback(inode, wb); - spin_unlock(&inode->i_lock); - } + pr_warn_ratelimited("mm: Possible busyloop in data writeback " + "(bdi %s nr_pages %ld sync_mode %d kupdate %d " + "background %d)\n", + wb->bdi->name, work->nr_pages, work->sync_mode, + work->for_kupdate, work->for_background); } spin_unlock(&wb->list_lock); -- 1.7.1