diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-10-29 02:14:54 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-10-29 02:44:38 -0400 |
commit | 5d56b6718a0f4e5c58cdd3cb6b7a472d7c5671b9 (patch) | |
tree | c5648f1dccaff7edb642581ba9409e8fe427e5e3 /fs/f2fs/f2fs.h | |
parent | 3b218e3a21ccec183472015f1d7168400b187a58 (diff) |
f2fs: add an option to avoid unnecessary BUG_ONs
If you want to remove unnecessary BUG_ONs, you can just turn off F2FS_CHECK_FS
in your kernel config.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/f2fs.h')
-rw-r--r-- | fs/f2fs/f2fs.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index a61cc5f84638..6aaefdbaaac0 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -20,6 +20,12 @@ | |||
20 | #include <linux/kobject.h> | 20 | #include <linux/kobject.h> |
21 | #include <linux/sched.h> | 21 | #include <linux/sched.h> |
22 | 22 | ||
23 | #ifdef CONFIG_F2FS_CHECK_FS | ||
24 | #define f2fs_bug_on(condition) BUG_ON(condition) | ||
25 | #else | ||
26 | #define f2fs_bug_on(condition) | ||
27 | #endif | ||
28 | |||
23 | /* | 29 | /* |
24 | * For mount options | 30 | * For mount options |
25 | */ | 31 | */ |
@@ -584,8 +590,8 @@ static inline int dec_valid_block_count(struct f2fs_sb_info *sbi, | |||
584 | blkcnt_t count) | 590 | blkcnt_t count) |
585 | { | 591 | { |
586 | spin_lock(&sbi->stat_lock); | 592 | spin_lock(&sbi->stat_lock); |
587 | BUG_ON(sbi->total_valid_block_count < (block_t) count); | 593 | f2fs_bug_on(sbi->total_valid_block_count < (block_t) count); |
588 | BUG_ON(inode->i_blocks < count); | 594 | f2fs_bug_on(inode->i_blocks < count); |
589 | inode->i_blocks -= count; | 595 | inode->i_blocks -= count; |
590 | sbi->total_valid_block_count -= (block_t)count; | 596 | sbi->total_valid_block_count -= (block_t)count; |
591 | spin_unlock(&sbi->stat_lock); | 597 | spin_unlock(&sbi->stat_lock); |
@@ -717,9 +723,9 @@ static inline void dec_valid_node_count(struct f2fs_sb_info *sbi, | |||
717 | { | 723 | { |
718 | spin_lock(&sbi->stat_lock); | 724 | spin_lock(&sbi->stat_lock); |
719 | 725 | ||
720 | BUG_ON(sbi->total_valid_block_count < count); | 726 | f2fs_bug_on(sbi->total_valid_block_count < count); |
721 | BUG_ON(sbi->total_valid_node_count < count); | 727 | f2fs_bug_on(sbi->total_valid_node_count < count); |
722 | BUG_ON(inode->i_blocks < count); | 728 | f2fs_bug_on(inode->i_blocks < count); |
723 | 729 | ||
724 | inode->i_blocks -= count; | 730 | inode->i_blocks -= count; |
725 | sbi->total_valid_node_count -= count; | 731 | sbi->total_valid_node_count -= count; |
@@ -740,7 +746,7 @@ static inline unsigned int valid_node_count(struct f2fs_sb_info *sbi) | |||
740 | static inline void inc_valid_inode_count(struct f2fs_sb_info *sbi) | 746 | static inline void inc_valid_inode_count(struct f2fs_sb_info *sbi) |
741 | { | 747 | { |
742 | spin_lock(&sbi->stat_lock); | 748 | spin_lock(&sbi->stat_lock); |
743 | BUG_ON(sbi->total_valid_inode_count == sbi->total_node_count); | 749 | f2fs_bug_on(sbi->total_valid_inode_count == sbi->total_node_count); |
744 | sbi->total_valid_inode_count++; | 750 | sbi->total_valid_inode_count++; |
745 | spin_unlock(&sbi->stat_lock); | 751 | spin_unlock(&sbi->stat_lock); |
746 | } | 752 | } |
@@ -748,7 +754,7 @@ static inline void inc_valid_inode_count(struct f2fs_sb_info *sbi) | |||
748 | static inline int dec_valid_inode_count(struct f2fs_sb_info *sbi) | 754 | static inline int dec_valid_inode_count(struct f2fs_sb_info *sbi) |
749 | { | 755 | { |
750 | spin_lock(&sbi->stat_lock); | 756 | spin_lock(&sbi->stat_lock); |
751 | BUG_ON(!sbi->total_valid_inode_count); | 757 | f2fs_bug_on(!sbi->total_valid_inode_count); |
752 | sbi->total_valid_inode_count--; | 758 | sbi->total_valid_inode_count--; |
753 | spin_unlock(&sbi->stat_lock); | 759 | spin_unlock(&sbi->stat_lock); |
754 | return 0; | 760 | return 0; |
@@ -769,7 +775,7 @@ static inline void f2fs_put_page(struct page *page, int unlock) | |||
769 | return; | 775 | return; |
770 | 776 | ||
771 | if (unlock) { | 777 | if (unlock) { |
772 | BUG_ON(!PageLocked(page)); | 778 | f2fs_bug_on(!PageLocked(page)); |
773 | unlock_page(page); | 779 | unlock_page(page); |
774 | } | 780 | } |
775 | page_cache_release(page); | 781 | page_cache_release(page); |