f2fs: fix the size value in __check_sit_bitmap
authorYunlong Song <yunlong.song@huawei.com>
Fri, 4 Aug 2017 09:07:15 +0000 (17:07 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 15 Aug 2017 17:40:10 +0000 (10:40 -0700)
The current size value is not correct and will miss bitmap check.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/segment.c

index c6e4a1174f8ad9cd91e4d2514544202a91ff9ec0..95267630c8c46d7be5dfbd262e2bd67f31b4d31c 100644 (file)
@@ -787,11 +787,14 @@ void __check_sit_bitmap(struct f2fs_sb_info *sbi,
                sentry = get_seg_entry(sbi, segno);
                offset = GET_BLKOFF_FROM_SEG0(sbi, blk);
 
-               size = min((unsigned long)(end - blk), max_blocks);
+               if (end < START_BLOCK(sbi, segno + 1))
+                       size = GET_BLKOFF_FROM_SEG0(sbi, end);
+               else
+                       size = max_blocks;
                map = (unsigned long *)(sentry->cur_valid_map);
                offset = __find_rev_next_bit(map, size, offset);
                f2fs_bug_on(sbi, offset != size);
-               blk += size;
+               blk = START_BLOCK(sbi, segno + 1);
        }
 #endif
 }