forked from Minki/linux
f2fs: select target segment with closer temperature in SSR mode
In SSR mode, we can allocate target segment which has different temperature type from the type of current block, in order to avoid mixing coldest and hottest data/node as much as possible, change SSR allocation policy to select closer temperature for current block prior. Signed-off-by: Yunlong Song <yunlong.song@huawei.com> Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
55523519bc
commit
d27c3d89db
@ -1541,7 +1541,8 @@ static int get_ssr_segment(struct f2fs_sb_info *sbi, int type)
|
|||||||
{
|
{
|
||||||
struct curseg_info *curseg = CURSEG_I(sbi, type);
|
struct curseg_info *curseg = CURSEG_I(sbi, type);
|
||||||
const struct victim_selection *v_ops = DIRTY_I(sbi)->v_ops;
|
const struct victim_selection *v_ops = DIRTY_I(sbi)->v_ops;
|
||||||
int i, n;
|
int i, cnt;
|
||||||
|
bool reversed = false;
|
||||||
|
|
||||||
/* need_SSR() already forces to do this */
|
/* need_SSR() already forces to do this */
|
||||||
if (v_ops->get_victim(sbi, &(curseg)->next_segno, BG_GC, type, SSR))
|
if (v_ops->get_victim(sbi, &(curseg)->next_segno, BG_GC, type, SSR))
|
||||||
@ -1549,14 +1550,24 @@ static int get_ssr_segment(struct f2fs_sb_info *sbi, int type)
|
|||||||
|
|
||||||
/* For node segments, let's do SSR more intensively */
|
/* For node segments, let's do SSR more intensively */
|
||||||
if (IS_NODESEG(type)) {
|
if (IS_NODESEG(type)) {
|
||||||
i = CURSEG_HOT_NODE;
|
if (type >= CURSEG_WARM_NODE) {
|
||||||
n = CURSEG_COLD_NODE;
|
reversed = true;
|
||||||
|
i = CURSEG_COLD_NODE;
|
||||||
|
} else {
|
||||||
|
i = CURSEG_HOT_NODE;
|
||||||
|
}
|
||||||
|
cnt = NR_CURSEG_NODE_TYPE;
|
||||||
} else {
|
} else {
|
||||||
i = CURSEG_HOT_DATA;
|
if (type >= CURSEG_WARM_DATA) {
|
||||||
n = CURSEG_COLD_DATA;
|
reversed = true;
|
||||||
|
i = CURSEG_COLD_DATA;
|
||||||
|
} else {
|
||||||
|
i = CURSEG_HOT_DATA;
|
||||||
|
}
|
||||||
|
cnt = NR_CURSEG_DATA_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; i <= n; i++) {
|
for (; cnt-- > 0; reversed ? i-- : i++) {
|
||||||
if (i == type)
|
if (i == type)
|
||||||
continue;
|
continue;
|
||||||
if (v_ops->get_victim(sbi, &(curseg)->next_segno,
|
if (v_ops->get_victim(sbi, &(curseg)->next_segno,
|
||||||
|
Loading…
Reference in New Issue
Block a user