@@ -1060,6 +1060,23 @@ static long wb_check_background_flush(struct bdi_writeback *wb)
return 0;
}
+/*
+ * clean out writeback list for all inodes that don't have IO in progress
+ */
+static void wb_trim_writeback_list(struct bdi_writeback *wb)
+{
+ struct inode *inode;
+ struct inode *tmp;
+
+ spin_lock(&wb->list_lock);
+ list_for_each_entry_safe(inode, tmp, &wb->b_writeback, i_wb_list) {
+ if (!mapping_tagged(inode->i_mapping, PAGECACHE_TAG_WRITEBACK))
+ list_del_init(&inode->i_wb_list);
+ }
+ spin_unlock(&wb->list_lock);
+
+}
+
static long wb_check_old_data_flush(struct bdi_writeback *wb)
{
unsigned long expired;
@@ -1076,6 +1093,8 @@ static long wb_check_old_data_flush(struct bdi_writeback *wb)
if (time_before(jiffies, expired))
return 0;
+ wb_trim_writeback_list(wb);
+
wb->last_old_flush = jiffies;
nr_pages = get_nr_dirty_pages();