aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r--fs/f2fs/file.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 7f9ea9271ebe..3191b52aafb0 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -96,8 +96,9 @@ out:
96} 96}
97 97
98static const struct vm_operations_struct f2fs_file_vm_ops = { 98static const struct vm_operations_struct f2fs_file_vm_ops = {
99 .fault = filemap_fault, 99 .fault = filemap_fault,
100 .page_mkwrite = f2fs_vm_page_mkwrite, 100 .page_mkwrite = f2fs_vm_page_mkwrite,
101 .remap_pages = generic_file_remap_pages,
101}; 102};
102 103
103static int need_to_sync_dir(struct f2fs_sb_info *sbi, struct inode *inode) 104static int need_to_sync_dir(struct f2fs_sb_info *sbi, struct inode *inode)
@@ -137,6 +138,9 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
137 if (ret) 138 if (ret)
138 return ret; 139 return ret;
139 140
141 /* guarantee free sections for fsync */
142 f2fs_balance_fs(sbi);
143
140 mutex_lock(&inode->i_mutex); 144 mutex_lock(&inode->i_mutex);
141 145
142 if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) 146 if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
@@ -407,6 +411,8 @@ int truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end)
407 struct dnode_of_data dn; 411 struct dnode_of_data dn;
408 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); 412 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
409 413
414 f2fs_balance_fs(sbi);
415
410 mutex_lock_op(sbi, DATA_TRUNC); 416 mutex_lock_op(sbi, DATA_TRUNC);
411 set_new_dnode(&dn, inode, NULL, NULL, 0); 417 set_new_dnode(&dn, inode, NULL, NULL, 0);
412 err = get_dnode_of_data(&dn, index, RDONLY_NODE); 418 err = get_dnode_of_data(&dn, index, RDONLY_NODE);
@@ -534,7 +540,6 @@ static long f2fs_fallocate(struct file *file, int mode,
534 loff_t offset, loff_t len) 540 loff_t offset, loff_t len)
535{ 541{
536 struct inode *inode = file->f_path.dentry->d_inode; 542 struct inode *inode = file->f_path.dentry->d_inode;
537 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
538 long ret; 543 long ret;
539 544
540 if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) 545 if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
@@ -545,7 +550,10 @@ static long f2fs_fallocate(struct file *file, int mode,
545 else 550 else
546 ret = expand_inode_data(inode, offset, len, mode); 551 ret = expand_inode_data(inode, offset, len, mode);
547 552
548 f2fs_balance_fs(sbi); 553 if (!ret) {
554 inode->i_mtime = inode->i_ctime = CURRENT_TIME;
555 mark_inode_dirty(inode);
556 }
549 return ret; 557 return ret;
550} 558}
551 559