linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: fix to correct freed section number during gc
@ 2015-09-22 13:18 Chao Yu
  2015-09-22 22:53 ` Jaegeuk Kim
  0 siblings, 1 reply; 5+ messages in thread
From: Chao Yu @ 2015-09-22 13:18 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-f2fs-devel, linux-kernel

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.

Signed-off-by: Chao Yu <chao2.yu@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 e932740..7ad2a60 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -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)
-- 
2.5.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-25 12:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-22 13:18 [PATCH] f2fs: fix to correct freed section number during gc Chao Yu
2015-09-22 22:53 ` Jaegeuk Kim
2015-09-23 10:11   ` Chao Yu
2015-09-23 21:08     ` Jaegeuk Kim
2015-09-25 12:43       ` Chao Yu

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).