diff options
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/file.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index b4cc860fdd01..847e933e4a84 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1473,8 +1473,12 @@ static int expand_inode_data(struct inode *inode, loff_t offset, new_size = ((loff_t)pg_end << PAGE_SHIFT) + off_end; } - if (!(mode & FALLOC_FL_KEEP_SIZE) && i_size_read(inode) < new_size) - f2fs_i_size_write(inode, new_size); + if (new_size > i_size_read(inode)) { + if (mode & FALLOC_FL_KEEP_SIZE) + file_set_keep_isize(inode); + else + f2fs_i_size_write(inode, new_size); + } return err; } @@ -1521,8 +1525,6 @@ static long f2fs_fallocate(struct file *file, int mode, if (!ret) { inode->i_mtime = inode->i_ctime = current_time(inode); f2fs_mark_inode_dirty_sync(inode, false); - if (mode & FALLOC_FL_KEEP_SIZE) - file_set_keep_isize(inode); f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); } |