f2fs: set fsync mark only for the last dnode
[deliverable/linux.git] / fs / f2fs / file.c
index 60fd64c59cce4b18da8e3ff89fec161e73c48a6f..dc47d5c7b882e8fc30b282da61ef6bd2196e850e 100644 (file)
@@ -182,7 +182,8 @@ static void try_to_fix_pino(struct inode *inode)
        }
 }
 
-int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
+static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
+                                               int datasync, bool atomic)
 {
        struct inode *inode = file->f_mapping->host;
        struct f2fs_inode_info *fi = F2FS_I(inode);
@@ -256,7 +257,7 @@ go_write:
                goto out;
        }
 sync_nodes:
-       ret = fsync_node_pages(sbi, ino, &wbc);
+       ret = fsync_node_pages(sbi, ino, &wbc, atomic);
        if (ret)
                goto out;
 
@@ -290,6 +291,11 @@ out:
        return ret;
 }
 
+int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
+{
+       return f2fs_do_sync_file(file, start, end, datasync, false);
+}
+
 static pgoff_t __get_first_dirty_index(struct address_space *mapping,
                                                pgoff_t pgofs, int whence)
 {
@@ -1407,7 +1413,7 @@ static int f2fs_ioc_commit_atomic_write(struct file *filp)
                }
        }
 
-       ret = f2fs_sync_file(filp, 0, LLONG_MAX, 0);
+       ret = f2fs_do_sync_file(filp, 0, LLONG_MAX, 0, true);
 err_out:
        mnt_drop_write_file(filp);
        return ret;
@@ -1465,7 +1471,7 @@ static int f2fs_ioc_abort_volatile_write(struct file *filp)
                drop_inmem_pages(inode);
        if (f2fs_is_volatile_file(inode)) {
                clear_inode_flag(F2FS_I(inode), FI_VOLATILE_FILE);
-               ret = f2fs_sync_file(filp, 0, LLONG_MAX, 0);
+               ret = f2fs_do_sync_file(filp, 0, LLONG_MAX, 0, true);
        }
 
        mnt_drop_write_file(filp);
This page took 0.027948 seconds and 5 git commands to generate.