When no dirty colde segment for fggc ssr, we do NOT set_cold_data.
Signed-off-by: Hou Pengyang <[email protected]>
---
fs/f2fs/gc.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 4ee749f..a0eed23 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -666,6 +666,25 @@ static void move_encrypted_block(struct inode *inode,
block_t bidx,
f2fs_put_page(page, 1);
}
+/*
+ * If NOT enough dirty cold data segments for fggc, fggc would consume
+ * a valuable free segment, which would slow down the fggc procedure,
+ * If there are NO COLD dirty segment, we do not set_cold_page.
+ */
+static void fggc_set_cold_data(struct page *page)
+{
+ struct f2fs_sb_info *sbi = F2FS_P_SB(page);
+ struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
+ int nr_cold_dirties;
+
+ mutex_lock(&dirty_i->seglist_lock);
+ nr_cold_dirties = dirty_i->nr_dirty[DIRTY_COLD_DATA];
+ mutex_unlock(&dirty_i->seglist_lock);
+
+ if (nr_cold_dirties)
+ set_cold_data(page);
+
+}
static void move_data_page(struct inode *inode, block_t bidx, int gc_type,
unsigned int segno, int
off)
{
@@ -706,7 +725,7 @@ static void move_data_page(struct inode *inode, block_t
bidx, int gc_type,
remove_dirty_inode(inode);
}
- set_cold_data(page);
+ fggc_set_cold_data(page);
err = do_write_data_page(&fio);
if (err == -ENOMEM && is_dirty) {
--
2.10.1
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel