diff options
author | Weichao Guo <guoweichao@oppo.com> | 2022-05-07 00:28:14 +0800 |
---|---|---|
committer | Daniel Rosenberg <drosen@google.com> | 2023-10-17 23:19:31 +0000 |
commit | 072016599dfcad47c6eb3a120088aaf99895f13b (patch) | |
tree | 13e5fb775f4f8f8b0a9a1941b04a12799a350946 | |
parent | 889326feb7e1ffd98880a80aa653d209feb877f7 (diff) | |
download | common-deprecated/android12-5.10-2023-06.tar.gz |
BACKPORT: f2fs: skip GC if possible when checkpoint disablingdeprecated/android12-5.10-2023-06
If the number of unusable blocks is not larger than
unusable capacity, we can skip GC when checkpoint
disabling.
Bug: 305802889
Bug: 278486610
Bug: 286324986
Bug: 287716684
Signed-off-by: Weichao Guo <guoweichao@oppo.com>
Signed-off-by: Chao Yu <chao@kernel.org>
[Jaegeuk Kim: Fix missing gc_mode assignment]
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 2880f47b949f1f49e2d861ffbba91d57416be7d9)
[ qixiaoyu1: Resolved minor conflict in fs/f2fs/super.c ]
Change-Id: Ic37debb3fbb9d863cb1b0f539cc992dd08ad9f77
(cherry picked from commit 97477d3fd827fe9b903a672088ac6cc27b0d7581)
-rw-r--r-- | fs/f2fs/super.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 2c77a2df34a6..268bdd61f2d0 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1995,6 +1995,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); while (!f2fs_time_over(sbi, DISABLE_TIME)) { @@ -2020,6 +2025,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); |