f2fs: fix to correct freed section number during gc
PATCH 1/1 f2fs: fix to correct freed section number during gc
We pass 'nfree' to has_not_enough_free_secs to check whether there is enough free section, but 'nfree' indicates the number of segment gced, should alter the value to section number.
--- fs/f2fs/gc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/f2fs/gc.c +3 -2
@@ -817,7 +817,8 @@ gc_more:if (unlikely (f2fs_cp_error (sbi))) goto stop; -if (gc_type ==BG_GC &&has_not_enough_free_secs (sbi, nfree)) { +if (gc_type ==BG_GC && +has_not_enough_free_secs (sbi, nfree / sbi->segs_per_sec)) { gc_type =FG_GC ;if (__get_victim (sbi, &segno, gc_type) ||prefree_segments (sbi))write_checkpoint (sbi, &cpc);
@@ -839,7 +840,7 @@ gc_more:if (gc_type ==FG_GC ) sbi->cur_victim_sec =NULL_SEGNO ; -if (has_not_enough_free_secs (sbi, nfree)) +if (has_not_enough_free_secs (sbi, nfree / sbi->segs_per_sec)) goto gc_more;if (gc_type ==FG_GC )
Signature · 1 line
2.5.2
Jaegeuk Kim
maintainerHi Chao,
Quoted 3 lines · Chao Yu
We pass 'nfree' to
has_not_enough_free_secsto check whether there is enough free section, but 'nfree' indicates the number of segment gced, should alter the value to section number.
Yeah, but I think we need to increase nfree only when an entire section is gced completely, since sometimes nfree can be increased across sections.
Thanks,
Quoted 31 lines
Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/gc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)fs/f2fs/gc.c +3
-2@@ -817,7 +817,8 @@ gc_more:if (unlikely (f2fs_cp_error (sbi))) goto stop; -if (gc_type ==BG_GC &&has_not_enough_free_secs (sbi, nfree)) { +if (gc_type ==BG_GC && +has_not_enough_free_secs (sbi, nfree / sbi->segs_per_sec)) { gc_type =FG_GC ;if (__get_victim (sbi, &segno, gc_type) ||prefree_segments (sbi))write_checkpoint (sbi, &cpc);@@ -839,7 +840,7 @@ gc_more:if (gc_type ==FG_GC ) sbi->cur_victim_sec =NULL_SEGNO ; -if (has_not_enough_free_secs (sbi, nfree)) +if (has_not_enough_free_secs (sbi, nfree / sbi->segs_per_sec)) goto gc_more;if (gc_type ==FG_GC )Signature · 1 line
2.5.2
Hi Jaegeuk,
Quoted 9 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Wednesday, September 23, 2015 6:54 AM
To: Chao Yu
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] f2fs: fix to correct freed section number during gcHi Chao,
Quoted 7 lines
Quoted 3 lines · Chao Yu
We pass 'nfree' to
has_not_enough_free_secsto check whether there is enough free section, but 'nfree' indicates the number of segment gced, should alter the value to section number.Yeah, but I think we need to increase nfree only when an entire section is gced completely, since sometimes nfree can be increased across sections.
Agree, I will fix that.
Still have one question, for foreground gc, why would we give up retry writing out pages of last victim, but trying to select another victim for cleanup? Will new introduced method cause long latency for caller than before?
Thanks,
Jaegeuk Kim
maintainerHi Chao,
Quoted 16 lines · Chao Yu
Hi Jaegeuk,
Quoted 14 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Wednesday, September 23, 2015 6:54 AM
To: Chao Yu
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] f2fs: fix to correct freed section number during gcHi Chao,
Quoted 3 lines · Chao Yu
We pass 'nfree' to
has_not_enough_free_secsto check whether there is enough free section, but 'nfree' indicates the number of segment gced, should alter the value to section number.
Quoted 8 lines
Quoted 2 lines
Yeah, but I think we need to increase nfree only when an entire section is gced completely, since sometimes nfree can be increased across sections.
Agree, I will fix that.
Still have one question, for foreground gc, why would we give up retry writing out pages of last victim, but trying to select another victim for cleanup? Will new introduced method cause long latency for caller than before?
Hmm. Very occasionally, I've seen that gc goes into an infinite loop to clean up one victim. In order to avoid that, I added giving up and then doing gc again. I think there is no problem in normal cases. Even in an abnormal case, I expect that next victim would be selected again because that should have lowest moving cost.
Quoted 2 lines
Thanks,
Hi Jaegeuk,
Quoted 30 lines · Jaegeuk Kim
Hi Chao,
Quoted 16 lines · Chao Yu
Hi Jaegeuk,
Quoted 14 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Wednesday, September 23, 2015 6:54 AM
To: Chao Yu
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] f2fs: fix to correct freed section number during gcHi Chao,
Quoted 3 lines · Chao Yu
We pass 'nfree' to
has_not_enough_free_secsto check whether there is enough free section, but 'nfree' indicates the number of segment gced, should alter the value to section number.Quoted 8 lines
Quoted 2 lines
Yeah, but I think we need to increase nfree only when an entire section is gced completely, since sometimes nfree can be increased across sections.
Agree, I will fix that.
Still have one question, for foreground gc, why would we give up retry writing out pages of last victim, but trying to select another victim for cleanup? Will new introduced method cause long latency for caller than before?
Quoted 5 lines
Hmm. Very occasionally, I've seen that gc goes into an infinite loop to clean up one victim. In order to avoid that, I added giving up and then doing gc again. I think there is no problem in normal cases. Even in an abnormal case, I expect that next victim would be selected again because that should have lowest moving cost.
Got it, thanks for your explanation! :)
I have sent the v2 patch, please help to review.
Thanks,
Quoted 14 lines
Quoted 3 lines
Thanks,
------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog! Get real-time metrics from all of your servers, apps and tools in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel