aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/fs-writeback.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 518c6294bf6c..5fa588e933d5 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -844,14 +844,15 @@ static void bdi_split_work_to_wbs(struct backing_dev_info *bdi,
844 struct wb_iter iter; 844 struct wb_iter iter;
845 845
846 might_sleep(); 846 might_sleep();
847
848 if (!bdi_has_dirty_io(bdi))
849 return;
850restart: 847restart:
851 rcu_read_lock(); 848 rcu_read_lock();
852 bdi_for_each_wb(wb, bdi, &iter, next_blkcg_id) { 849 bdi_for_each_wb(wb, bdi, &iter, next_blkcg_id) {
853 if (!wb_has_dirty_io(wb) || 850 /* SYNC_ALL writes out I_DIRTY_TIME too */
854 (skip_if_busy && writeback_in_progress(wb))) 851 if (!wb_has_dirty_io(wb) &&
852 (base_work->sync_mode == WB_SYNC_NONE ||
853 list_empty(&wb->b_dirty_time)))
854 continue;
855 if (skip_if_busy && writeback_in_progress(wb))
855 continue; 856 continue;
856 857
857 base_work->nr_pages = wb_split_bdi_pages(wb, nr_pages); 858 base_work->nr_pages = wb_split_bdi_pages(wb, nr_pages);
@@ -899,8 +900,7 @@ static void bdi_split_work_to_wbs(struct backing_dev_info *bdi,
899{ 900{
900 might_sleep(); 901 might_sleep();
901 902
902 if (bdi_has_dirty_io(bdi) && 903 if (!skip_if_busy || !writeback_in_progress(&bdi->wb)) {
903 (!skip_if_busy || !writeback_in_progress(&bdi->wb))) {
904 base_work->auto_free = 0; 904 base_work->auto_free = 0;
905 base_work->single_wait = 0; 905 base_work->single_wait = 0;
906 base_work->single_done = 0; 906 base_work->single_done = 0;
@@ -2275,8 +2275,12 @@ void sync_inodes_sb(struct super_block *sb)
2275 }; 2275 };
2276 struct backing_dev_info *bdi = sb->s_bdi; 2276 struct backing_dev_info *bdi = sb->s_bdi;
2277 2277
2278 /* Nothing to do? */ 2278 /*
2279 if (!bdi_has_dirty_io(bdi) || bdi == &noop_backing_dev_info) 2279 * Can't skip on !bdi_has_dirty() because we should wait for !dirty
2280 * inodes under writeback and I_DIRTY_TIME inodes ignored by
2281 * bdi_has_dirty() need to be written out too.
2282 */
2283 if (bdi == &noop_backing_dev_info)
2280 return; 2284 return;
2281 WARN_ON(!rwsem_is_locked(&sb->s_umount)); 2285 WARN_ON(!rwsem_is_locked(&sb->s_umount));
2282 2286