aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nilfs2/file.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c
index e9e3325f29f3..3a03e0aea1fb 100644
--- a/fs/nilfs2/file.c
+++ b/fs/nilfs2/file.c
@@ -39,21 +39,15 @@ int nilfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
39 */ 39 */
40 struct the_nilfs *nilfs; 40 struct the_nilfs *nilfs;
41 struct inode *inode = file->f_mapping->host; 41 struct inode *inode = file->f_mapping->host;
42 int err; 42 int err = 0;
43
44 err = filemap_write_and_wait_range(inode->i_mapping, start, end);
45 if (err)
46 return err;
47 mutex_lock(&inode->i_mutex);
48 43
49 if (nilfs_inode_dirty(inode)) { 44 if (nilfs_inode_dirty(inode)) {
50 if (datasync) 45 if (datasync)
51 err = nilfs_construct_dsync_segment(inode->i_sb, inode, 46 err = nilfs_construct_dsync_segment(inode->i_sb, inode,
52 0, LLONG_MAX); 47 start, end);
53 else 48 else
54 err = nilfs_construct_segment(inode->i_sb); 49 err = nilfs_construct_segment(inode->i_sb);
55 } 50 }
56 mutex_unlock(&inode->i_mutex);
57 51
58 nilfs = inode->i_sb->s_fs_info; 52 nilfs = inode->i_sb->s_fs_info;
59 if (!err) 53 if (!err)