diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 25d3cda9bd5a..05a342933f98 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -488,6 +488,11 @@ static inline void __set_test_and_free(struct f2fs_sb_info *sbi, free_i->free_sections++; + if (GET_SEC_FROM_SEG(sbi, sbi->next_victim_seg[BG_GC]) == secno) + sbi->next_victim_seg[BG_GC] = NULL_SEGNO; + if (GET_SEC_FROM_SEG(sbi, sbi->next_victim_seg[FG_GC]) == secno) + sbi->next_victim_seg[FG_GC] = NULL_SEGNO; + unlock_out: spin_unlock(&free_i->segmap_lock); }