summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/node.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2017-02-03 17:44:04 -0800
committerJaegeuk Kim <jaegeuk@kernel.org>2017-02-23 10:10:47 -0800
commitd68f735b3bc934a7523a047aa952a577cf6ca171 (patch)
tree6da42687b43484a16d2a819fce741d7fc3955af1 /fs/f2fs/node.c
parentf566bae8462c4a48b55bbf4e58d5b1e0a8563819 (diff)
downloadlinux-d68f735b3bc934a7523a047aa952a577cf6ca171.tar.bz2
f2fs: check io submission more precisely
This patch check IO submission more precisely than previous rough check. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r--fs/f2fs/node.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 6a86f398aeac..5bd05e552d19 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1318,7 +1318,7 @@ continue_unlock:
return last_page;
}
-static int __write_node_page(struct page *page, bool atomic,
+static int __write_node_page(struct page *page, bool atomic, bool *submitted,
struct writeback_control *wbc)
{
struct f2fs_sb_info *sbi = F2FS_P_SB(page);
@@ -1331,6 +1331,7 @@ static int __write_node_page(struct page *page, bool atomic,
.op_flags = wbc_to_write_flags(wbc),
.page = page,
.encrypted_page = NULL,
+ .submitted = false,
};
trace_f2fs_writepage(page, NODE);
@@ -1372,13 +1373,19 @@ static int __write_node_page(struct page *page, bool atomic,
dec_page_count(sbi, F2FS_DIRTY_NODES);
up_read(&sbi->node_write);
- if (wbc->for_reclaim)
+ if (wbc->for_reclaim) {
f2fs_submit_merged_bio_cond(sbi, NULL, page, 0, NODE, WRITE);
+ submitted = NULL;
+ }
unlock_page(page);
- if (unlikely(f2fs_cp_error(sbi)))
+ if (unlikely(f2fs_cp_error(sbi))) {
f2fs_submit_merged_bio(sbi, NODE, WRITE);
+ submitted = NULL;
+ }
+ if (submitted)
+ *submitted = fio.submitted;
return 0;
@@ -1390,7 +1397,7 @@ redirty_out:
static int f2fs_write_node_page(struct page *page,
struct writeback_control *wbc)
{
- return __write_node_page(page, false, wbc);
+ return __write_node_page(page, false, NULL, wbc);
}
int fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,
@@ -1424,6 +1431,7 @@ retry:
for (i = 0; i < nr_pages; i++) {
struct page *page = pvec.pages[i];
+ bool submitted = false;
if (unlikely(f2fs_cp_error(sbi))) {
f2fs_put_page(last_page, 0);
@@ -1473,12 +1481,13 @@ continue_unlock:
goto continue_unlock;
ret = __write_node_page(page, atomic &&
- page == last_page, wbc);
+ page == last_page,
+ &submitted, wbc);
if (ret) {
unlock_page(page);
f2fs_put_page(last_page, 0);
break;
- } else {
+ } else if (submitted) {
nwritten++;
}
@@ -1534,6 +1543,7 @@ next_step:
for (i = 0; i < nr_pages; i++) {
struct page *page = pvec.pages[i];
+ bool submitted = false;
if (unlikely(f2fs_cp_error(sbi))) {
pagevec_release(&pvec);
@@ -1587,9 +1597,10 @@ continue_unlock:
set_fsync_mark(page, 0);
set_dentry_mark(page, 0);
- if (NODE_MAPPING(sbi)->a_ops->writepage(page, wbc))
+ ret = __write_node_page(page, false, &submitted, wbc);
+ if (ret)
unlock_page(page);
- else
+ else if (submitted)
nwritten++;
if (--wbc->nr_to_write == 0)