f2fs: use IPU for fdatasync
authorJaegeuk Kim <jaegeuk@kernel.org>
Thu, 31 Dec 2015 21:49:17 +0000 (13:49 -0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 31 Dec 2015 21:49:17 +0000 (13:49 -0800)
This patch fixes missing IPU condition when fdatasync is called.
With this patch, fdatasync is able to avoid additional node writes for recovery.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c

index b04ab40ddc737c25f072600f578789ad772b52c0..e3d32f6b4b4f5bc674ee5ae7ffb4e132d2c32130 100644 (file)
@@ -202,7 +202,7 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
        trace_f2fs_sync_file_enter(inode);
 
        /* if fdatasync is triggered, let's do in-place-update */
-       if (get_dirty_pages(inode) <= SM_I(sbi)->min_fsync_blocks)
+       if (datasync || get_dirty_pages(inode) <= SM_I(sbi)->min_fsync_blocks)
                set_inode_flag(fi, FI_NEED_IPU);
        ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
        clear_inode_flag(fi, FI_NEED_IPU);