Use IS_CUR_SEGNO() here can make code more concise and readable.
---
 fsck/mount.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/fsck/mount.c b/fsck/mount.c
index df0314d..00940b8 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -2531,20 +2531,11 @@ void build_sit_area_bitmap(struct f2fs_sb_info *sbi)
                memcpy(ptr, se->cur_valid_map, SIT_VBLOCK_MAP_SIZE);
                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 {
-                               free_segs++;
-                       }
-               } else {
+               if (se->valid_blocks == 0x0 && is_usable_seg(sbi, segno) &&
+                               !IS_CUR_SEGNO(sbi, segno))
+                       free_segs++;
+               else
                        sum_vblocks += se->valid_blocks;
-               }
        }
        fsck->chk.sit_valid_blocks = sum_vblocks;
        fsck->chk.sit_free_segs = free_segs;
-- 
2.25.1



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

Reply via email to