aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/node.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2013-10-29 02:14:54 -0400
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-10-29 02:44:38 -0400
commit5d56b6718a0f4e5c58cdd3cb6b7a472d7c5671b9 (patch)
treec5648f1dccaff7edb642581ba9409e8fe427e5e3 /fs/f2fs/node.c
parent3b218e3a21ccec183472015f1d7168400b187a58 (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/node.c')
-rw-r--r--fs/f2fs/node.c42
1 files changed, 21 insertions, 21 deletions
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 }
971got_it: 971got_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];
1681flush_now: 1681flush_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);