f2fs: remove wbc->for_reclaim handling
Since commits7ff0104a80("f2fs: Remove f2fs_write_node_page()") and3b47398d98("f2fs: Remove f2fs_write_meta_page()'), f2fs can't be called from reclaim context any more. Remove all code keyed of the wbc->for_reclaim flag, which is now only set for writing out swap or shmem pages inside the swap code, but never passed to file systems. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
committed by
Jaegeuk Kim
parent
39122e4544
commit
402dd9f02c
+2
-12
@@ -359,15 +359,10 @@ static bool __f2fs_write_meta_folio(struct folio *folio,
|
||||
}
|
||||
if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
|
||||
goto redirty_out;
|
||||
if (wbc->for_reclaim && folio->index < GET_SUM_BLOCK(sbi, 0))
|
||||
goto redirty_out;
|
||||
|
||||
f2fs_do_write_meta_page(sbi, folio, io_type);
|
||||
dec_page_count(sbi, F2FS_DIRTY_META);
|
||||
|
||||
if (wbc->for_reclaim)
|
||||
f2fs_submit_merged_write_cond(sbi, NULL, &folio->page, 0, META);
|
||||
|
||||
folio_unlock(folio);
|
||||
|
||||
if (unlikely(f2fs_cp_error(sbi)))
|
||||
@@ -420,9 +415,7 @@ long f2fs_sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type,
|
||||
struct folio_batch fbatch;
|
||||
long nwritten = 0;
|
||||
int nr_folios;
|
||||
struct writeback_control wbc = {
|
||||
.for_reclaim = 0,
|
||||
};
|
||||
struct writeback_control wbc = {};
|
||||
struct blk_plug plug;
|
||||
|
||||
folio_batch_init(&fbatch);
|
||||
@@ -1215,7 +1208,6 @@ static int block_operations(struct f2fs_sb_info *sbi)
|
||||
struct writeback_control wbc = {
|
||||
.sync_mode = WB_SYNC_ALL,
|
||||
.nr_to_write = LONG_MAX,
|
||||
.for_reclaim = 0,
|
||||
};
|
||||
int err = 0, cnt = 0;
|
||||
|
||||
@@ -1399,9 +1391,7 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)
|
||||
static void commit_checkpoint(struct f2fs_sb_info *sbi,
|
||||
void *src, block_t blk_addr)
|
||||
{
|
||||
struct writeback_control wbc = {
|
||||
.for_reclaim = 0,
|
||||
};
|
||||
struct writeback_control wbc = {};
|
||||
|
||||
/*
|
||||
* filemap_get_folios_tag and folio_lock again will take
|
||||
|
||||
+2
-15
@@ -2856,13 +2856,7 @@ write:
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!wbc->for_reclaim)
|
||||
need_balance_fs = true;
|
||||
else if (has_not_enough_free_secs(sbi, 0, 0))
|
||||
goto redirty_out;
|
||||
else
|
||||
set_inode_flag(inode, FI_HOT_DATA);
|
||||
|
||||
need_balance_fs = true;
|
||||
err = -EAGAIN;
|
||||
if (f2fs_has_inline_data(inode)) {
|
||||
err = f2fs_write_inline_data(inode, folio);
|
||||
@@ -2898,13 +2892,6 @@ out:
|
||||
folio_clear_uptodate(folio);
|
||||
clear_page_private_gcing(page);
|
||||
}
|
||||
|
||||
if (wbc->for_reclaim) {
|
||||
f2fs_submit_merged_write_cond(sbi, NULL, page, 0, DATA);
|
||||
clear_inode_flag(inode, FI_HOT_DATA);
|
||||
f2fs_remove_dirty_inode(inode);
|
||||
submitted = NULL;
|
||||
}
|
||||
folio_unlock(folio);
|
||||
if (!S_ISDIR(inode->i_mode) && !IS_NOQUOTA(inode) &&
|
||||
!F2FS_I(inode)->wb_task && allow_balance)
|
||||
@@ -2930,7 +2917,7 @@ redirty_out:
|
||||
* file_write_and_wait_range() will see EIO error, which is critical
|
||||
* to return value of fsync() followed by atomic_write failure to user.
|
||||
*/
|
||||
if (!err || wbc->for_reclaim)
|
||||
if (!err)
|
||||
return AOP_WRITEPAGE_ACTIVATE;
|
||||
folio_unlock(folio);
|
||||
return err;
|
||||
|
||||
@@ -261,7 +261,6 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
|
||||
struct writeback_control wbc = {
|
||||
.sync_mode = WB_SYNC_ALL,
|
||||
.nr_to_write = LONG_MAX,
|
||||
.for_reclaim = 0,
|
||||
};
|
||||
unsigned int seq_id = 0;
|
||||
|
||||
|
||||
+1
-12
@@ -1699,12 +1699,7 @@ static int __write_node_folio(struct folio *folio, bool atomic, bool *submitted,
|
||||
if (f2fs_get_node_info(sbi, nid, &ni, !do_balance))
|
||||
goto redirty_out;
|
||||
|
||||
if (wbc->for_reclaim) {
|
||||
if (!f2fs_down_read_trylock(&sbi->node_write))
|
||||
goto redirty_out;
|
||||
} else {
|
||||
f2fs_down_read(&sbi->node_write);
|
||||
}
|
||||
f2fs_down_read(&sbi->node_write);
|
||||
|
||||
/* This page is already truncated */
|
||||
if (unlikely(ni.blk_addr == NULL_ADDR)) {
|
||||
@@ -1740,11 +1735,6 @@ static int __write_node_folio(struct folio *folio, bool atomic, bool *submitted,
|
||||
dec_page_count(sbi, F2FS_DIRTY_NODES);
|
||||
f2fs_up_read(&sbi->node_write);
|
||||
|
||||
if (wbc->for_reclaim) {
|
||||
f2fs_submit_merged_write_cond(sbi, NULL, &folio->page, 0, NODE);
|
||||
submitted = NULL;
|
||||
}
|
||||
|
||||
folio_unlock(folio);
|
||||
|
||||
if (unlikely(f2fs_cp_error(sbi))) {
|
||||
@@ -1771,7 +1761,6 @@ int f2fs_move_node_folio(struct folio *node_folio, int gc_type)
|
||||
struct writeback_control wbc = {
|
||||
.sync_mode = WB_SYNC_ALL,
|
||||
.nr_to_write = 1,
|
||||
.for_reclaim = 0,
|
||||
};
|
||||
|
||||
f2fs_folio_wait_writeback(node_folio, NODE, true, true);
|
||||
|
||||
@@ -1472,7 +1472,6 @@ TRACE_EVENT(f2fs_writepages,
|
||||
__field(char, for_kupdate)
|
||||
__field(char, for_background)
|
||||
__field(char, tagged_writepages)
|
||||
__field(char, for_reclaim)
|
||||
__field(char, range_cyclic)
|
||||
__field(char, for_sync)
|
||||
),
|
||||
@@ -1491,14 +1490,13 @@ TRACE_EVENT(f2fs_writepages,
|
||||
__entry->for_kupdate = wbc->for_kupdate;
|
||||
__entry->for_background = wbc->for_background;
|
||||
__entry->tagged_writepages = wbc->tagged_writepages;
|
||||
__entry->for_reclaim = wbc->for_reclaim;
|
||||
__entry->range_cyclic = wbc->range_cyclic;
|
||||
__entry->for_sync = wbc->for_sync;
|
||||
),
|
||||
|
||||
TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
|
||||
"skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
|
||||
"kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
|
||||
"kupdate %u background %u tagged %u cyclic %u sync %u",
|
||||
show_dev_ino(__entry),
|
||||
show_block_type(__entry->type),
|
||||
show_file_type(__entry->dir),
|
||||
@@ -1511,7 +1509,6 @@ TRACE_EVENT(f2fs_writepages,
|
||||
__entry->for_kupdate,
|
||||
__entry->for_background,
|
||||
__entry->tagged_writepages,
|
||||
__entry->for_reclaim,
|
||||
__entry->range_cyclic,
|
||||
__entry->for_sync)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user