You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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>
This commit is contained in:
+14
-8
@@ -20,6 +20,12 @@
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
#ifdef CONFIG_F2FS_CHECK_FS
|
||||
#define f2fs_bug_on(condition) BUG_ON(condition)
|
||||
#else
|
||||
#define f2fs_bug_on(condition)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For mount options
|
||||
*/
|
||||
@@ -584,8 +590,8 @@ static inline int dec_valid_block_count(struct f2fs_sb_info *sbi,
|
||||
blkcnt_t count)
|
||||
{
|
||||
spin_lock(&sbi->stat_lock);
|
||||
BUG_ON(sbi->total_valid_block_count < (block_t) count);
|
||||
BUG_ON(inode->i_blocks < count);
|
||||
f2fs_bug_on(sbi->total_valid_block_count < (block_t) count);
|
||||
f2fs_bug_on(inode->i_blocks < count);
|
||||
inode->i_blocks -= count;
|
||||
sbi->total_valid_block_count -= (block_t)count;
|
||||
spin_unlock(&sbi->stat_lock);
|
||||
@@ -717,9 +723,9 @@ static inline void dec_valid_node_count(struct f2fs_sb_info *sbi,
|
||||
{
|
||||
spin_lock(&sbi->stat_lock);
|
||||
|
||||
BUG_ON(sbi->total_valid_block_count < count);
|
||||
BUG_ON(sbi->total_valid_node_count < count);
|
||||
BUG_ON(inode->i_blocks < count);
|
||||
f2fs_bug_on(sbi->total_valid_block_count < count);
|
||||
f2fs_bug_on(sbi->total_valid_node_count < count);
|
||||
f2fs_bug_on(inode->i_blocks < count);
|
||||
|
||||
inode->i_blocks -= count;
|
||||
sbi->total_valid_node_count -= count;
|
||||
@@ -740,7 +746,7 @@ static inline unsigned int valid_node_count(struct f2fs_sb_info *sbi)
|
||||
static inline void inc_valid_inode_count(struct f2fs_sb_info *sbi)
|
||||
{
|
||||
spin_lock(&sbi->stat_lock);
|
||||
BUG_ON(sbi->total_valid_inode_count == sbi->total_node_count);
|
||||
f2fs_bug_on(sbi->total_valid_inode_count == sbi->total_node_count);
|
||||
sbi->total_valid_inode_count++;
|
||||
spin_unlock(&sbi->stat_lock);
|
||||
}
|
||||
@@ -748,7 +754,7 @@ static inline void inc_valid_inode_count(struct f2fs_sb_info *sbi)
|
||||
static inline int dec_valid_inode_count(struct f2fs_sb_info *sbi)
|
||||
{
|
||||
spin_lock(&sbi->stat_lock);
|
||||
BUG_ON(!sbi->total_valid_inode_count);
|
||||
f2fs_bug_on(!sbi->total_valid_inode_count);
|
||||
sbi->total_valid_inode_count--;
|
||||
spin_unlock(&sbi->stat_lock);
|
||||
return 0;
|
||||
@@ -769,7 +775,7 @@ static inline void f2fs_put_page(struct page *page, int unlock)
|
||||
return;
|
||||
|
||||
if (unlock) {
|
||||
BUG_ON(!PageLocked(page));
|
||||
f2fs_bug_on(!PageLocked(page));
|
||||
unlock_page(page);
|
||||
}
|
||||
page_cache_release(page);
|
||||
|
||||
Reference in New Issue
Block a user