diff mbox series

[f2fs-dev] f2fs: allow dirty sections with zero valid block for checkpoint disabled

Message ID 20240507175628.2460390-1-daeho43@gmail.com (mailing list archive)
State Superseded
Headers show
Series [f2fs-dev] f2fs: allow dirty sections with zero valid block for checkpoint disabled | expand

Commit Message

Daeho Jeong May 7, 2024, 5:56 p.m. UTC
From: Daeho Jeong <daehojeong@google.com>

Following the semantic for dirty segments in checkpoint disabled mode,
apply the same rule to dirty sections.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
---
 fs/f2fs/segment.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Jaegeuk Kim May 9, 2024, 6:19 p.m. UTC | #1
On 05/07, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
> 
> Following the semantic for dirty segments in checkpoint disabled mode,
> apply the same rule to dirty sections.
> 
> Signed-off-by: Daeho Jeong <daehojeong@google.com>
> ---
>  fs/f2fs/segment.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 6474b7338e81..2463398b243f 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -771,8 +771,11 @@ static void __locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno,
>  			block_t valid_blocks =
>  				get_valid_blocks(sbi, segno, true);
>  
> -			f2fs_bug_on(sbi, unlikely(!valid_blocks ||
> -					valid_blocks == CAP_BLKS_PER_SEC(sbi)));
> +			if (!is_sbi_flag_set(sbi, SBI_CP_DISABLED))
> +				f2fs_bug_on(sbi, unlikely(!valid_blocks));
> +
> +			f2fs_bug_on(sbi, unlikely(valid_blocks ==
> +					CAP_BLKS_PER_SEC(sbi)));

What about:
f2fs_bug_on(sbi,
	(!is_sbi_flag_set(sbi, SBI_CP_DISABLED) && !valid_blocks) ||
	valid_blocks == CAP_BLKS_PER_SEC(sbi));

>  
>  			if (!IS_CURSEC(sbi, secno))
>  				set_bit(secno, dirty_i->dirty_secmap);
> -- 
> 2.45.0.rc1.225.g2a3ae87e7f-goog
> 
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
diff mbox series

Patch

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 6474b7338e81..2463398b243f 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -771,8 +771,11 @@  static void __locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno,
 			block_t valid_blocks =
 				get_valid_blocks(sbi, segno, true);
 
-			f2fs_bug_on(sbi, unlikely(!valid_blocks ||
-					valid_blocks == CAP_BLKS_PER_SEC(sbi)));
+			if (!is_sbi_flag_set(sbi, SBI_CP_DISABLED))
+				f2fs_bug_on(sbi, unlikely(!valid_blocks));
+
+			f2fs_bug_on(sbi, unlikely(valid_blocks ==
+					CAP_BLKS_PER_SEC(sbi)));
 
 			if (!IS_CURSEC(sbi, secno))
 				set_bit(secno, dirty_i->dirty_secmap);