Skip to content

Commit 402dd9f

Browse files
Christoph HellwigJaegeuk Kim
authored andcommitted
f2fs: remove wbc->for_reclaim handling
Since commits 7ff0104 ("f2fs: Remove f2fs_write_node_page()") and 3b47398 ("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>
1 parent 39122e4 commit 402dd9f

File tree

5 files changed

+6
-44
lines changed

5 files changed

+6
-44
lines changed

fs/f2fs/checkpoint.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -359,15 +359,10 @@ static bool __f2fs_write_meta_folio(struct folio *folio,
359359
}
360360
if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
361361
goto redirty_out;
362-
if (wbc->for_reclaim && folio->index < GET_SUM_BLOCK(sbi, 0))
363-
goto redirty_out;
364362

365363
f2fs_do_write_meta_page(sbi, folio, io_type);
366364
dec_page_count(sbi, F2FS_DIRTY_META);
367365

368-
if (wbc->for_reclaim)
369-
f2fs_submit_merged_write_cond(sbi, NULL, &folio->page, 0, META);
370-
371366
folio_unlock(folio);
372367

373368
if (unlikely(f2fs_cp_error(sbi)))
@@ -420,9 +415,7 @@ long f2fs_sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type,
420415
struct folio_batch fbatch;
421416
long nwritten = 0;
422417
int nr_folios;
423-
struct writeback_control wbc = {
424-
.for_reclaim = 0,
425-
};
418+
struct writeback_control wbc = {};
426419
struct blk_plug plug;
427420

428421
folio_batch_init(&fbatch);
@@ -1215,7 +1208,6 @@ static int block_operations(struct f2fs_sb_info *sbi)
12151208
struct writeback_control wbc = {
12161209
.sync_mode = WB_SYNC_ALL,
12171210
.nr_to_write = LONG_MAX,
1218-
.for_reclaim = 0,
12191211
};
12201212
int err = 0, cnt = 0;
12211213

@@ -1399,9 +1391,7 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)
13991391
static void commit_checkpoint(struct f2fs_sb_info *sbi,
14001392
void *src, block_t blk_addr)
14011393
{
1402-
struct writeback_control wbc = {
1403-
.for_reclaim = 0,
1404-
};
1394+
struct writeback_control wbc = {};
14051395

14061396
/*
14071397
* filemap_get_folios_tag and folio_lock again will take

fs/f2fs/data.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2856,13 +2856,7 @@ int f2fs_write_single_data_page(struct folio *folio, int *submitted,
28562856
goto done;
28572857
}
28582858

2859-
if (!wbc->for_reclaim)
2860-
need_balance_fs = true;
2861-
else if (has_not_enough_free_secs(sbi, 0, 0))
2862-
goto redirty_out;
2863-
else
2864-
set_inode_flag(inode, FI_HOT_DATA);
2865-
2859+
need_balance_fs = true;
28662860
err = -EAGAIN;
28672861
if (f2fs_has_inline_data(inode)) {
28682862
err = f2fs_write_inline_data(inode, folio);
@@ -2898,13 +2892,6 @@ int f2fs_write_single_data_page(struct folio *folio, int *submitted,
28982892
folio_clear_uptodate(folio);
28992893
clear_page_private_gcing(page);
29002894
}
2901-
2902-
if (wbc->for_reclaim) {
2903-
f2fs_submit_merged_write_cond(sbi, NULL, page, 0, DATA);
2904-
clear_inode_flag(inode, FI_HOT_DATA);
2905-
f2fs_remove_dirty_inode(inode);
2906-
submitted = NULL;
2907-
}
29082895
folio_unlock(folio);
29092896
if (!S_ISDIR(inode->i_mode) && !IS_NOQUOTA(inode) &&
29102897
!F2FS_I(inode)->wb_task && allow_balance)
@@ -2930,7 +2917,7 @@ int f2fs_write_single_data_page(struct folio *folio, int *submitted,
29302917
* file_write_and_wait_range() will see EIO error, which is critical
29312918
* to return value of fsync() followed by atomic_write failure to user.
29322919
*/
2933-
if (!err || wbc->for_reclaim)
2920+
if (!err)
29342921
return AOP_WRITEPAGE_ACTIVATE;
29352922
folio_unlock(folio);
29362923
return err;

fs/f2fs/file.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
261261
struct writeback_control wbc = {
262262
.sync_mode = WB_SYNC_ALL,
263263
.nr_to_write = LONG_MAX,
264-
.for_reclaim = 0,
265264
};
266265
unsigned int seq_id = 0;
267266

fs/f2fs/node.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,12 +1699,7 @@ static int __write_node_folio(struct folio *folio, bool atomic, bool *submitted,
16991699
if (f2fs_get_node_info(sbi, nid, &ni, !do_balance))
17001700
goto redirty_out;
17011701

1702-
if (wbc->for_reclaim) {
1703-
if (!f2fs_down_read_trylock(&sbi->node_write))
1704-
goto redirty_out;
1705-
} else {
1706-
f2fs_down_read(&sbi->node_write);
1707-
}
1702+
f2fs_down_read(&sbi->node_write);
17081703

17091704
/* This page is already truncated */
17101705
if (unlikely(ni.blk_addr == NULL_ADDR)) {
@@ -1740,11 +1735,6 @@ static int __write_node_folio(struct folio *folio, bool atomic, bool *submitted,
17401735
dec_page_count(sbi, F2FS_DIRTY_NODES);
17411736
f2fs_up_read(&sbi->node_write);
17421737

1743-
if (wbc->for_reclaim) {
1744-
f2fs_submit_merged_write_cond(sbi, NULL, &folio->page, 0, NODE);
1745-
submitted = NULL;
1746-
}
1747-
17481738
folio_unlock(folio);
17491739

17501740
if (unlikely(f2fs_cp_error(sbi))) {
@@ -1771,7 +1761,6 @@ int f2fs_move_node_folio(struct folio *node_folio, int gc_type)
17711761
struct writeback_control wbc = {
17721762
.sync_mode = WB_SYNC_ALL,
17731763
.nr_to_write = 1,
1774-
.for_reclaim = 0,
17751764
};
17761765

17771766
f2fs_folio_wait_writeback(node_folio, NODE, true, true);

include/trace/events/f2fs.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,6 @@ TRACE_EVENT(f2fs_writepages,
14721472
__field(char, for_kupdate)
14731473
__field(char, for_background)
14741474
__field(char, tagged_writepages)
1475-
__field(char, for_reclaim)
14761475
__field(char, range_cyclic)
14771476
__field(char, for_sync)
14781477
),
@@ -1491,14 +1490,13 @@ TRACE_EVENT(f2fs_writepages,
14911490
__entry->for_kupdate = wbc->for_kupdate;
14921491
__entry->for_background = wbc->for_background;
14931492
__entry->tagged_writepages = wbc->tagged_writepages;
1494-
__entry->for_reclaim = wbc->for_reclaim;
14951493
__entry->range_cyclic = wbc->range_cyclic;
14961494
__entry->for_sync = wbc->for_sync;
14971495
),
14981496

14991497
TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
15001498
"skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
1501-
"kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
1499+
"kupdate %u background %u tagged %u cyclic %u sync %u",
15021500
show_dev_ino(__entry),
15031501
show_block_type(__entry->type),
15041502
show_file_type(__entry->dir),
@@ -1511,7 +1509,6 @@ TRACE_EVENT(f2fs_writepages,
15111509
__entry->for_kupdate,
15121510
__entry->for_background,
15131511
__entry->tagged_writepages,
1514-
__entry->for_reclaim,
15151512
__entry->range_cyclic,
15161513
__entry->for_sync)
15171514
);

0 commit comments

Comments
 (0)