mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-25 02:09:42 +00:00
f2fs: skip ->writepages for {mete,node}_inode during recovery
Skip ->writepages in prior to ->writepage for {meta,node}_inode during recovery, hence unneeded loop in ->writepages can be avoided. Moreover, check SBI_POR_DOING earlier while writebacking pages. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
6915ea9d8d
commit
0771fcc71c
3 changed files with 13 additions and 6 deletions
|
@ -269,6 +269,9 @@ static int f2fs_write_meta_pages(struct address_space *mapping,
|
||||||
struct f2fs_sb_info *sbi = F2FS_M_SB(mapping);
|
struct f2fs_sb_info *sbi = F2FS_M_SB(mapping);
|
||||||
long diff, written;
|
long diff, written;
|
||||||
|
|
||||||
|
if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
|
||||||
|
goto skip_write;
|
||||||
|
|
||||||
/* collect a number of dirty meta pages and write together */
|
/* collect a number of dirty meta pages and write together */
|
||||||
if (wbc->for_kupdate ||
|
if (wbc->for_kupdate ||
|
||||||
get_pages(sbi, F2FS_DIRTY_META) < nr_pages_to_skip(sbi, META))
|
get_pages(sbi, F2FS_DIRTY_META) < nr_pages_to_skip(sbi, META))
|
||||||
|
|
|
@ -1492,6 +1492,9 @@ static int __write_data_page(struct page *page, bool *submitted,
|
||||||
|
|
||||||
trace_f2fs_writepage(page, DATA);
|
trace_f2fs_writepage(page, DATA);
|
||||||
|
|
||||||
|
if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
|
||||||
|
goto redirty_out;
|
||||||
|
|
||||||
if (page->index < end_index)
|
if (page->index < end_index)
|
||||||
goto write;
|
goto write;
|
||||||
|
|
||||||
|
@ -1505,8 +1508,6 @@ static int __write_data_page(struct page *page, bool *submitted,
|
||||||
|
|
||||||
zero_user_segment(page, offset, PAGE_SIZE);
|
zero_user_segment(page, offset, PAGE_SIZE);
|
||||||
write:
|
write:
|
||||||
if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
|
|
||||||
goto redirty_out;
|
|
||||||
if (f2fs_is_drop_cache(inode))
|
if (f2fs_is_drop_cache(inode))
|
||||||
goto out;
|
goto out;
|
||||||
/* we should not write 0'th page having journal header */
|
/* we should not write 0'th page having journal header */
|
||||||
|
@ -1754,6 +1755,10 @@ static int f2fs_write_data_pages(struct address_space *mapping,
|
||||||
if (!get_dirty_pages(inode) && wbc->sync_mode == WB_SYNC_NONE)
|
if (!get_dirty_pages(inode) && wbc->sync_mode == WB_SYNC_NONE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* during POR, we don't need to trigger writepage at all. */
|
||||||
|
if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
|
||||||
|
goto skip_write;
|
||||||
|
|
||||||
if (S_ISDIR(inode->i_mode) && wbc->sync_mode == WB_SYNC_NONE &&
|
if (S_ISDIR(inode->i_mode) && wbc->sync_mode == WB_SYNC_NONE &&
|
||||||
get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
|
get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
|
||||||
available_free_memory(sbi, DIRTY_DENTS))
|
available_free_memory(sbi, DIRTY_DENTS))
|
||||||
|
@ -1763,10 +1768,6 @@ static int f2fs_write_data_pages(struct address_space *mapping,
|
||||||
if (is_inode_flag_set(inode, FI_DO_DEFRAG))
|
if (is_inode_flag_set(inode, FI_DO_DEFRAG))
|
||||||
goto skip_write;
|
goto skip_write;
|
||||||
|
|
||||||
/* during POR, we don't need to trigger writepage at all. */
|
|
||||||
if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
|
|
||||||
goto skip_write;
|
|
||||||
|
|
||||||
trace_f2fs_writepages(mapping->host, wbc, DATA);
|
trace_f2fs_writepages(mapping->host, wbc, DATA);
|
||||||
|
|
||||||
/* to avoid spliting IOs due to mixed WB_SYNC_ALL and WB_SYNC_NONE */
|
/* to avoid spliting IOs due to mixed WB_SYNC_ALL and WB_SYNC_NONE */
|
||||||
|
|
|
@ -1687,6 +1687,9 @@ static int f2fs_write_node_pages(struct address_space *mapping,
|
||||||
struct blk_plug plug;
|
struct blk_plug plug;
|
||||||
long diff;
|
long diff;
|
||||||
|
|
||||||
|
if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
|
||||||
|
goto skip_write;
|
||||||
|
|
||||||
/* balancing f2fs's metadata in background */
|
/* balancing f2fs's metadata in background */
|
||||||
f2fs_balance_fs_bg(sbi);
|
f2fs_balance_fs_bg(sbi);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue