mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-10 15:19:51 +00:00
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>
This commit is contained in:
parent
538e17e7e9
commit
25b93346a6
@ -1323,23 +1323,24 @@ static int f2fs_write_node_page(struct page *page,
|
|||||||
nid = nid_of_node(page);
|
nid = nid_of_node(page);
|
||||||
f2fs_bug_on(sbi, page->index != nid);
|
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);
|
get_node_info(sbi, nid, &ni);
|
||||||
|
|
||||||
/* This page is already truncated */
|
/* This page is already truncated */
|
||||||
if (unlikely(ni.blk_addr == NULL_ADDR)) {
|
if (unlikely(ni.blk_addr == NULL_ADDR)) {
|
||||||
ClearPageUptodate(page);
|
ClearPageUptodate(page);
|
||||||
dec_page_count(sbi, F2FS_DIRTY_NODES);
|
dec_page_count(sbi, F2FS_DIRTY_NODES);
|
||||||
|
up_read(&sbi->node_write);
|
||||||
unlock_page(page);
|
unlock_page(page);
|
||||||
return 0;
|
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);
|
set_page_writeback(page);
|
||||||
fio.blk_addr = ni.blk_addr;
|
fio.blk_addr = ni.blk_addr;
|
||||||
write_node_page(nid, &fio);
|
write_node_page(nid, &fio);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user