Patch "f2fs: avoid victim selection from previous victim section" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    f2fs: avoid victim selection from previous victim section

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     f2fs-avoid-victim-selection-from-previous-victim-sec.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit da90a60cef699e23103c1507d5e1ddf5e893097e
Author: Yonggil Song <yonggil.song@xxxxxxxxxxx>
Date:   Tue Nov 22 18:03:20 2022 +0900

    f2fs: avoid victim selection from previous victim section
    
    [ Upstream commit e219aecfd4b766c4e878a3769057e9809f7fcadc ]
    
    When f2fs chooses GC victim in large section & LFS mode,
    next_victim_seg[gc_type] is referenced first. After segment is freed,
    next_victim_seg[gc_type] has the next segment number.
    However, next_victim_seg[gc_type] still has the last segment number
    even after the last segment of section is freed. In this case, when f2fs
    chooses a victim for the next GC round, the last segment of previous victim
    section is chosen as a victim.
    
    Initialize next_victim_seg[gc_type] to NULL_SEGNO for the last segment in
    large section.
    
    Fixes: e3080b0120a1 ("f2fs: support subsectional garbage collection")
    Signed-off-by: Yonggil Song <yonggil.song@xxxxxxxxxxx>
    Reviewed-by: Chao Yu <chao@xxxxxxxxxx>
    Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 5ac0b605335f..89156568a4fb 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -1649,8 +1649,9 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi,
 				get_valid_blocks(sbi, segno, false) == 0)
 			seg_freed++;
 
-		if (__is_large_section(sbi) && segno + 1 < end_segno)
-			sbi->next_victim_seg[gc_type] = segno + 1;
+		if (__is_large_section(sbi))
+			sbi->next_victim_seg[gc_type] =
+				(segno + 1 < end_segno) ? segno + 1 : NULL_SEGNO;
 skip:
 		f2fs_put_page(sum_page, 0);
 	}



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux