All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: skip GC if possible when checkpoint disabling
@ 2022-05-06 16:28 Weichao Guo
  2022-05-06 23:38 ` Jaegeuk Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Weichao Guo @ 2022-05-06 16:28 UTC (permalink / raw)
  To: jaegeuk, chao; +Cc: zhangshiming, linux-f2fs-devel

From: Weichao Guo <guoweichao@oppo.com>

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

Signed-off-by: Weichao Guo <guoweichao@oppo.com>
Signed-off-by: Chao Yu <chao@kernel.org>
---
 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
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: skip GC if possible when checkpoint disabling
  2022-05-06 16:28 [f2fs-dev] [PATCH] f2fs: skip GC if possible when checkpoint disabling Weichao Guo
@ 2022-05-06 23:38 ` Jaegeuk Kim
  2022-05-07  3:38   ` Chao Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Jaegeuk Kim @ 2022-05-06 23:38 UTC (permalink / raw)
  To: Weichao Guo; +Cc: zhangshiming, linux-f2fs-devel

On 05/07, Weichao Guo wrote:
> From: Weichao Guo <guoweichao@oppo.com>
> 
> If the number of unusable blocks is not larger than
> unusable capacity, we can skip GC when checkpoint
> disabling.

I modified to fix restoring gc_mode back by the below.

-       unsigned int gc_mode;
+       unsigned int gc_mode = sbi->gc_mode;


> 
> Signed-off-by: Weichao Guo <guoweichao@oppo.com>
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
>  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
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: skip GC if possible when checkpoint disabling
  2022-05-06 23:38 ` Jaegeuk Kim
@ 2022-05-07  3:38   ` Chao Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu @ 2022-05-07  3:38 UTC (permalink / raw)
  To: Jaegeuk Kim, Weichao Guo; +Cc: zhangshiming, linux-f2fs-devel

On 2022/5/7 7:38, Jaegeuk Kim wrote:
> On 05/07, Weichao Guo wrote:
>> From: Weichao Guo <guoweichao@oppo.com>
>>
>> If the number of unusable blocks is not larger than
>> unusable capacity, we can skip GC when checkpoint
>> disabling.
> 
> I modified to fix restoring gc_mode back by the below.
> 
> -       unsigned int gc_mode;
> +       unsigned int gc_mode = sbi->gc_mode;
> 
> 
>>
>> Signed-off-by: Weichao Guo <guoweichao@oppo.com>
>> Signed-off-by: Chao Yu <chao@kernel.org>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-07  3:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06 16:28 [f2fs-dev] [PATCH] f2fs: skip GC if possible when checkpoint disabling Weichao Guo
2022-05-06 23:38 ` Jaegeuk Kim
2022-05-07  3:38   ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.