Skip to content

Commit

Permalink
f2fs: do not issue small discard commands during checkpoint
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Jaegeuk Kim committed Jun 13, 2023
1 parent c8d32cb commit 79e5881
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions fs/f2fs/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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,
Expand Down

0 comments on commit 79e5881

Please sign in to comment.