f2fs: fix to clear unusable_cap for checkpoint=enable
Chao Yu
maintainerPATCH 1/1 f2fs: fix to clear unusable_cap for checkpoint=enable
mount -t f2fs -o checkpoint=disable:10% /dev/vdb /mnt/f2fs/ mount -t f2fs -o remount,checkpoint=enable /dev/vdb /mnt/f2fs/
kernel log:
F2FS-fs (vdb): Adjust unusable cap for checkpoint=disable = 204440 / 10%
If we has assigned checkpoint=enable mount option, unusable_cap{,_perc} parameters of checkpoint=disable should be reset, then calculation and log print could be avoid in adjust_unusable_cap_perc().
--- fs/f2fs/super.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/f2fs/super.c +4 -0
@@ -1014,6 +1014,10 @@ static int f2fs_parse_param(struct fs_context *fc, struct fs_parameter *param)ctx_set_opt (ctx,F2FS_MOUNT_DISABLE_CHECKPOINT );break ;case Opt_checkpoint_enable: +F2FS_CTX_INFO (ctx).unusable_cap_perc =0 ; + ctx->spec_mask |= F2FS_SPEC_checkpoint_disable_cap_perc; +F2FS_CTX_INFO (ctx).unusable_cap =0 ; + ctx->spec_mask |= F2FS_SPEC_checkpoint_disable_cap;ctx_clear_opt (ctx,F2FS_MOUNT_DISABLE_CHECKPOINT );break ;default :
Signature · 1 line
2.49.0
Chao Yu via Linux-f2fs-devel <[email protected]>
Quoted 22 lines · 于2025年8月7日周四 09:52写道:
mount -t f2fs -o checkpoint=disable:10%
/dev/vdb/mnt/f2fs/mount -t f2fs -o remount,checkpoint=enable/dev/vdb/mnt/f2fs/kernel log:
F2FS-fs (vdb): Adjust unusable cap for checkpoint=disable = 204440 / 10%If we has assigned checkpoint=enable mount option, unusable_cap{,_perc} parameters of checkpoint=disable should be reset, then calculation and log print could be avoid in
adjust_unusable_cap_perc().Fixes 1ae18f71cb52 ("f2fs: fix checkpoint=disable:%u%%")Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/super.c | 4 ++++ 1 file changed, 4 insertions(+)fs/f2fs/super.c +0
-0
fs/f2fs/super.c static int f2fs_parse_param(struct fs_context *fc, struct fs_parameter *param) · line 1020
Quoted 7 lines
fs/f2fs/super.c +4
-0@@ -1014,6 +1014,10 @@ static int f2fs_parse_param(struct fs_context *fc, struct fs_parameter *param)ctx_set_opt (ctx,F2FS_MOUNT_DISABLE_CHECKPOINT );break ;case Opt_checkpoint_enable: +F2FS_CTX_INFO (ctx).unusable_cap_perc =0 ; + ctx->spec_mask |= F2FS_SPEC_checkpoint_disable_cap_perc; +F2FS_CTX_INFO (ctx).unusable_cap =0 ; + ctx->spec_mask |= F2FS_SPEC_checkpoint_disable_cap;
Hi Chao,
when enable checkpoint, shoud it be:ctx->spec_mask &= ~F2FS_SPEC_checkpoint_disable_cap_perc; ctx->spec_mask &= ~F2FS_SPEC_checkpoint_disable_cap; please correct me if I misunderstanding.
thanks!
Quoted 12 lines
fs/f2fs/super.c +0
-1ctx_clear_opt (ctx,F2FS_MOUNT_DISABLE_CHECKPOINT );break ;default : --2.49.0
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerQuoted 28 lines · Zhiguo Niu
Chao Yu via Linux-f2fs-devel <[email protected]>
Quoted 26 lines · 于2025年8月7日周四 09:52写道:
mount -t f2fs -o checkpoint=disable:10%
/dev/vdb/mnt/f2fs/mount -t f2fs -o remount,checkpoint=enable/dev/vdb/mnt/f2fs/kernel log:
F2FS-fs (vdb): Adjust unusable cap for checkpoint=disable = 204440 / 10%If we has assigned checkpoint=enable mount option, unusable_cap{,_perc} parameters of checkpoint=disable should be reset, then calculation and log print could be avoid in
adjust_unusable_cap_perc().Fixes 1ae18f71cb52 ("f2fs: fix checkpoint=disable:%u%%")Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/super.c | 4 ++++ 1 file changed, 4 insertions(+)fs/f2fs/super.c +1
-0@@ -1014,6 +1014,10 @@ static int f2fs_parse_param(struct fs_context *fc, struct fs_parameter *param)ctx_set_opt (ctx,F2FS_MOUNT_DISABLE_CHECKPOINT );break ;case Opt_checkpoint_enable: +F2FS_CTX_INFO (ctx).unusable_cap_perc =0 ;
Quoted 8 lines
fs/f2fs/super.c static int f2fs_parse_param(struct fs_context *fc, struct fs_parameter *param) · line 1020
Quoted 3 lines
fs/f2fs/super.c +3
-0+ ctx->spec_mask |= F2FS_SPEC_checkpoint_disable_cap_perc; +F2FS_CTX_INFO (ctx).unusable_cap =0 ; + ctx->spec_mask |= F2FS_SPEC_checkpoint_disable_cap;Hi Chao,
when enable checkpoint, shoud it be:ctx->spec_mask&= ~F2FS_SPEC_checkpoint_disable_cap_perc;ctx->spec_mask&= ~F2FS_SPEC_checkpoint_disable_cap; please correct me if I misunderstanding.
Zhiguo,
IMO, F2FS_SPEC_checkpoint_disable_cap_perc or F2FS_SPEC_checkpoint_disable_cap flags can be added to ctx->spec_mask to indicate ctx.unusable_cap_perc or ctx.unusable_cap has been updated, then we can store last parameter value from ctx to sbi in f2fs_apply_options() as below:
if (ctx->spec_mask & F2FS_SPEC_checkpoint_disable_cap) F2FS_OPTION(sbi).unusable_cap = F2FS_CTX_INFO(ctx).unusable_cap; if (ctx->spec_mask & F2FS_SPEC_checkpoint_disable_cap_perc) F2FS_OPTION(sbi).unusable_cap_perc = F2FS_CTX_INFO(ctx).unusable_cap_perc;
Or am I missing something here?
Thanks,
Quoted 13 lines
thanks!
Quoted 12 lines
fs/f2fs/super.c +0
-1ctx_clear_opt (ctx,F2FS_MOUNT_DISABLE_CHECKPOINT );break ;default : --2.49.0
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 46 lines · Chao Yu <[email protected]> 于2025年8月8日周五 12:14写道:
Quoted 28 lines · Zhiguo Niu
Chao Yu via Linux-f2fs-devel <[email protected]>
Quoted 26 lines · 于2025年8月7日周四 09:52写道:
mount -t f2fs -o checkpoint=disable:10%
/dev/vdb/mnt/f2fs/mount -t f2fs -o remount,checkpoint=enable/dev/vdb/mnt/f2fs/kernel log:
F2FS-fs (vdb): Adjust unusable cap for checkpoint=disable = 204440 / 10%If we has assigned checkpoint=enable mount option, unusable_cap{,_perc} parameters of checkpoint=disable should be reset, then calculation and log print could be avoid in
adjust_unusable_cap_perc().Fixes 1ae18f71cb52 ("f2fs: fix checkpoint=disable:%u%%")Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/super.c | 4 ++++ 1 file changed, 4 insertions(+)fs/f2fs/super.c +1
-0@@ -1014,6 +1014,10 @@ static int f2fs_parse_param(struct fs_context *fc, struct fs_parameter *param)ctx_set_opt (ctx,F2FS_MOUNT_DISABLE_CHECKPOINT );break ;case Opt_checkpoint_enable: +F2FS_CTX_INFO (ctx).unusable_cap_perc =0 ;Quoted 8 lines
fs/f2fs/super.c static int f2fs_parse_param(struct fs_context *fc, struct fs_parameter *param) · line 1020
Quoted 3 lines
fs/f2fs/super.c +3
-0+ ctx->spec_mask |= F2FS_SPEC_checkpoint_disable_cap_perc; +F2FS_CTX_INFO (ctx).unusable_cap =0 ; + ctx->spec_mask |= F2FS_SPEC_checkpoint_disable_cap;Hi Chao,
when enable checkpoint, shoud it be:ctx->spec_mask&= ~F2FS_SPEC_checkpoint_disable_cap_perc;ctx->spec_mask&= ~F2FS_SPEC_checkpoint_disable_cap; please correct me if I misunderstanding.Zhiguo,
IMO,
F2FS_SPEC_checkpoint_disable_cap_percorF2FS_SPEC_checkpoint_disable_capflags can be added toctx->spec_maskto indicate ctx.unusable_cap_perc or ctx.unusable_cap has been updated, then we can store last parameter value from ctx to sbi inf2fs_apply_options()as below:
Quoted 7 lines
if (ctx->spec_mask & F2FS_SPEC_checkpoint_disable_cap) F2FS_OPTION(sbi).unusable_cap = F2FS_CTX_INFO(ctx).unusable_cap; if (ctx->spec_mask & F2FS_SPEC_checkpoint_disable_cap_perc) F2FS_OPTION(sbi).unusable_cap_perc = F2FS_CTX_INFO(ctx).unusable_cap_perc;Or am I missing something here?
Hi Chao,
Ah, yes you are right!
There's something wrong with my thinking.
thank you for your explanation, sorry for the disturbance. thanks!
Quoted 17 lines
Thanks,
Quoted 13 lines
thanks!
Quoted 12 lines
fs/f2fs/super.c +0
-1ctx_clear_opt (ctx,F2FS_MOUNT_DISABLE_CHECKPOINT );break ;default : --2.49.0
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:
Quoted 11 lines · On Thu, 7 Aug 2025 09:48:35 +0800 you wrote:
mount -t f2fs -o checkpoint=disable:10%
/dev/vdb/mnt/f2fs/mount -t f2fs -o remount,checkpoint=enable/dev/vdb/mnt/f2fs/kernel log:
F2FS-fs (vdb): Adjust unusable cap for checkpoint=disable = 204440 / 10%If we has assigned checkpoint=enable mount option, unusable_cap{,_perc} parameters of checkpoint=disable should be reset, then calculation and log print could be avoid in
adjust_unusable_cap_perc().[...]
Here is the summary with links:
- [f2fs-dev] f2fs: fix to clear unusable_cap for checkpoint=enable
https://git.kernel.org/jaegeuk/f2fs/c/743d13d8a600
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html