From: Yunlei He Date: Wed, 17 May 2017 09:22:51 +0000 (+0800) Subject: f2fs: add a new function get_ssr_cost X-Git-Tag: MMI-PSA29.97-13-9~5194^2~48 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b7b7c4cf1c9ef0272a65f1480457cbfdadcda19d;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git f2fs: add a new function get_ssr_cost This patch add a new method get_ssr_cost to select SSR segment more accurately. Signed-off-by: Yunlei He Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 14c71ac76062..81392970fb2d 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -258,11 +258,20 @@ static unsigned int get_greedy_cost(struct f2fs_sb_info *sbi, valid_blocks * 2 : valid_blocks; } +static unsigned int get_ssr_cost(struct f2fs_sb_info *sbi, + unsigned int segno) +{ + struct seg_entry *se = get_seg_entry(sbi, segno); + + return se->ckpt_valid_blocks > se->valid_blocks ? + se->ckpt_valid_blocks : se->valid_blocks; +} + static inline unsigned int get_gc_cost(struct f2fs_sb_info *sbi, unsigned int segno, struct victim_sel_policy *p) { if (p->alloc_mode == SSR) - return get_seg_entry(sbi, segno)->ckpt_valid_blocks; + return get_ssr_cost(sbi, segno); /* alloc_mode == LFS */ if (p->gc_mode == GC_GREEDY)