diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-02-04 23:19:28 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-02-11 17:15:02 -0500 |
commit | b7250d2d845822466356f7f22a650bf807090d7e (patch) | |
tree | e7574602a3f4b6f3000f5165e15d113534843a8a /fs/f2fs | |
parent | 437275272f9e635673f065300e5d95226a25cb06 (diff) |
f2fs: fix calculation of max. gc cost in the SSR case
In the SSR case, the max gc cost should be the number of pages in a segment.
Otherwise, f2fs is able to fail getting dirty segments frequently for SSR.
In get_victim_by_default() previously,
while(1) {
...
cost = get_gc_cost(); <- cost is between 0 ~ 512.
...
if (cost == get_max_cost(sbi, &p)) <- max cost is UINT_MAX due to GC_CB type
continue;
if (nsearched++ >= MAX_VICTIM_SEARCH)
break;
}
So, if there are a number of fully valid segments in series, f2fs cannot skip
those segments by comparing the cost and max cost of each segment.
Note that, the cost is the number of valid blocks at the time of the last
checkpoint.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/gc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 52d3a391b922..94b8a0c48453 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c | |||
@@ -146,6 +146,9 @@ static void select_policy(struct f2fs_sb_info *sbi, int gc_type, | |||
146 | static unsigned int get_max_cost(struct f2fs_sb_info *sbi, | 146 | static unsigned int get_max_cost(struct f2fs_sb_info *sbi, |
147 | struct victim_sel_policy *p) | 147 | struct victim_sel_policy *p) |
148 | { | 148 | { |
149 | /* SSR allocates in a segment unit */ | ||
150 | if (p->alloc_mode == SSR) | ||
151 | return 1 << sbi->log_blocks_per_seg; | ||
149 | if (p->gc_mode == GC_GREEDY) | 152 | if (p->gc_mode == GC_GREEDY) |
150 | return (1 << sbi->log_blocks_per_seg) * p->ofs_unit; | 153 | return (1 << sbi->log_blocks_per_seg) * p->ofs_unit; |
151 | else if (p->gc_mode == GC_CB) | 154 | else if (p->gc_mode == GC_CB) |