|
@@ -1605,8 +1605,10 @@ continue_unlock:
|
|
|
last_idx = page->index;
|
|
last_idx = page->index;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (--wbc->nr_to_write <= 0 &&
|
|
|
|
|
- wbc->sync_mode == WB_SYNC_NONE) {
|
|
|
|
|
|
|
+ /* give a priority to WB_SYNC threads */
|
|
|
|
|
+ if ((atomic_read(&F2FS_M_SB(mapping)->wb_sync_req) ||
|
|
|
|
|
+ --wbc->nr_to_write <= 0) &&
|
|
|
|
|
+ wbc->sync_mode == WB_SYNC_NONE) {
|
|
|
done = 1;
|
|
done = 1;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -1662,9 +1664,18 @@ static int f2fs_write_data_pages(struct address_space *mapping,
|
|
|
|
|
|
|
|
trace_f2fs_writepages(mapping->host, wbc, DATA);
|
|
trace_f2fs_writepages(mapping->host, wbc, DATA);
|
|
|
|
|
|
|
|
|
|
+ /* to avoid spliting IOs due to mixed WB_SYNC_ALL and WB_SYNC_NONE */
|
|
|
|
|
+ if (wbc->sync_mode == WB_SYNC_ALL)
|
|
|
|
|
+ atomic_inc(&sbi->wb_sync_req);
|
|
|
|
|
+ else if (atomic_read(&sbi->wb_sync_req))
|
|
|
|
|
+ goto skip_write;
|
|
|
|
|
+
|
|
|
blk_start_plug(&plug);
|
|
blk_start_plug(&plug);
|
|
|
ret = f2fs_write_cache_pages(mapping, wbc);
|
|
ret = f2fs_write_cache_pages(mapping, wbc);
|
|
|
blk_finish_plug(&plug);
|
|
blk_finish_plug(&plug);
|
|
|
|
|
+
|
|
|
|
|
+ if (wbc->sync_mode == WB_SYNC_ALL)
|
|
|
|
|
+ atomic_dec(&sbi->wb_sync_req);
|
|
|
/*
|
|
/*
|
|
|
* if some pages were truncated, we cannot guarantee its mapping->host
|
|
* if some pages were truncated, we cannot guarantee its mapping->host
|
|
|
* to detect pending bios.
|
|
* to detect pending bios.
|