diff options
| -rw-r--r-- | fs/f2fs/checkpoint.c | 10 | ||||
| -rw-r--r-- | fs/f2fs/data.c | 4 | ||||
| -rw-r--r-- | fs/f2fs/dir.c | 2 | ||||
| -rw-r--r-- | fs/f2fs/f2fs.h | 22 | ||||
| -rw-r--r-- | fs/f2fs/file.c | 2 | ||||
| -rw-r--r-- | fs/f2fs/inode.c | 2 | ||||
| -rw-r--r-- | fs/f2fs/node.c | 42 | ||||
| -rw-r--r-- | fs/f2fs/recovery.c | 10 | ||||
| -rw-r--r-- | fs/f2fs/segment.c | 16 | ||||
| -rw-r--r-- | fs/f2fs/segment.h | 10 | ||||
| -rw-r--r-- | fs/f2fs/xattr.c | 2 |
11 files changed, 65 insertions, 57 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 6526f5010621..d430157ffe60 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c | |||
| @@ -142,8 +142,8 @@ long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type, | |||
| 142 | for (i = 0; i < nr_pages; i++) { | 142 | for (i = 0; i < nr_pages; i++) { |
| 143 | struct page *page = pvec.pages[i]; | 143 | struct page *page = pvec.pages[i]; |
| 144 | lock_page(page); | 144 | lock_page(page); |
| 145 | BUG_ON(page->mapping != mapping); | 145 | f2fs_bug_on(page->mapping != mapping); |
| 146 | BUG_ON(!PageDirty(page)); | 146 | f2fs_bug_on(!PageDirty(page)); |
| 147 | clear_page_dirty_for_io(page); | 147 | clear_page_dirty_for_io(page); |
| 148 | if (f2fs_write_meta_page(page, &wbc)) { | 148 | if (f2fs_write_meta_page(page, &wbc)) { |
| 149 | unlock_page(page); | 149 | unlock_page(page); |
| @@ -208,7 +208,7 @@ int acquire_orphan_inode(struct f2fs_sb_info *sbi) | |||
| 208 | void release_orphan_inode(struct f2fs_sb_info *sbi) | 208 | void release_orphan_inode(struct f2fs_sb_info *sbi) |
| 209 | { | 209 | { |
| 210 | mutex_lock(&sbi->orphan_inode_mutex); | 210 | mutex_lock(&sbi->orphan_inode_mutex); |
| 211 | BUG_ON(sbi->n_orphans == 0); | 211 | f2fs_bug_on(sbi->n_orphans == 0); |
| 212 | sbi->n_orphans--; | 212 | sbi->n_orphans--; |
| 213 | mutex_unlock(&sbi->orphan_inode_mutex); | 213 | mutex_unlock(&sbi->orphan_inode_mutex); |
| 214 | } | 214 | } |
| @@ -252,7 +252,7 @@ void remove_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino) | |||
| 252 | if (orphan->ino == ino) { | 252 | if (orphan->ino == ino) { |
| 253 | list_del(&orphan->list); | 253 | list_del(&orphan->list); |
| 254 | kmem_cache_free(orphan_entry_slab, orphan); | 254 | kmem_cache_free(orphan_entry_slab, orphan); |
| 255 | BUG_ON(sbi->n_orphans == 0); | 255 | f2fs_bug_on(sbi->n_orphans == 0); |
| 256 | sbi->n_orphans--; | 256 | sbi->n_orphans--; |
| 257 | break; | 257 | break; |
| 258 | } | 258 | } |
| @@ -263,7 +263,7 @@ void remove_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino) | |||
| 263 | static void recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino) | 263 | static void recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino) |
| 264 | { | 264 | { |
| 265 | struct inode *inode = f2fs_iget(sbi->sb, ino); | 265 | struct inode *inode = f2fs_iget(sbi->sb, ino); |
| 266 | BUG_ON(IS_ERR(inode)); | 266 | f2fs_bug_on(IS_ERR(inode)); |
| 267 | clear_nlink(inode); | 267 | clear_nlink(inode); |
| 268 | 268 | ||
| 269 | /* truncate all the data during iput */ | 269 | /* truncate all the data during iput */ |
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index c8887d847dcf..aa3438c571fa 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c | |||
| @@ -110,7 +110,7 @@ void update_extent_cache(block_t blk_addr, struct dnode_of_data *dn) | |||
| 110 | pgoff_t fofs, start_fofs, end_fofs; | 110 | pgoff_t fofs, start_fofs, end_fofs; |
| 111 | block_t start_blkaddr, end_blkaddr; | 111 | block_t start_blkaddr, end_blkaddr; |
| 112 | 112 | ||
| 113 | BUG_ON(blk_addr == NEW_ADDR); | 113 | f2fs_bug_on(blk_addr == NEW_ADDR); |
| 114 | fofs = start_bidx_of_node(ofs_of_node(dn->node_page), fi) + | 114 | fofs = start_bidx_of_node(ofs_of_node(dn->node_page), fi) + |
| 115 | dn->ofs_in_node; | 115 | dn->ofs_in_node; |
| 116 | 116 | ||
| @@ -436,7 +436,7 @@ static int get_data_block_ro(struct inode *inode, sector_t iblock, | |||
| 436 | } | 436 | } |
| 437 | 437 | ||
| 438 | /* It does not support data allocation */ | 438 | /* It does not support data allocation */ |
| 439 | BUG_ON(create); | 439 | f2fs_bug_on(create); |
| 440 | 440 | ||
| 441 | if (dn.data_blkaddr != NEW_ADDR && dn.data_blkaddr != NULL_ADDR) { | 441 | if (dn.data_blkaddr != NEW_ADDR && dn.data_blkaddr != NULL_ADDR) { |
| 442 | int i; | 442 | int i; |
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index c9d53fc510c5..594fc1bb64ef 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c | |||
| @@ -139,7 +139,7 @@ static struct f2fs_dir_entry *find_in_level(struct inode *dir, | |||
| 139 | bool room = false; | 139 | bool room = false; |
| 140 | int max_slots = 0; | 140 | int max_slots = 0; |
| 141 | 141 | ||
| 142 | BUG_ON(level > MAX_DIR_HASH_DEPTH); | 142 | f2fs_bug_on(level > MAX_DIR_HASH_DEPTH); |
| 143 | 143 | ||
| 144 | nbucket = dir_buckets(level); | 144 | nbucket = dir_buckets(level); |
| 145 | nblock = bucket_blocks(level); | 145 | nblock = bucket_blocks(level); |
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); |
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 2d4190a4abe3..58ed19aaa4c6 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
| @@ -296,7 +296,7 @@ static int truncate_blocks(struct inode *inode, u64 from) | |||
| 296 | count = ADDRS_PER_BLOCK; | 296 | count = ADDRS_PER_BLOCK; |
| 297 | 297 | ||
| 298 | count -= dn.ofs_in_node; | 298 | count -= dn.ofs_in_node; |
| 299 | BUG_ON(count < 0); | 299 | f2fs_bug_on(count < 0); |
| 300 | 300 | ||
| 301 | if (dn.ofs_in_node || IS_INODE(dn.node_page)) { | 301 | if (dn.ofs_in_node || IS_INODE(dn.node_page)) { |
| 302 | truncate_data_blocks_range(&dn, count); | 302 | truncate_data_blocks_range(&dn, count); |
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index 7377ca3ce5c5..d0eaa9faeca0 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c | |||
| @@ -266,7 +266,7 @@ void f2fs_evict_inode(struct inode *inode) | |||
| 266 | inode->i_ino == F2FS_META_INO(sbi)) | 266 | inode->i_ino == F2FS_META_INO(sbi)) |
| 267 | goto no_delete; | 267 | goto no_delete; |
| 268 | 268 | ||
| 269 | BUG_ON(atomic_read(&F2FS_I(inode)->dirty_dents)); | 269 | f2fs_bug_on(atomic_read(&F2FS_I(inode)->dirty_dents)); |
| 270 | remove_dirty_dir_inode(inode); | 270 | remove_dirty_dir_inode(inode); |
| 271 | 271 | ||
| 272 | if (inode->i_nlink || is_bad_inode(inode)) | 272 | if (inode->i_nlink || is_bad_inode(inode)) |
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 304d5ced6355..8e331d5b9fcd 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c | |||
| @@ -204,7 +204,7 @@ retry: | |||
| 204 | } | 204 | } |
| 205 | e->ni = *ni; | 205 | e->ni = *ni; |
| 206 | e->checkpointed = true; | 206 | e->checkpointed = true; |
| 207 | BUG_ON(ni->blk_addr == NEW_ADDR); | 207 | f2fs_bug_on(ni->blk_addr == NEW_ADDR); |
| 208 | } else if (new_blkaddr == NEW_ADDR) { | 208 | } else if (new_blkaddr == NEW_ADDR) { |
| 209 | /* | 209 | /* |
| 210 | * when nid is reallocated, | 210 | * when nid is reallocated, |
| @@ -212,19 +212,19 @@ retry: | |||
| 212 | * So, reinitialize it with new information. | 212 | * So, reinitialize it with new information. |
| 213 | */ | 213 | */ |
| 214 | e->ni = *ni; | 214 | e->ni = *ni; |
| 215 | BUG_ON(ni->blk_addr != NULL_ADDR); | 215 | f2fs_bug_on(ni->blk_addr != NULL_ADDR); |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | if (new_blkaddr == NEW_ADDR) | 218 | if (new_blkaddr == NEW_ADDR) |
| 219 | e->checkpointed = false; | 219 | e->checkpointed = false; |
| 220 | 220 | ||
| 221 | /* sanity check */ | 221 | /* sanity check */ |
| 222 | BUG_ON(nat_get_blkaddr(e) != ni->blk_addr); | 222 | f2fs_bug_on(nat_get_blkaddr(e) != ni->blk_addr); |
| 223 | BUG_ON(nat_get_blkaddr(e) == NULL_ADDR && | 223 | f2fs_bug_on(nat_get_blkaddr(e) == NULL_ADDR && |
| 224 | new_blkaddr == NULL_ADDR); | 224 | new_blkaddr == NULL_ADDR); |
| 225 | BUG_ON(nat_get_blkaddr(e) == NEW_ADDR && | 225 | f2fs_bug_on(nat_get_blkaddr(e) == NEW_ADDR && |
| 226 | new_blkaddr == NEW_ADDR); | 226 | new_blkaddr == NEW_ADDR); |
| 227 | BUG_ON(nat_get_blkaddr(e) != NEW_ADDR && | 227 | f2fs_bug_on(nat_get_blkaddr(e) != NEW_ADDR && |
| 228 | nat_get_blkaddr(e) != NULL_ADDR && | 228 | nat_get_blkaddr(e) != NULL_ADDR && |
| 229 | new_blkaddr == NEW_ADDR); | 229 | new_blkaddr == NEW_ADDR); |
| 230 | 230 | ||
| @@ -495,10 +495,10 @@ static void truncate_node(struct dnode_of_data *dn) | |||
| 495 | 495 | ||
| 496 | get_node_info(sbi, dn->nid, &ni); | 496 | get_node_info(sbi, dn->nid, &ni); |
| 497 | if (dn->inode->i_blocks == 0) { | 497 | if (dn->inode->i_blocks == 0) { |
| 498 | BUG_ON(ni.blk_addr != NULL_ADDR); | 498 | f2fs_bug_on(ni.blk_addr != NULL_ADDR); |
| 499 | goto invalidate; | 499 | goto invalidate; |
| 500 | } | 500 | } |
| 501 | BUG_ON(ni.blk_addr == NULL_ADDR); | 501 | f2fs_bug_on(ni.blk_addr == NULL_ADDR); |
| 502 | 502 | ||
| 503 | /* Deallocate node address */ | 503 | /* Deallocate node address */ |
| 504 | invalidate_blocks(sbi, ni.blk_addr); | 504 | invalidate_blocks(sbi, ni.blk_addr); |
| @@ -822,7 +822,7 @@ int remove_inode_page(struct inode *inode) | |||
| 822 | } | 822 | } |
| 823 | 823 | ||
| 824 | /* 0 is possible, after f2fs_new_inode() is failed */ | 824 | /* 0 is possible, after f2fs_new_inode() is failed */ |
| 825 | BUG_ON(inode->i_blocks != 0 && inode->i_blocks != 1); | 825 | f2fs_bug_on(inode->i_blocks != 0 && inode->i_blocks != 1); |
| 826 | set_new_dnode(&dn, inode, page, page, ino); | 826 | set_new_dnode(&dn, inode, page, page, ino); |
| 827 | truncate_node(&dn); | 827 | truncate_node(&dn); |
| 828 | return 0; | 828 | return 0; |
| @@ -863,7 +863,7 @@ struct page *new_node_page(struct dnode_of_data *dn, | |||
| 863 | get_node_info(sbi, dn->nid, &old_ni); | 863 | get_node_info(sbi, dn->nid, &old_ni); |
| 864 | 864 | ||
| 865 | /* Reinitialize old_ni with new node page */ | 865 | /* Reinitialize old_ni with new node page */ |
| 866 | BUG_ON(old_ni.blk_addr != NULL_ADDR); | 866 | f2fs_bug_on(old_ni.blk_addr != NULL_ADDR); |
| 867 | new_ni = old_ni; | 867 | new_ni = old_ni; |
| 868 | new_ni.ino = dn->inode->i_ino; | 868 | new_ni.ino = dn->inode->i_ino; |
| 869 | set_node_addr(sbi, &new_ni, NEW_ADDR); | 869 | set_node_addr(sbi, &new_ni, NEW_ADDR); |
| @@ -969,7 +969,7 @@ repeat: | |||
| 969 | goto repeat; | 969 | goto repeat; |
| 970 | } | 970 | } |
| 971 | got_it: | 971 | got_it: |
| 972 | BUG_ON(nid != nid_of_node(page)); | 972 | f2fs_bug_on(nid != nid_of_node(page)); |
| 973 | mark_page_accessed(page); | 973 | mark_page_accessed(page); |
| 974 | return page; | 974 | return page; |
| 975 | } | 975 | } |
| @@ -1163,7 +1163,7 @@ static int f2fs_write_node_page(struct page *page, | |||
| 1163 | 1163 | ||
| 1164 | /* get old block addr of this node page */ | 1164 | /* get old block addr of this node page */ |
| 1165 | nid = nid_of_node(page); | 1165 | nid = nid_of_node(page); |
| 1166 | BUG_ON(page->index != nid); | 1166 | f2fs_bug_on(page->index != nid); |
| 1167 | 1167 | ||
| 1168 | get_node_info(sbi, nid, &ni); | 1168 | get_node_info(sbi, nid, &ni); |
| 1169 | 1169 | ||
| @@ -1349,7 +1349,7 @@ static void scan_nat_page(struct f2fs_nm_info *nm_i, | |||
| 1349 | break; | 1349 | break; |
| 1350 | 1350 | ||
| 1351 | blk_addr = le32_to_cpu(nat_blk->entries[i].block_addr); | 1351 | blk_addr = le32_to_cpu(nat_blk->entries[i].block_addr); |
| 1352 | BUG_ON(blk_addr == NEW_ADDR); | 1352 | f2fs_bug_on(blk_addr == NEW_ADDR); |
| 1353 | if (blk_addr == NULL_ADDR) { | 1353 | if (blk_addr == NULL_ADDR) { |
| 1354 | if (add_free_nid(nm_i, start_nid, true) < 0) | 1354 | if (add_free_nid(nm_i, start_nid, true) < 0) |
| 1355 | break; | 1355 | break; |
| @@ -1420,14 +1420,14 @@ retry: | |||
| 1420 | 1420 | ||
| 1421 | /* We should not use stale free nids created by build_free_nids */ | 1421 | /* We should not use stale free nids created by build_free_nids */ |
| 1422 | if (nm_i->fcnt && !sbi->on_build_free_nids) { | 1422 | if (nm_i->fcnt && !sbi->on_build_free_nids) { |
| 1423 | BUG_ON(list_empty(&nm_i->free_nid_list)); | 1423 | f2fs_bug_on(list_empty(&nm_i->free_nid_list)); |
| 1424 | list_for_each(this, &nm_i->free_nid_list) { | 1424 | list_for_each(this, &nm_i->free_nid_list) { |
| 1425 | i = list_entry(this, struct free_nid, list); | 1425 | i = list_entry(this, struct free_nid, list); |
| 1426 | if (i->state == NID_NEW) | 1426 | if (i->state == NID_NEW) |
| 1427 | break; | 1427 | break; |
| 1428 | } | 1428 | } |
| 1429 | 1429 | ||
| 1430 | BUG_ON(i->state != NID_NEW); | 1430 | f2fs_bug_on(i->state != NID_NEW); |
| 1431 | *nid = i->nid; | 1431 | *nid = i->nid; |
| 1432 | i->state = NID_ALLOC; | 1432 | i->state = NID_ALLOC; |
| 1433 | nm_i->fcnt--; | 1433 | nm_i->fcnt--; |
| @@ -1455,7 +1455,7 @@ void alloc_nid_done(struct f2fs_sb_info *sbi, nid_t nid) | |||
| 1455 | 1455 | ||
| 1456 | spin_lock(&nm_i->free_nid_list_lock); | 1456 | spin_lock(&nm_i->free_nid_list_lock); |
| 1457 | i = __lookup_free_nid_list(nid, &nm_i->free_nid_list); | 1457 | i = __lookup_free_nid_list(nid, &nm_i->free_nid_list); |
| 1458 | BUG_ON(!i || i->state != NID_ALLOC); | 1458 | f2fs_bug_on(!i || i->state != NID_ALLOC); |
| 1459 | __del_from_free_nid_list(i); | 1459 | __del_from_free_nid_list(i); |
| 1460 | spin_unlock(&nm_i->free_nid_list_lock); | 1460 | spin_unlock(&nm_i->free_nid_list_lock); |
| 1461 | } | 1461 | } |
| @@ -1473,7 +1473,7 @@ void alloc_nid_failed(struct f2fs_sb_info *sbi, nid_t nid) | |||
| 1473 | 1473 | ||
| 1474 | spin_lock(&nm_i->free_nid_list_lock); | 1474 | spin_lock(&nm_i->free_nid_list_lock); |
| 1475 | i = __lookup_free_nid_list(nid, &nm_i->free_nid_list); | 1475 | i = __lookup_free_nid_list(nid, &nm_i->free_nid_list); |
| 1476 | BUG_ON(!i || i->state != NID_ALLOC); | 1476 | f2fs_bug_on(!i || i->state != NID_ALLOC); |
| 1477 | if (nm_i->fcnt > 2 * MAX_FREE_NIDS) { | 1477 | if (nm_i->fcnt > 2 * MAX_FREE_NIDS) { |
| 1478 | __del_from_free_nid_list(i); | 1478 | __del_from_free_nid_list(i); |
| 1479 | } else { | 1479 | } else { |
| @@ -1676,7 +1676,7 @@ to_nat_page: | |||
| 1676 | nat_blk = page_address(page); | 1676 | nat_blk = page_address(page); |
| 1677 | } | 1677 | } |
| 1678 | 1678 | ||
| 1679 | BUG_ON(!nat_blk); | 1679 | f2fs_bug_on(!nat_blk); |
| 1680 | raw_ne = nat_blk->entries[nid - start_nid]; | 1680 | raw_ne = nat_blk->entries[nid - start_nid]; |
| 1681 | flush_now: | 1681 | flush_now: |
| 1682 | new_blkaddr = nat_get_blkaddr(ne); | 1682 | new_blkaddr = nat_get_blkaddr(ne); |
| @@ -1780,11 +1780,11 @@ void destroy_node_manager(struct f2fs_sb_info *sbi) | |||
| 1780 | /* destroy free nid list */ | 1780 | /* destroy free nid list */ |
| 1781 | spin_lock(&nm_i->free_nid_list_lock); | 1781 | spin_lock(&nm_i->free_nid_list_lock); |
| 1782 | list_for_each_entry_safe(i, next_i, &nm_i->free_nid_list, list) { | 1782 | list_for_each_entry_safe(i, next_i, &nm_i->free_nid_list, list) { |
| 1783 | BUG_ON(i->state == NID_ALLOC); | 1783 | f2fs_bug_on(i->state == NID_ALLOC); |
| 1784 | __del_from_free_nid_list(i); | 1784 | __del_from_free_nid_list(i); |
| 1785 | nm_i->fcnt--; | 1785 | nm_i->fcnt--; |
| 1786 | } | 1786 | } |
| 1787 | BUG_ON(nm_i->fcnt); | 1787 | f2fs_bug_on(nm_i->fcnt); |
| 1788 | spin_unlock(&nm_i->free_nid_list_lock); | 1788 | spin_unlock(&nm_i->free_nid_list_lock); |
| 1789 | 1789 | ||
| 1790 | /* destroy nat cache */ | 1790 | /* destroy nat cache */ |
| @@ -1798,7 +1798,7 @@ void destroy_node_manager(struct f2fs_sb_info *sbi) | |||
| 1798 | __del_from_nat_cache(nm_i, e); | 1798 | __del_from_nat_cache(nm_i, e); |
| 1799 | } | 1799 | } |
| 1800 | } | 1800 | } |
| 1801 | BUG_ON(nm_i->nat_cnt); | 1801 | f2fs_bug_on(nm_i->nat_cnt); |
| 1802 | write_unlock(&nm_i->nat_tree_lock); | 1802 | write_unlock(&nm_i->nat_tree_lock); |
| 1803 | 1803 | ||
| 1804 | kfree(nm_i->nat_bitmap); | 1804 | kfree(nm_i->nat_bitmap); |
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index b278c68b3e08..fdc81161f254 100644 --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c | |||
| @@ -311,8 +311,8 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode, | |||
| 311 | wait_on_page_writeback(dn.node_page); | 311 | wait_on_page_writeback(dn.node_page); |
| 312 | 312 | ||
| 313 | get_node_info(sbi, dn.nid, &ni); | 313 | get_node_info(sbi, dn.nid, &ni); |
| 314 | BUG_ON(ni.ino != ino_of_node(page)); | 314 | f2fs_bug_on(ni.ino != ino_of_node(page)); |
| 315 | BUG_ON(ofs_of_node(dn.node_page) != ofs_of_node(page)); | 315 | f2fs_bug_on(ofs_of_node(dn.node_page) != ofs_of_node(page)); |
| 316 | 316 | ||
| 317 | for (; start < end; start++) { | 317 | for (; start < end; start++) { |
| 318 | block_t src, dest; | 318 | block_t src, dest; |
| @@ -322,9 +322,9 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode, | |||
| 322 | 322 | ||
| 323 | if (src != dest && dest != NEW_ADDR && dest != NULL_ADDR) { | 323 | if (src != dest && dest != NEW_ADDR && dest != NULL_ADDR) { |
| 324 | if (src == NULL_ADDR) { | 324 | if (src == NULL_ADDR) { |
| 325 | int err = reserve_new_block(&dn); | 325 | err = reserve_new_block(&dn); |
| 326 | /* We should not get -ENOSPC */ | 326 | /* We should not get -ENOSPC */ |
| 327 | BUG_ON(err); | 327 | f2fs_bug_on(err); |
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | /* Check the previous node page having this index */ | 330 | /* Check the previous node page having this index */ |
| @@ -447,7 +447,7 @@ int recover_fsync_data(struct f2fs_sb_info *sbi) | |||
| 447 | 447 | ||
| 448 | /* step #2: recover data */ | 448 | /* step #2: recover data */ |
| 449 | err = recover_data(sbi, &inode_list, CURSEG_WARM_NODE); | 449 | err = recover_data(sbi, &inode_list, CURSEG_WARM_NODE); |
| 450 | BUG_ON(!list_empty(&inode_list)); | 450 | f2fs_bug_on(!list_empty(&inode_list)); |
| 451 | out: | 451 | out: |
| 452 | destroy_fsync_dnodes(&inode_list); | 452 | destroy_fsync_dnodes(&inode_list); |
| 453 | kmem_cache_destroy(fsync_entry_slab); | 453 | kmem_cache_destroy(fsync_entry_slab); |
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 8f92c18a01fb..c7161defff90 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c | |||
| @@ -192,7 +192,7 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del) | |||
| 192 | new_vblocks = se->valid_blocks + del; | 192 | new_vblocks = se->valid_blocks + del; |
| 193 | offset = GET_SEGOFF_FROM_SEG0(sbi, blkaddr) & (sbi->blocks_per_seg - 1); | 193 | offset = GET_SEGOFF_FROM_SEG0(sbi, blkaddr) & (sbi->blocks_per_seg - 1); |
| 194 | 194 | ||
| 195 | BUG_ON((new_vblocks >> (sizeof(unsigned short) << 3) || | 195 | f2fs_bug_on((new_vblocks >> (sizeof(unsigned short) << 3) || |
| 196 | (new_vblocks > sbi->blocks_per_seg))); | 196 | (new_vblocks > sbi->blocks_per_seg))); |
| 197 | 197 | ||
| 198 | se->valid_blocks = new_vblocks; | 198 | se->valid_blocks = new_vblocks; |
| @@ -232,7 +232,7 @@ void invalidate_blocks(struct f2fs_sb_info *sbi, block_t addr) | |||
| 232 | unsigned int segno = GET_SEGNO(sbi, addr); | 232 | unsigned int segno = GET_SEGNO(sbi, addr); |
| 233 | struct sit_info *sit_i = SIT_I(sbi); | 233 | struct sit_info *sit_i = SIT_I(sbi); |
| 234 | 234 | ||
| 235 | BUG_ON(addr == NULL_ADDR); | 235 | f2fs_bug_on(addr == NULL_ADDR); |
| 236 | if (addr == NEW_ADDR) | 236 | if (addr == NEW_ADDR) |
| 237 | return; | 237 | return; |
| 238 | 238 | ||
| @@ -347,7 +347,7 @@ find_other_zone: | |||
| 347 | if (dir == ALLOC_RIGHT) { | 347 | if (dir == ALLOC_RIGHT) { |
| 348 | secno = find_next_zero_bit(free_i->free_secmap, | 348 | secno = find_next_zero_bit(free_i->free_secmap, |
| 349 | TOTAL_SECS(sbi), 0); | 349 | TOTAL_SECS(sbi), 0); |
| 350 | BUG_ON(secno >= TOTAL_SECS(sbi)); | 350 | f2fs_bug_on(secno >= TOTAL_SECS(sbi)); |
| 351 | } else { | 351 | } else { |
| 352 | go_left = 1; | 352 | go_left = 1; |
| 353 | left_start = hint - 1; | 353 | left_start = hint - 1; |
| @@ -363,7 +363,7 @@ find_other_zone: | |||
| 363 | } | 363 | } |
| 364 | left_start = find_next_zero_bit(free_i->free_secmap, | 364 | left_start = find_next_zero_bit(free_i->free_secmap, |
| 365 | TOTAL_SECS(sbi), 0); | 365 | TOTAL_SECS(sbi), 0); |
| 366 | BUG_ON(left_start >= TOTAL_SECS(sbi)); | 366 | f2fs_bug_on(left_start >= TOTAL_SECS(sbi)); |
| 367 | break; | 367 | break; |
| 368 | } | 368 | } |
| 369 | secno = left_start; | 369 | secno = left_start; |
| @@ -402,7 +402,7 @@ skip_left: | |||
| 402 | } | 402 | } |
| 403 | got_it: | 403 | got_it: |
| 404 | /* set it as dirty segment in free segmap */ | 404 | /* set it as dirty segment in free segmap */ |
| 405 | BUG_ON(test_bit(segno, free_i->free_segmap)); | 405 | f2fs_bug_on(test_bit(segno, free_i->free_segmap)); |
| 406 | __set_inuse(sbi, segno); | 406 | __set_inuse(sbi, segno); |
| 407 | *newseg = segno; | 407 | *newseg = segno; |
| 408 | write_unlock(&free_i->segmap_lock); | 408 | write_unlock(&free_i->segmap_lock); |
| @@ -773,7 +773,7 @@ static int __get_segment_type(struct page *page, enum page_type p_type) | |||
| 773 | return __get_segment_type_4(page, p_type); | 773 | return __get_segment_type_4(page, p_type); |
| 774 | } | 774 | } |
| 775 | /* NR_CURSEG_TYPE(6) logs by default */ | 775 | /* NR_CURSEG_TYPE(6) logs by default */ |
| 776 | BUG_ON(sbi->active_logs != NR_CURSEG_TYPE); | 776 | f2fs_bug_on(sbi->active_logs != NR_CURSEG_TYPE); |
| 777 | return __get_segment_type_6(page, p_type); | 777 | return __get_segment_type_6(page, p_type); |
| 778 | } | 778 | } |
| 779 | 779 | ||
| @@ -850,7 +850,7 @@ void write_data_page(struct inode *inode, struct page *page, | |||
| 850 | struct f2fs_summary sum; | 850 | struct f2fs_summary sum; |
| 851 | struct node_info ni; | 851 | struct node_info ni; |
| 852 | 852 | ||
| 853 | BUG_ON(old_blkaddr == NULL_ADDR); | 853 | f2fs_bug_on(old_blkaddr == NULL_ADDR); |
| 854 | get_node_info(sbi, dn->nid, &ni); | 854 | get_node_info(sbi, dn->nid, &ni); |
| 855 | set_summary(&sum, dn->nid, dn->ofs_in_node, ni.version); | 855 | set_summary(&sum, dn->nid, dn->ofs_in_node, ni.version); |
| 856 | 856 | ||
| @@ -1240,7 +1240,7 @@ static struct page *get_next_sit_page(struct f2fs_sb_info *sbi, | |||
| 1240 | /* get current sit block page without lock */ | 1240 | /* get current sit block page without lock */ |
| 1241 | src_page = get_meta_page(sbi, src_off); | 1241 | src_page = get_meta_page(sbi, src_off); |
| 1242 | dst_page = grab_meta_page(sbi, dst_off); | 1242 | dst_page = grab_meta_page(sbi, dst_off); |
| 1243 | BUG_ON(PageDirty(src_page)); | 1243 | f2fs_bug_on(PageDirty(src_page)); |
| 1244 | 1244 | ||
| 1245 | src_addr = page_address(src_page); | 1245 | src_addr = page_address(src_page); |
| 1246 | dst_addr = page_address(dst_page); | 1246 | dst_addr = page_address(dst_page); |
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index abe7094c4f7a..001d4c4d97fd 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h | |||
| @@ -522,16 +522,13 @@ static inline unsigned short curseg_blkoff(struct f2fs_sb_info *sbi, int type) | |||
| 522 | return curseg->next_blkoff; | 522 | return curseg->next_blkoff; |
| 523 | } | 523 | } |
| 524 | 524 | ||
| 525 | #ifdef CONFIG_F2FS_CHECK_FS | ||
| 525 | static inline void check_seg_range(struct f2fs_sb_info *sbi, unsigned int segno) | 526 | static inline void check_seg_range(struct f2fs_sb_info *sbi, unsigned int segno) |
| 526 | { | 527 | { |
| 527 | unsigned int end_segno = SM_I(sbi)->segment_count - 1; | 528 | unsigned int end_segno = SM_I(sbi)->segment_count - 1; |
| 528 | BUG_ON(segno > end_segno); | 529 | BUG_ON(segno > end_segno); |
| 529 | } | 530 | } |
| 530 | 531 | ||
| 531 | /* | ||
| 532 | * This function is used for only debugging. | ||
| 533 | * NOTE: In future, we have to remove this function. | ||
| 534 | */ | ||
| 535 | static inline void verify_block_addr(struct f2fs_sb_info *sbi, block_t blk_addr) | 532 | static inline void verify_block_addr(struct f2fs_sb_info *sbi, block_t blk_addr) |
| 536 | { | 533 | { |
| 537 | struct f2fs_sm_info *sm_info = SM_I(sbi); | 534 | struct f2fs_sm_info *sm_info = SM_I(sbi); |
| @@ -565,6 +562,11 @@ static inline void check_block_count(struct f2fs_sb_info *sbi, | |||
| 565 | valid_blocks++; | 562 | valid_blocks++; |
| 566 | BUG_ON(GET_SIT_VBLOCKS(raw_sit) != valid_blocks); | 563 | BUG_ON(GET_SIT_VBLOCKS(raw_sit) != valid_blocks); |
| 567 | } | 564 | } |
| 565 | #else | ||
| 566 | #define check_seg_range(sbi, segno) | ||
| 567 | #define verify_block_addr(sbi, blk_addr) | ||
| 568 | #define check_block_count(sbi, segno, raw_sit) | ||
| 569 | #endif | ||
| 568 | 570 | ||
| 569 | static inline pgoff_t current_sit_addr(struct f2fs_sb_info *sbi, | 571 | static inline pgoff_t current_sit_addr(struct f2fs_sb_info *sbi, |
| 570 | unsigned int start) | 572 | unsigned int start) |
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index f685138dd496..89d506d0b35d 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c | |||
| @@ -372,7 +372,7 @@ static inline int write_all_xattrs(struct inode *inode, __u32 hsize, | |||
| 372 | alloc_nid_failed(sbi, new_nid); | 372 | alloc_nid_failed(sbi, new_nid); |
| 373 | return PTR_ERR(xpage); | 373 | return PTR_ERR(xpage); |
| 374 | } | 374 | } |
| 375 | BUG_ON(new_nid); | 375 | f2fs_bug_on(new_nid); |
| 376 | } else { | 376 | } else { |
| 377 | struct dnode_of_data dn; | 377 | struct dnode_of_data dn; |
| 378 | set_new_dnode(&dn, inode, NULL, NULL, new_nid); | 378 | set_new_dnode(&dn, inode, NULL, NULL, new_nid); |
