aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/file.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 7c652b3e1511..9b888fbf08b6 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -133,6 +133,17 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
133 return ret; 133 return ret;
134 } 134 }
135 135
136 /*
137 * if there is no written data, don't waste time to write recovery info.
138 */
139 if (!is_inode_flag_set(fi, FI_APPEND_WRITE) &&
140 !exist_written_data(sbi, inode->i_ino, APPEND_INO)) {
141 if (is_inode_flag_set(fi, FI_UPDATE_WRITE) ||
142 exist_written_data(sbi, inode->i_ino, UPDATE_INO))
143 goto flush_out;
144 goto out;
145 }
146
136 /* guarantee free sections for fsync */ 147 /* guarantee free sections for fsync */
137 f2fs_balance_fs(sbi); 148 f2fs_balance_fs(sbi);
138 149
@@ -188,6 +199,13 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
188 ret = wait_on_node_pages_writeback(sbi, inode->i_ino); 199 ret = wait_on_node_pages_writeback(sbi, inode->i_ino);
189 if (ret) 200 if (ret)
190 goto out; 201 goto out;
202
203 /* once recovery info is written, don't need to tack this */
204 remove_dirty_inode(sbi, inode->i_ino, APPEND_INO);
205 clear_inode_flag(fi, FI_APPEND_WRITE);
206flush_out:
207 remove_dirty_inode(sbi, inode->i_ino, UPDATE_INO);
208 clear_inode_flag(fi, FI_UPDATE_WRITE);
191 ret = f2fs_issue_flush(F2FS_SB(inode->i_sb)); 209 ret = f2fs_issue_flush(F2FS_SB(inode->i_sb));
192 } 210 }
193out: 211out: