From: Weichao Guo <[email protected]>

If the number of unusable blocks is not larger than
unusable capacity, we can skip GC when checkpoint
disabling.

Signed-off-by: Weichao Guo <[email protected]>
Signed-off-by: Chao Yu <[email protected]>
---
 fs/f2fs/super.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index d06a577..7edb018 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -2069,6 +2069,11 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info 
*sbi)
        }
        sbi->sb->s_flags |= SB_ACTIVE;
 
+       /* check if we need more GC first */
+       unusable = f2fs_get_unusable_blocks(sbi);
+       if (!f2fs_disable_cp_again(sbi, unusable))
+               goto skip_gc;
+
        f2fs_update_time(sbi, DISABLE_TIME);
 
        gc_mode = sbi->gc_mode;
@@ -2097,6 +2102,7 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info 
*sbi)
                goto restore_flag;
        }
 
+skip_gc:
        f2fs_down_write(&sbi->gc_lock);
        cpc.reason = CP_PAUSE;
        set_sbi_flag(sbi, SBI_CP_DISABLED);
-- 
1.9.1



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to