]> www.infradead.org Git - users/dwmw2/linux.git/commit
f2fs: add ovp valid_blocks check for bg gc victim to fg_gc
authorHou Pengyang <houpengyang@huawei.com>
Thu, 16 Feb 2017 12:34:31 +0000 (12:34 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 12 Mar 2017 05:41:51 +0000 (06:41 +0100)
commit4992ba2840bd40a85887a1a0e5d69f688f58f9dd
tree027132e9e7e2d9753c03683391bf1b2c5e5be1f2
parentd00d1b71d98468ad6fbee590705c27fc1241f96e
f2fs: add ovp valid_blocks check for bg gc victim to fg_gc

commit e93b9865251a0503d83fd570e7d5a7c8bc351715 upstream.

For foreground gc, greedy algorithm should be adapted, which makes
this formula work well:

(2 * (100 / config.overprovision + 1) + 6)

But currently, we fg_gc have a prior to select bg_gc victim segments to gc
first, these victims are selected by cost-benefit algorithm, we can't guarantee
such segments have the small valid blocks, which may destroy the f2fs rule, on
the worstest case, would consume all the free segments.

This patch fix this by add a filter in check_bg_victims, if segment's has # of
valid blocks over overprovision ratio, skip such segments.

Signed-off-by: Hou Pengyang <houpengyang@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/f2fs/f2fs.h
fs/f2fs/gc.c
fs/f2fs/segment.h