summaryrefslogtreecommitdiff
path: root/fs/f2fs/node.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2018-01-18 12:29:10 +0300
committerJaegeuk Kim <jaegeuk@kernel.org>2018-01-23 01:56:56 +0300
commitdb198ae0f823e13e3698b24049e741978a0f14e3 (patch)
tree875c3cc5b84372eea3e7b7bdb22b8c7f60f4ac8f /fs/f2fs/node.c
parent7950e9ac638e84518fbdd5c930939ad46a1068c5 (diff)
downloadlinux-db198ae0f823e13e3698b24049e741978a0f14e3.tar.xz
f2fs: drop page cache after fs shutdown
Don't remain dirtied page cache in f2fs after shutdown, it can mitigate memory pressure of whole system, in order to keep other modules working properly. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r--fs/f2fs/node.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index ea29314ca8a3..833b46b9de9f 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1340,10 +1340,14 @@ static int __write_node_page(struct page *page, bool atomic, bool *submitted,
trace_f2fs_writepage(page, NODE);
+ if (unlikely(f2fs_cp_error(sbi))) {
+ dec_page_count(sbi, F2FS_DIRTY_NODES);
+ unlock_page(page);
+ return 0;
+ }
+
if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
goto redirty_out;
- if (unlikely(f2fs_cp_error(sbi)))
- goto redirty_out;
/* get old block addr of this node page */
nid = nid_of_node(page);
@@ -1580,12 +1584,6 @@ next_step:
struct page *page = pvec.pages[i];
bool submitted = false;
- if (unlikely(f2fs_cp_error(sbi))) {
- pagevec_release(&pvec);
- ret = -EIO;
- goto out;
- }
-
/*
* flushing sequence with step:
* 0. indirect nodes
@@ -1655,9 +1653,12 @@ continue_unlock:
step++;
goto next_step;
}
-out:
+
if (nwritten)
f2fs_submit_merged_write(sbi, NODE);
+
+ if (unlikely(f2fs_cp_error(sbi)))
+ return -EIO;
return ret;
}