diff options
author | Liu Xue <liuxueliu.liu@huawei.com> | 2015-07-27 10:17:59 +0000 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-08-05 08:08:18 -0700 |
commit | 7a04f64d4d5367ade827d75388d66054b535e201 (patch) | |
tree | d353d66de9204080d9f164399544e28f9e08ac8a /fs/f2fs | |
parent | f3f338caad3428fbc4bb563828efc6ecce4d956b (diff) | |
download | op-kernel-dev-7a04f64d4d5367ade827d75388d66054b535e201.zip op-kernel-dev-7a04f64d4d5367ade827d75388d66054b535e201.tar.gz |
f2fs: unify f2fs_bug_on when check blocks and segment
Replace BUG_ON with f2fs_bug_on to deal with
block and segment validity check failed.
Signed-off-by: Xue Liu <liuxueliu.liu@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/segment.h | 45 |
1 files changed, 8 insertions, 37 deletions
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 79e7b87..230f9cd 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -555,16 +555,15 @@ static inline unsigned short curseg_blkoff(struct f2fs_sb_info *sbi, int type) return curseg->next_blkoff; } -#ifdef CONFIG_F2FS_CHECK_FS static inline void check_seg_range(struct f2fs_sb_info *sbi, unsigned int segno) { - BUG_ON(segno > TOTAL_SEGS(sbi) - 1); + f2fs_bug_on(sbi, segno > TOTAL_SEGS(sbi) - 1); } static inline void verify_block_addr(struct f2fs_sb_info *sbi, block_t blk_addr) { - BUG_ON(blk_addr < SEG0_BLKADDR(sbi)); - BUG_ON(blk_addr >= MAX_BLKADDR(sbi)); + f2fs_bug_on(sbi, blk_addr < SEG0_BLKADDR(sbi) + || blk_addr >= MAX_BLKADDR(sbi)); } /* @@ -577,12 +576,11 @@ static inline void check_block_count(struct f2fs_sb_info *sbi, int valid_blocks = 0; int cur_pos = 0, next_pos; - /* check segment usage */ - BUG_ON(GET_SIT_VBLOCKS(raw_sit) > sbi->blocks_per_seg); - - /* check boundary of a given segment number */ - BUG_ON(segno > TOTAL_SEGS(sbi) - 1); + /* check segment usage, and check boundary of a given segment number */ + f2fs_bug_on(sbi, GET_SIT_VBLOCKS(raw_sit) > sbi->blocks_per_seg + || segno > TOTAL_SEGS(sbi) - 1); +#ifdef CONFIG_F2FS_CHECK_FS /* check bitmap with valid block count */ do { if (is_valid) { @@ -598,35 +596,8 @@ static inline void check_block_count(struct f2fs_sb_info *sbi, is_valid = !is_valid; } while (cur_pos < sbi->blocks_per_seg); BUG_ON(GET_SIT_VBLOCKS(raw_sit) != valid_blocks); -} -#else -static inline void check_seg_range(struct f2fs_sb_info *sbi, unsigned int segno) -{ - if (segno > TOTAL_SEGS(sbi) - 1) - set_sbi_flag(sbi, SBI_NEED_FSCK); -} - -static inline void verify_block_addr(struct f2fs_sb_info *sbi, block_t blk_addr) -{ - if (blk_addr < SEG0_BLKADDR(sbi) || blk_addr >= MAX_BLKADDR(sbi)) - set_sbi_flag(sbi, SBI_NEED_FSCK); -} - -/* - * Summary block is always treated as an invalid block - */ -static inline void check_block_count(struct f2fs_sb_info *sbi, - int segno, struct f2fs_sit_entry *raw_sit) -{ - /* check segment usage */ - if (GET_SIT_VBLOCKS(raw_sit) > sbi->blocks_per_seg) - set_sbi_flag(sbi, SBI_NEED_FSCK); - - /* check boundary of a given segment number */ - if (segno > TOTAL_SEGS(sbi) - 1) - set_sbi_flag(sbi, SBI_NEED_FSCK); -} #endif +} static inline pgoff_t current_sit_addr(struct f2fs_sb_info *sbi, unsigned int start) |