From 79e588108096a666e2502174af7dc949cab18426 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Tue, 13 Jun 2023 13:35:31 -0700 Subject: [PATCH] f2fs: do not issue small discard commands during checkpoint If there're huge # of small discards, this will increase checkpoint latency insanely. Let's issue small discards only by trim. Signed-off-by: Jaegeuk Kim --- fs/f2fs/segment.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index f7b18ed402b9..e9dc44e87552 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -2181,7 +2181,7 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi, } mutex_unlock(&dirty_i->seglist_lock); - if (!f2fs_block_unit_discard(sbi)) + if (!f2fs_block_unit_discard(sbi) || !force) goto wakeup; /* send small discards */ @@ -2195,8 +2195,7 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi, sbi->blocks_per_seg, cur_pos); len = next_pos - cur_pos; - if (f2fs_sb_has_blkzoned(sbi) || - (force && len < cpc->trim_minlen)) + if (f2fs_sb_has_blkzoned(sbi) || len < cpc->trim_minlen) goto skip; f2fs_issue_discard(sbi, entry->start_blkaddr + cur_pos,