diff mbox series

[f2fs-dev,v2,1/3] f2fs-tools: use 'IS_CUR_SEGNO()' to check if it is current segment

Message ID c6c4f47e6048164218b18dd2e299faf9c9b0a3d7.1695890686.git.bo.wu@vivo.com (mailing list archive)
State New
Headers show
Series f2fs-tools: cache free segments count to improve perfmance | expand

Commit Message

Wu Bo Sept. 28, 2023, 9:20 a.m. UTC
Use IS_CUR_SEGNO() here can make code more concise and readable.
---
 fsck/mount.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

Comments

Chao Yu Oct. 7, 2023, 1:39 a.m. UTC | #1
On 2023/9/28 17:20, Wu Bo wrote:
> Use IS_CUR_SEGNO() here can make code more concise and readable.

It missed to add your signed-off tag here, otherwise the patch looks good to me.

Thanks,

> ---
>   fsck/mount.c | 10 +---------
>   1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/fsck/mount.c b/fsck/mount.c
> index df0314d..e4372cf 100644
> --- a/fsck/mount.c
> +++ b/fsck/mount.c
> @@ -2532,16 +2532,8 @@ void build_sit_area_bitmap(struct f2fs_sb_info *sbi)
>   		ptr += SIT_VBLOCK_MAP_SIZE;
>   
>   		if (se->valid_blocks == 0x0 && is_usable_seg(sbi, segno)) {
> -			if (le32_to_cpu(sbi->ckpt->cur_node_segno[0]) == segno ||
> -				le32_to_cpu(sbi->ckpt->cur_data_segno[0]) == segno ||
> -				le32_to_cpu(sbi->ckpt->cur_node_segno[1]) == segno ||
> -				le32_to_cpu(sbi->ckpt->cur_data_segno[1]) == segno ||
> -				le32_to_cpu(sbi->ckpt->cur_node_segno[2]) == segno ||
> -				le32_to_cpu(sbi->ckpt->cur_data_segno[2]) == segno) {
> -				continue;
> -			} else {
> +			if (!IS_CUR_SEGNO(sbi, segno))
>   				free_segs++;
> -			}
>   		} else {
>   			sum_vblocks += se->valid_blocks;
>   		}
diff mbox series

Patch

diff --git a/fsck/mount.c b/fsck/mount.c
index df0314d..e4372cf 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -2532,16 +2532,8 @@  void build_sit_area_bitmap(struct f2fs_sb_info *sbi)
 		ptr += SIT_VBLOCK_MAP_SIZE;
 
 		if (se->valid_blocks == 0x0 && is_usable_seg(sbi, segno)) {
-			if (le32_to_cpu(sbi->ckpt->cur_node_segno[0]) == segno ||
-				le32_to_cpu(sbi->ckpt->cur_data_segno[0]) == segno ||
-				le32_to_cpu(sbi->ckpt->cur_node_segno[1]) == segno ||
-				le32_to_cpu(sbi->ckpt->cur_data_segno[1]) == segno ||
-				le32_to_cpu(sbi->ckpt->cur_node_segno[2]) == segno ||
-				le32_to_cpu(sbi->ckpt->cur_data_segno[2]) == segno) {
-				continue;
-			} else {
+			if (!IS_CUR_SEGNO(sbi, segno))
 				free_segs++;
-			}
 		} else {
 			sum_vblocks += se->valid_blocks;
 		}