Currently we are somewhat inconsistent in which inodes we put to b_more_io. We put there inodes which have exhausted their writeback chunk but we also put there inodes which could not be written because someone else was already writing them (the inode had I_SYNC set). OTOH if inodes couldn't be written for other reasons (filesystem indicates this with pages_skipped or by simply not writing anything) we redirty_tail() the inode. So make things more consistent by putting to b_more_io list only inodes that exhausted their writeback chunk and call redirty_tail() in every case where inode couldn't be written for some reason. This also makes the busyloop prevention in wb_writeback() unnecessary since unwriteable inodes will be moved back to b_dirty list and thus won't confuse us in b_io or b_more_io lists. Signed-off-by: Jan Kara <jack@xxxxxxx> --- fs/fs-writeback.c | 26 ++++---------------------- include/trace/events/writeback.h | 1 - 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index dbace1c09b7f..6ee9ee52e3de 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -611,15 +611,12 @@ static long writeback_inodes(struct bdi_writeback *wb, if ((inode->i_state & I_SYNC) && wbc.sync_mode != WB_SYNC_ALL) { /* * If this inode is locked for writeback and we are not - * doing writeback-for-data-integrity, move it to - * b_more_io so that writeback can proceed with the - * other inodes on s_io. - * - * We'll have another go at writing back this inode - * when we completed a full scan of b_io. + * doing writeback-for-data-integrity, move it back to + * the dirty list so that writeback can proceed with the + * other inodes on b_io. */ spin_unlock(&inode->i_lock); - requeue_io(inode, wb); + redirty_tail(inode, wb); trace_writeback_inodes_requeue(inode); continue; } @@ -722,7 +719,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; oldest_jif = jiffies; @@ -788,20 +784,6 @@ 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. - */ - 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); - spin_unlock(&wb->list_lock); - /* This function drops i_lock... */ - inode_sleep_on_writeback(inode); - spin_lock(&wb->list_lock); - } } spin_unlock(&wb->list_lock); diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h index 9bf6f2da32d2..102e2ad9f90f 100644 --- a/include/trace/events/writeback.h +++ b/include/trace/events/writeback.h @@ -188,7 +188,6 @@ DEFINE_WRITEBACK_WORK_EVENT(writeback_queue); DEFINE_WRITEBACK_WORK_EVENT(writeback_exec); DEFINE_WRITEBACK_WORK_EVENT(writeback_start); DEFINE_WRITEBACK_WORK_EVENT(writeback_written); -DEFINE_WRITEBACK_WORK_EVENT(writeback_wait); TRACE_EVENT(writeback_pages_written, TP_PROTO(long pages_written), -- 1.8.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html