All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] f2fs fg_gc: node segment is prior to data segment selected victim
@ 2017-02-22 10:28 Hou Pengyang
  2017-02-22 10:29 ` [PATCH 2/2] f2fs:use fggc_set_cold_data instead of set_cold_data in fggc Hou Pengyang
  2017-02-24  2:03 ` [PATCH 1/2] f2fs fg_gc: node segment is prior to data segment selected victim Chao Yu
  0 siblings, 2 replies; 8+ messages in thread
From: Hou Pengyang @ 2017-02-22 10:28 UTC (permalink / raw)
  To: jaegeuk, yuchao0; +Cc: linux-f2fs-devel

As data segment gc may lead dnode dirty, so the greedy cost for data segment should be
valid blocks * 2, that is data segment is prior to node segment.

Team:OTHERS
Feature or Bugfix:Bugfix
Binary Source:No

Signed-off-by: Hou Pengyang <houpengyang@huawei.com>
---
 fs/f2fs/gc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index e93aecb..4ee749f 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -242,6 +242,13 @@ static unsigned int get_cb_cost(struct f2fs_sb_info *sbi, unsigned int segno)
 	return UINT_MAX - ((100 * (100 - u) * age) / (100 + u));
 }
 
+static unsigned int get_greedy_cost(struct f2fs_sb_info *sbi, unsigned int segno)
+{
+	unsigned int valid_blocks = get_valid_blocks(sbi, segno, sbi->segs_per_sec);
+	return IS_DATASEG(get_seg_entry(sbi, segno)->type) ?
+			valid_blocks * 2 : valid_blocks;
+}
+
 static inline unsigned int get_gc_cost(struct f2fs_sb_info *sbi,
 			unsigned int segno, struct victim_sel_policy *p)
 {
@@ -250,7 +257,7 @@ static inline unsigned int get_gc_cost(struct f2fs_sb_info *sbi,
 
 	/* alloc_mode == LFS */
 	if (p->gc_mode == GC_GREEDY)
-		return get_valid_blocks(sbi, segno, sbi->segs_per_sec);
+		return get_greedy_cost(sbi, segno);
 	else
 		return get_cb_cost(sbi, segno);
 }
-- 
2.10.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

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

end of thread, other threads:[~2017-02-24  3:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-22 10:28 [PATCH 1/2] f2fs fg_gc: node segment is prior to data segment selected victim Hou Pengyang
2017-02-22 10:29 ` [PATCH 2/2] f2fs:use fggc_set_cold_data instead of set_cold_data in fggc Hou Pengyang
2017-02-23  0:39   ` Jaegeuk Kim
2017-02-23  2:04     ` Hou Pengyang
2017-02-23  2:14       ` Jaegeuk Kim
2017-02-24  2:07       ` Chao Yu
2017-02-24  3:04         ` Hou Pengyang
2017-02-24  2:03 ` [PATCH 1/2] f2fs fg_gc: node segment is prior to data segment selected victim Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.