summaryrefslogtreecommitdiff
path: root/fs/f2fs/node.c
diff options
context:
space:
mode:
authorYunlong Song <yunlong.song@huawei.com>2017-07-27 15:11:00 +0300
committerJaegeuk Kim <jaegeuk@kernel.org>2017-08-04 05:05:04 +0300
commit401db79f61e0810e7c9fa3c7425c0aef84e5c30a (patch)
tree760c461eb6470452cda5e42a8c26dd231f5a5bfe /fs/f2fs/node.c
parentddc34e328d067b15b937dea7ad29034920130200 (diff)
downloadlinux-401db79f61e0810e7c9fa3c7425c0aef84e5c30a.tar.xz
f2fs: provide f2fs_balance_fs to __write_node_page
Let node writeback also do f2fs_balance_fs to ensure there are always enough free segments. Signed-off-by: Yunlong Song <yunlong.song@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r--fs/f2fs/node.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 11e2d49203b3..14b79a396a3f 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1327,7 +1327,7 @@ continue_unlock:
}
static int __write_node_page(struct page *page, bool atomic, bool *submitted,
- struct writeback_control *wbc)
+ struct writeback_control *wbc, bool do_balance)
{
struct f2fs_sb_info *sbi = F2FS_P_SB(page);
nid_t nid;
@@ -1396,6 +1396,8 @@ static int __write_node_page(struct page *page, bool atomic, bool *submitted,
if (submitted)
*submitted = fio.submitted;
+ if (do_balance)
+ f2fs_balance_fs(sbi, false);
return 0;
redirty_out:
@@ -1406,7 +1408,7 @@ redirty_out:
static int f2fs_write_node_page(struct page *page,
struct writeback_control *wbc)
{
- return __write_node_page(page, false, NULL, wbc);
+ return __write_node_page(page, false, NULL, wbc, false);
}
int fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,
@@ -1494,7 +1496,7 @@ continue_unlock:
ret = __write_node_page(page, atomic &&
page == last_page,
- &submitted, wbc);
+ &submitted, wbc, true);
if (ret) {
unlock_page(page);
f2fs_put_page(last_page, 0);
@@ -1531,7 +1533,8 @@ out:
return ret ? -EIO: 0;
}
-int sync_node_pages(struct f2fs_sb_info *sbi, struct writeback_control *wbc)
+int sync_node_pages(struct f2fs_sb_info *sbi, struct writeback_control *wbc,
+ bool do_balance)
{
pgoff_t index, end;
struct pagevec pvec;
@@ -1609,7 +1612,8 @@ continue_unlock:
set_fsync_mark(page, 0);
set_dentry_mark(page, 0);
- ret = __write_node_page(page, false, &submitted, wbc);
+ ret = __write_node_page(page, false, &submitted,
+ wbc, do_balance);
if (ret)
unlock_page(page);
else if (submitted)
@@ -1698,7 +1702,7 @@ static int f2fs_write_node_pages(struct address_space *mapping,
diff = nr_pages_to_write(sbi, NODE, wbc);
wbc->sync_mode = WB_SYNC_NONE;
blk_start_plug(&plug);
- sync_node_pages(sbi, wbc);
+ sync_node_pages(sbi, wbc, true);
blk_finish_plug(&plug);
wbc->nr_to_write = max((long)0, wbc->nr_to_write - diff);
return 0;