diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-01-11 00:09:38 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-01-11 01:09:23 -0500 |
commit | 9eaeba701386037cdd2ccd8bf8650feb2e2cec31 (patch) | |
tree | d03afbc42a9936767b814b2b0f3f13c9784e9916 /fs | |
parent | 7d82db83165dbac8c3f6d47b73c84f38e3996e30 (diff) |
f2fs: move f2fs_balance_fs to punch_hole
The f2fs_fallocate() has two operations: punch_hole and expand_size.
Only in the case of punch_hole, dirty node pages can be produced, so let's
trigger f2fs_balance_fs() in this case only.
Furthermore, let's trigger it at every data truncation routine.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/f2fs/file.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 7354c2df1087..819de7f39f26 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
@@ -410,6 +410,8 @@ int truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end) | |||
410 | struct dnode_of_data dn; | 410 | struct dnode_of_data dn; |
411 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | 411 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
412 | 412 | ||
413 | f2fs_balance_fs(sbi); | ||
414 | |||
413 | mutex_lock_op(sbi, DATA_TRUNC); | 415 | mutex_lock_op(sbi, DATA_TRUNC); |
414 | set_new_dnode(&dn, inode, NULL, NULL, 0); | 416 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
415 | err = get_dnode_of_data(&dn, index, RDONLY_NODE); | 417 | err = get_dnode_of_data(&dn, index, RDONLY_NODE); |
@@ -537,7 +539,6 @@ static long f2fs_fallocate(struct file *file, int mode, | |||
537 | loff_t offset, loff_t len) | 539 | loff_t offset, loff_t len) |
538 | { | 540 | { |
539 | struct inode *inode = file->f_path.dentry->d_inode; | 541 | struct inode *inode = file->f_path.dentry->d_inode; |
540 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | ||
541 | long ret; | 542 | long ret; |
542 | 543 | ||
543 | if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) | 544 | if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) |
@@ -552,8 +553,6 @@ static long f2fs_fallocate(struct file *file, int mode, | |||
552 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 553 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
553 | mark_inode_dirty(inode); | 554 | mark_inode_dirty(inode); |
554 | } | 555 | } |
555 | |||
556 | f2fs_balance_fs(sbi); | ||
557 | return ret; | 556 | return ret; |
558 | } | 557 | } |
559 | 558 | ||