diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-09-09 20:11:04 +0200 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-09-12 02:22:18 +0200 |
commit | b3a97a2a9a7b2d50bcf13d32857cd6f5695c6b65 (patch) | |
tree | d95e581f355bde321e2e05e4f6188ab8b596b555 /fs/f2fs/segment.c | |
parent | f2fs: better to wait for fstrim completion (diff) | |
download | linux-b3a97a2a9a7b2d50bcf13d32857cd6f5695c6b65.tar.xz linux-b3a97a2a9a7b2d50bcf13d32857cd6f5695c6b65.zip |
f2fs: speed up gc_urgent mode with SSR
This patch activates SSR in gc_urgent mode.
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r-- | fs/f2fs/segment.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 273cc645e502..7fd742f747ce 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -169,6 +169,21 @@ found: return result - size + __reverse_ffz(tmp); } +bool need_SSR(struct f2fs_sb_info *sbi) +{ + int node_secs = get_blocktype_secs(sbi, F2FS_DIRTY_NODES); + int dent_secs = get_blocktype_secs(sbi, F2FS_DIRTY_DENTS); + int imeta_secs = get_blocktype_secs(sbi, F2FS_DIRTY_IMETA); + + if (test_opt(sbi, LFS)) + return false; + if (sbi->gc_thread && sbi->gc_thread->gc_urgent) + return true; + + return free_sections(sbi) <= (node_secs + 2 * dent_secs + imeta_secs + + 2 * reserved_sections(sbi)); +} + void register_inmem_page(struct inode *inode, struct page *page) { struct f2fs_inode_info *fi = F2FS_I(inode); |