|
@@ -634,6 +634,21 @@ static void unblock_operations(struct f2fs_sb_info *sbi)
|
|
|
f2fs_unlock_all(sbi);
|
|
|
}
|
|
|
|
|
|
+static void wait_on_all_pages_writeback(struct f2fs_sb_info *sbi)
|
|
|
+{
|
|
|
+ DEFINE_WAIT(wait);
|
|
|
+
|
|
|
+ for (;;) {
|
|
|
+ prepare_to_wait(&sbi->cp_wait, &wait, TASK_UNINTERRUPTIBLE);
|
|
|
+
|
|
|
+ if (!get_pages(sbi, F2FS_WRITEBACK))
|
|
|
+ break;
|
|
|
+
|
|
|
+ io_schedule();
|
|
|
+ }
|
|
|
+ finish_wait(&sbi->cp_wait, &wait);
|
|
|
+}
|
|
|
+
|
|
|
static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount)
|
|
|
{
|
|
|
struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
|
|
@@ -743,15 +758,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount)
|
|
|
f2fs_put_page(cp_page, 1);
|
|
|
|
|
|
/* wait for previous submitted node/meta pages writeback */
|
|
|
- sbi->cp_task = current;
|
|
|
- while (get_pages(sbi, F2FS_WRITEBACK)) {
|
|
|
- set_current_state(TASK_UNINTERRUPTIBLE);
|
|
|
- if (!get_pages(sbi, F2FS_WRITEBACK))
|
|
|
- break;
|
|
|
- io_schedule();
|
|
|
- }
|
|
|
- __set_current_state(TASK_RUNNING);
|
|
|
- sbi->cp_task = NULL;
|
|
|
+ wait_on_all_pages_writeback(sbi);
|
|
|
|
|
|
filemap_fdatawait_range(sbi->node_inode->i_mapping, 0, LONG_MAX);
|
|
|
filemap_fdatawait_range(sbi->meta_inode->i_mapping, 0, LONG_MAX);
|