summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2017-09-09 11:11:04 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2017-09-11 17:22:18 -0700
commitb3a97a2a9a7b2d50bcf13d32857cd6f5695c6b65 (patch)
treed95e581f355bde321e2e05e4f6188ab8b596b555 /fs
parent1eb1ef4a8e9f6a4d9c2c7a645aba21d2f8719728 (diff)
downloadop-kernel-dev-b3a97a2a9a7b2d50bcf13d32857cd6f5695c6b65.zip
op-kernel-dev-b3a97a2a9a7b2d50bcf13d32857cd6f5695c6b65.tar.gz
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')
-rw-r--r--fs/f2fs/f2fs.h1
-rw-r--r--fs/f2fs/segment.c15
-rw-r--r--fs/f2fs/segment.h13
3 files changed, 16 insertions, 13 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index c0803b1..9a7c903 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -2511,6 +2511,7 @@ void destroy_node_manager_caches(void);
/*
* segment.c
*/
+bool need_SSR(struct f2fs_sb_info *sbi);
void register_inmem_page(struct inode *inode, struct page *page);
void drop_inmem_pages(struct inode *inode);
void drop_inmem_page(struct inode *inode, struct page *page);
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 273cc64..7fd742f 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);
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 613b2fa..e0a6cc2 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -497,19 +497,6 @@ static inline int reserved_sections(struct f2fs_sb_info *sbi)
return GET_SEC_FROM_SEG(sbi, (unsigned int)reserved_segments(sbi));
}
-static inline 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;
-
- return free_sections(sbi) <= (node_secs + 2 * dent_secs + imeta_secs +
- 2 * reserved_sections(sbi));
-}
-
static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi,
int freed, int needed)
{
OpenPOWER on IntegriCloud