diff options
author | Yunlei He <heyunlei@huawei.com> | 2017-05-17 17:22:51 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-05-23 21:07:17 -0700 |
commit | b7b7c4cf1c9ef0272a65f1480457cbfdadcda19d (patch) | |
tree | de3e550932495a5147608feddb97ca10d75ccb01 /fs/f2fs/gc.c | |
parent | bd80a4b9812c0d74ecfc0b1b14ca77732faa2259 (diff) | |
download | linux-b7b7c4cf1c9ef0272a65f1480457cbfdadcda19d.tar.gz linux-b7b7c4cf1c9ef0272a65f1480457cbfdadcda19d.tar.bz2 linux-b7b7c4cf1c9ef0272a65f1480457cbfdadcda19d.zip |
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>
Diffstat (limited to 'fs/f2fs/gc.c')
-rw-r--r-- | fs/f2fs/gc.c | 11 |
1 files changed, 10 insertions, 1 deletions
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) |