Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7b7c4cf authored by Yunlei He's avatar Yunlei He Committed by Jaegeuk Kim
Browse files

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: default avatarYunlei He <heyunlei@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent bd80a4b9
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -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)