Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <heyunlei@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

authored by

Yunlei He and committed by
Jaegeuk Kim
b7b7c4cf bd80a4b9

+10 -1
+10 -1
fs/f2fs/gc.c
··· 258 258 valid_blocks * 2 : valid_blocks; 259 259 } 260 260 261 + static unsigned int get_ssr_cost(struct f2fs_sb_info *sbi, 262 + unsigned int segno) 263 + { 264 + struct seg_entry *se = get_seg_entry(sbi, segno); 265 + 266 + return se->ckpt_valid_blocks > se->valid_blocks ? 267 + se->ckpt_valid_blocks : se->valid_blocks; 268 + } 269 + 261 270 static inline unsigned int get_gc_cost(struct f2fs_sb_info *sbi, 262 271 unsigned int segno, struct victim_sel_policy *p) 263 272 { 264 273 if (p->alloc_mode == SSR) 265 - return get_seg_entry(sbi, segno)->ckpt_valid_blocks; 274 + return get_ssr_cost(sbi, segno); 266 275 267 276 /* alloc_mode == LFS */ 268 277 if (p->gc_mode == GC_GREEDY)