summaryrefslogtreecommitdiff
path: root/fs/f2fs/node.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2015-09-12 11:13:04 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2015-10-09 16:20:49 -0700
commit25b93346a6b5542fd7de50555f8f0ddfc56d7443 (patch)
tree01cb0813706831d37dded966aff55664fd017791 /fs/f2fs/node.c
parent538e17e7e96e14f76bb82dd83290a5315da70c3b (diff)
downloadlwn-25b93346a6b5542fd7de50555f8f0ddfc56d7443.tar.gz
lwn-25b93346a6b5542fd7de50555f8f0ddfc56d7443.zip
f2fs: cover number of dirty node pages under node_write lock
This number is referenced by checkpoint under node_write lock. Reviewed-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r--fs/f2fs/node.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 27d1a74dd6f3..4d9bedfe101c 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1323,23 +1323,24 @@ static int f2fs_write_node_page(struct page *page,
nid = nid_of_node(page);
f2fs_bug_on(sbi, page->index != nid);
+ if (wbc->for_reclaim) {
+ if (!down_read_trylock(&sbi->node_write))
+ goto redirty_out;
+ } else {
+ down_read(&sbi->node_write);
+ }
+
get_node_info(sbi, nid, &ni);
/* This page is already truncated */
if (unlikely(ni.blk_addr == NULL_ADDR)) {
ClearPageUptodate(page);
dec_page_count(sbi, F2FS_DIRTY_NODES);
+ up_read(&sbi->node_write);
unlock_page(page);
return 0;
}
- if (wbc->for_reclaim) {
- if (!down_read_trylock(&sbi->node_write))
- goto redirty_out;
- } else {
- down_read(&sbi->node_write);
- }
-
set_page_writeback(page);
fio.blk_addr = ni.blk_addr;
write_node_page(nid, &fio);