aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2016-01-07 14:15:04 -0800
committerMister Oyster <oysterized@gmail.com>2017-04-13 12:32:47 +0200
commit0279ba3dc1f4ec09c7122833b1b7515e50076d89 (patch)
tree48d5463b7b417f723ade9b90f29b5d77a0f25e60 /fs
parent6a15d5fed67922ee3b1aab6a5104c0b094dd4c01 (diff)
f2fs: clean up f2fs_balance_fs
This patch adds one parameter to clean up all the callers of f2fs_balance_fs. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Conflicts: fs/f2fs/namei.c
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/data.c17
-rw-r--r--fs/f2fs/f2fs.h2
-rw-r--r--fs/f2fs/file.c17
-rw-r--r--fs/f2fs/inline.c3
-rw-r--r--fs/f2fs/inode.c2
-rw-r--r--fs/f2fs/namei.c18
-rw-r--r--fs/f2fs/segment.c6
-rw-r--r--fs/f2fs/xattr.c2
8 files changed, 31 insertions, 36 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 29b719b2e..472dde6d8 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -547,8 +547,7 @@ static int __allocate_data_blocks(struct inode *inode, loff_t offset,
f2fs_put_dnode(&dn);
f2fs_unlock_op(sbi);
- if (dn.node_changed)
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, dn.node_changed);
}
return err;
@@ -558,8 +557,7 @@ sync_out:
f2fs_put_dnode(&dn);
out:
f2fs_unlock_op(sbi);
- if (dn.node_changed)
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, dn.node_changed);
return err;
}
@@ -658,8 +656,7 @@ get_next:
if (create) {
f2fs_unlock_op(sbi);
- if (dn.node_changed)
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, dn.node_changed);
f2fs_lock_op(sbi);
}
@@ -719,8 +716,7 @@ put_out:
unlock_out:
if (create) {
f2fs_unlock_op(sbi);
- if (dn.node_changed)
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, dn.node_changed);
}
out:
trace_f2fs_map_blocks(inode, map, err);
@@ -1179,8 +1175,7 @@ out:
if (err)
ClearPageUptodate(page);
unlock_page(page);
- if (need_balance_fs)
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, need_balance_fs);
if (wbc->for_reclaim || unlikely(f2fs_cp_error(sbi))) {
f2fs_submit_merged_bio(sbi, DATA, WRITE);
remove_dirty_inode(inode);
@@ -1507,7 +1502,7 @@ repeat:
if (need_balance && has_not_enough_free_secs(sbi, 0)) {
unlock_page(page);
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
lock_page(page);
if (page->mapping != mapping) {
/* The page got truncated from under us */
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 34d3a2839..58f6b543d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1786,7 +1786,7 @@ void destroy_node_manager_caches(void);
*/
void register_inmem_page(struct inode *, struct page *);
int commit_inmem_pages(struct inode *, bool);
-void f2fs_balance_fs(struct f2fs_sb_info *);
+void f2fs_balance_fs(struct f2fs_sb_info *, bool);
void f2fs_balance_fs_bg(struct f2fs_sb_info *);
int f2fs_issue_flush(struct f2fs_sb_info *);
int create_flush_cmd_control(struct f2fs_sb_info *);
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index c12cbf5d1..beca74607 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -55,8 +55,7 @@ static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma,
f2fs_put_dnode(&dn);
f2fs_unlock_op(sbi);
- if (dn.node_changed)
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, dn.node_changed);
file_update_time(vma->vm_file);
lock_page(page);
@@ -695,7 +694,7 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
err = f2fs_truncate(inode, true);
if (err)
return err;
- f2fs_balance_fs(F2FS_I_SB(inode));
+ f2fs_balance_fs(F2FS_I_SB(inode), true);
} else {
/*
* do not trim all blocks after i_size if target size is
@@ -749,7 +748,7 @@ static int fill_zero(struct inode *inode, pgoff_t index,
if (!len)
return 0;
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
f2fs_lock_op(sbi);
page = get_new_data_page(inode, NULL, index, false);
@@ -835,7 +834,7 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len)
loff_t blk_start, blk_end;
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
blk_start = (loff_t)pg_start << PAGE_CACHE_SHIFT;
blk_end = (loff_t)pg_end << PAGE_CACHE_SHIFT;
@@ -938,7 +937,7 @@ static int f2fs_do_collapse(struct inode *inode, pgoff_t start, pgoff_t end)
int ret = 0;
for (; end < nrpages; start++, end++) {
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
f2fs_lock_op(sbi);
ret = __exchange_data_block(inode, end, start, true);
f2fs_unlock_op(sbi);
@@ -1120,7 +1119,7 @@ static int f2fs_insert_range(struct inode *inode, loff_t offset, loff_t len)
if (ret)
return ret;
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
ret = truncate_blocks(inode, i_size_read(inode), true);
if (ret)
@@ -1172,7 +1171,7 @@ static int expand_inode_data(struct inode *inode, loff_t offset,
if (ret)
return ret;
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
pg_start = ((unsigned long long) offset) >> PAGE_CACHE_SHIFT;
pg_end = ((unsigned long long) offset + len) >> PAGE_CACHE_SHIFT;
@@ -1674,7 +1673,7 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
pg_start = range->start >> PAGE_CACHE_SHIFT;
pg_end = (range->start + range->len) >> PAGE_CACHE_SHIFT;
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
mutex_lock(&inode->i_mutex);
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 6a77d7984..fb2aee9a3 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -200,8 +200,7 @@ out:
f2fs_put_page(page, 1);
- if (dn.node_changed)
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, dn.node_changed);
return err;
}
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 28552ffbc..0e099986f 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -303,7 +303,7 @@ int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc)
* during the urgent cleaning time when runing out of free sections.
*/
if (update_inode_page(inode))
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
return 0;
}
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 830323243..24d8fdcd1 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -141,7 +141,7 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
inode->i_mapping->a_ops = &f2fs_dblock_aops;
ino = inode->i_ino;
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
f2fs_lock_op(sbi);
err = f2fs_add_link(dentry, inode);
@@ -173,7 +173,7 @@ static int f2fs_link(struct dentry *old_dentry, struct inode *dir,
!f2fs_is_child_context_consistent_with_parent(dir, inode))
return -EPERM;
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
inode->i_ctime = CURRENT_TIME;
ihold(inode);
@@ -222,7 +222,7 @@ static int __recover_dot_dentries(struct inode *dir, nid_t pino)
return 0;
}
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
f2fs_lock_op(sbi);
@@ -303,7 +303,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
if (!de)
goto fail;
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
f2fs_lock_op(sbi);
err = acquire_orphan_inode(sbi);
@@ -373,7 +373,7 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry,
inode->i_op = &f2fs_symlink_inode_operations;
inode->i_mapping->a_ops = &f2fs_dblock_aops;
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
f2fs_lock_op(sbi);
err = f2fs_add_link(dentry, inode);
@@ -464,7 +464,7 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
inode->i_mapping->a_ops = &f2fs_dblock_aops;
mapping_set_gfp_mask(inode->i_mapping, GFP_F2FS_HIGH_ZERO);
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
set_inode_flag(F2FS_I(inode), FI_INC_LINK);
f2fs_lock_op(sbi);
@@ -513,7 +513,7 @@ static int f2fs_mknod(struct inode *dir, struct dentry *dentry,
init_special_inode(inode, inode->i_mode, rdev);
inode->i_op = &f2fs_special_inode_operations;
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
f2fs_lock_op(sbi);
err = f2fs_add_link(dentry, inode);
@@ -577,7 +577,7 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
if (!new_entry)
goto out_dir;
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
f2fs_lock_op(sbi);
@@ -610,7 +610,7 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
update_inode_page(old_inode);
update_inode_page(new_inode);
} else {
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
f2fs_lock_op(sbi);
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 0637b51a8..d36a6eeae 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -272,7 +272,7 @@ int commit_inmem_pages(struct inode *inode, bool abort)
* inode becomes free by iget_locked in f2fs_iget.
*/
if (!abort) {
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
f2fs_lock_op(sbi);
}
@@ -321,8 +321,10 @@ int commit_inmem_pages(struct inode *inode, bool abort)
* This function balances dirty node and dentry pages.
* In addition, it controls garbage collection.
*/
-void f2fs_balance_fs(struct f2fs_sb_info *sbi)
+void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need)
{
+ if (!need)
+ return;
/*
* We should do GC or end up with checkpoint, if there are so many dirty
* dir/node pages without enough free segments.
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index dd0646a56..ff819ee24 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -610,7 +610,7 @@ int f2fs_setxattr(struct inode *inode, int index, const char *name,
if (ipage)
return __f2fs_setxattr(inode, index, name, value,
size, ipage, flags);
- f2fs_balance_fs(sbi);
+ f2fs_balance_fs(sbi, true);
f2fs_lock_op(sbi);
/* protect xattr_ver */