* [f2fs-dev] [PATCH v1] f2fs: avoid victim selection from previous victim section [not found] <CGME20221102100756epcms2p23dfabe90c467313ce094c5c81a99c6d7@epcms2p4> @ 2022-11-22 2:36 ` Yonggil Song 2022-11-22 8:01 ` Chao Yu [not found] ` <CGME20221102100756epcms2p23dfabe90c467313ce094c5c81a99c6d7@epcms2p5> 0 siblings, 2 replies; 5+ messages in thread From: Yonggil Song @ 2022-11-22 2:36 UTC (permalink / raw) To: jaegeuk@kernel.org, chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org 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@samsung.com> --- fs/f2fs/gc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 4546e01b2ee0..10677d53ef0e 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1744,8 +1744,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); } -- 2.34.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [f2fs-dev] [PATCH v1] f2fs: avoid victim selection from previous victim section 2022-11-22 2:36 ` [f2fs-dev] [PATCH v1] f2fs: avoid victim selection from previous victim section Yonggil Song @ 2022-11-22 8:01 ` Chao Yu [not found] ` <CGME20221102100756epcms2p23dfabe90c467313ce094c5c81a99c6d7@epcms2p5> 1 sibling, 0 replies; 5+ messages in thread From: Chao Yu @ 2022-11-22 8:01 UTC (permalink / raw) To: yonggil.song, jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Hi Yonggil, I guess your email client forces converting tab and space characters of patch, please check that. On 2022/11/22 10:36, Yonggil Song wrote: > 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") Good catch, I'm fine with this fix. Thanks, > Signed-off-by: Yonggil Song <yonggil.song@samsung.com> > --- > fs/f2fs/gc.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c > index 4546e01b2ee0..10677d53ef0e 100644 > --- a/fs/f2fs/gc.c > +++ b/fs/f2fs/gc.c > @@ -1744,8 +1744,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); > } > -- > 2.34.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <CGME20221102100756epcms2p23dfabe90c467313ce094c5c81a99c6d7@epcms2p5>]
* Re: [f2fs-dev] (2) [PATCH v1] f2fs: avoid victim selection from previous victim section [not found] ` <CGME20221102100756epcms2p23dfabe90c467313ce094c5c81a99c6d7@epcms2p5> @ 2022-11-22 8:56 ` Yonggil Song 0 siblings, 0 replies; 5+ messages in thread From: Yonggil Song @ 2022-11-22 8:56 UTC (permalink / raw) To: Chao Yu, jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Hi Chao, Thanks for your review. I'll fix this and resend a mail. Thanks >Hi Yonggil, > >I guess your email client forces converting tab and space characters of >patch, please check that. > >On 2022/11/22 10:36, Yonggil Song wrote: >> 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") > >Good catch, I'm fine with this fix. > >Thanks, > >> Signed-off-by: Yonggil Song <yonggil.song@samsung.com> >> --- >> fs/f2fs/gc.c | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c >> index 4546e01b2ee0..10677d53ef0e 100644 >> --- a/fs/f2fs/gc.c >> +++ b/fs/f2fs/gc.c >> @@ -1744,8 +1744,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); >> } >> -- >> 2.34.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <CGME20221102100756epcms2p23dfabe90c467313ce094c5c81a99c6d7@epcms2p7>]
* [f2fs-dev] [PATCH v1] f2fs: avoid victim selection from previous victim section [not found] <CGME20221102100756epcms2p23dfabe90c467313ce094c5c81a99c6d7@epcms2p7> @ 2022-11-15 0:45 ` Yonggil Song 0 siblings, 0 replies; 5+ messages in thread From: Yonggil Song @ 2022-11-15 0:45 UTC (permalink / raw) To: jaegeuk@kernel.org, chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org 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. Signed-off-by: Yonggil Song <yonggil.song@samsung.com> --- fs/f2fs/gc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 4546e01b2ee0..10677d53ef0e 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1744,8 +1744,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); } -- 2.34.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <CGME20221102100756epcms2p23dfabe90c467313ce094c5c81a99c6d7@epcms2p2>]
* [f2fs-dev] [PATCH v1] f2fs: avoid victim selection from previous victim section [not found] <CGME20221102100756epcms2p23dfabe90c467313ce094c5c81a99c6d7@epcms2p2> @ 2022-11-02 10:07 ` Yonggil Song 0 siblings, 0 replies; 5+ messages in thread From: Yonggil Song @ 2022-11-02 10:07 UTC (permalink / raw) To: jaegeuk@kernel.org, chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Cc: Seokhwan Kim 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. Signed-off-by: Yonggil Song <yonggil.song@samsung.com> --- fs/f2fs/gc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 4546e01b2ee0..10677d53ef0e 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1744,8 +1744,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); } -- 2.34.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-11-22 8:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20221102100756epcms2p23dfabe90c467313ce094c5c81a99c6d7@epcms2p4>
2022-11-22 2:36 ` [f2fs-dev] [PATCH v1] f2fs: avoid victim selection from previous victim section Yonggil Song
2022-11-22 8:01 ` Chao Yu
[not found] ` <CGME20221102100756epcms2p23dfabe90c467313ce094c5c81a99c6d7@epcms2p5>
2022-11-22 8:56 ` [f2fs-dev] (2) " Yonggil Song
[not found] <CGME20221102100756epcms2p23dfabe90c467313ce094c5c81a99c6d7@epcms2p7>
2022-11-15 0:45 ` [f2fs-dev] " Yonggil Song
[not found] <CGME20221102100756epcms2p23dfabe90c467313ce094c5c81a99c6d7@epcms2p2>
2022-11-02 10:07 ` Yonggil Song
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).