提交 ebdec83b 编写于 作者: E Eric Sesterhenn / snakebyte 提交者: Mark Fasheh

[PATCH] BUG_ON() Conversion in fs/ocfs2/

this changes if() BUG(); constructs to BUG_ON() which is
cleaner, contains unlikely() and can better optimized away.
Signed-off-by: NEric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: NMark Fasheh <mark.fasheh@oracle.com>
上级 b4c7f538
...@@ -262,8 +262,7 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode, ...@@ -262,8 +262,7 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode,
el = &eb->h_list; el = &eb->h_list;
} }
if (el->l_tree_depth) BUG_ON(el->l_tree_depth);
BUG();
for (i = 0; i < le16_to_cpu(el->l_next_free_rec); i++) { for (i = 0; i < le16_to_cpu(el->l_next_free_rec); i++) {
rec = &el->l_recs[i]; rec = &el->l_recs[i];
...@@ -364,8 +363,8 @@ static int ocfs2_extent_map_lookup_read(struct inode *inode, ...@@ -364,8 +363,8 @@ static int ocfs2_extent_map_lookup_read(struct inode *inode,
return ret; return ret;
} }
if (ent->e_tree_depth) /* FIXME: Make sure this isn't a corruption */
BUG(); /* FIXME: Make sure this isn't a corruption */ BUG_ON(ent->e_tree_depth);
*ret_ent = ent; *ret_ent = ent;
...@@ -423,8 +422,7 @@ static int ocfs2_extent_map_try_insert(struct inode *inode, ...@@ -423,8 +422,7 @@ static int ocfs2_extent_map_try_insert(struct inode *inode,
le32_to_cpu(rec->e_clusters), NULL, le32_to_cpu(rec->e_clusters), NULL,
NULL); NULL);
if (!old_ent) BUG_ON(!old_ent);
BUG();
ret = -EEXIST; ret = -EEXIST;
if (old_ent->e_tree_depth < tree_depth) if (old_ent->e_tree_depth < tree_depth)
......
...@@ -147,8 +147,7 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb, ...@@ -147,8 +147,7 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb,
mlog_entry("(max_buffs = %d)\n", max_buffs); mlog_entry("(max_buffs = %d)\n", max_buffs);
if (!osb || !osb->journal->j_journal) BUG_ON(!osb || !osb->journal->j_journal);
BUG();
if (ocfs2_is_hard_readonly(osb)) { if (ocfs2_is_hard_readonly(osb)) {
ret = -EROFS; ret = -EROFS;
...@@ -672,8 +671,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) ...@@ -672,8 +671,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
mlog_entry_void(); mlog_entry_void();
if (!osb) BUG_ON(!osb);
BUG();
journal = osb->journal; journal = osb->journal;
if (!journal) if (!journal)
...@@ -805,8 +803,7 @@ int ocfs2_journal_wipe(struct ocfs2_journal *journal, int full) ...@@ -805,8 +803,7 @@ int ocfs2_journal_wipe(struct ocfs2_journal *journal, int full)
mlog_entry_void(); mlog_entry_void();
if (!journal) BUG_ON(!journal);
BUG();
status = journal_wipe(journal->j_journal, full); status = journal_wipe(journal->j_journal, full);
if (status < 0) { if (status < 0) {
...@@ -1271,8 +1268,7 @@ static int ocfs2_recover_node(struct ocfs2_super *osb, ...@@ -1271,8 +1268,7 @@ static int ocfs2_recover_node(struct ocfs2_super *osb,
/* Should not ever be called to recover ourselves -- in that /* Should not ever be called to recover ourselves -- in that
* case we should've called ocfs2_journal_load instead. */ * case we should've called ocfs2_journal_load instead. */
if (osb->node_num == node_num) BUG_ON(osb->node_num == node_num);
BUG();
slot_num = ocfs2_node_num_to_slot(si, node_num); slot_num = ocfs2_node_num_to_slot(si, node_num);
if (slot_num == OCFS2_INVALID_SLOT) { if (slot_num == OCFS2_INVALID_SLOT) {
......
...@@ -1254,8 +1254,7 @@ static int ocfs2_initialize_super(struct super_block *sb, ...@@ -1254,8 +1254,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
osb->sb = sb; osb->sb = sb;
/* Save off for ocfs2_rw_direct */ /* Save off for ocfs2_rw_direct */
osb->s_sectsize_bits = blksize_bits(sector_size); osb->s_sectsize_bits = blksize_bits(sector_size);
if (!osb->s_sectsize_bits) BUG_ON(!osb->s_sectsize_bits);
BUG();
osb->net_response_ids = 0; osb->net_response_ids = 0;
spin_lock_init(&osb->net_response_lock); spin_lock_init(&osb->net_response_lock);
......
...@@ -77,8 +77,7 @@ struct inode *ocfs2_get_system_file_inode(struct ocfs2_super *osb, ...@@ -77,8 +77,7 @@ struct inode *ocfs2_get_system_file_inode(struct ocfs2_super *osb,
if (arr && ((inode = *arr) != NULL)) { if (arr && ((inode = *arr) != NULL)) {
/* get a ref in addition to the array ref */ /* get a ref in addition to the array ref */
inode = igrab(inode); inode = igrab(inode);
if (!inode) BUG_ON(!inode);
BUG();
return inode; return inode;
} }
...@@ -89,8 +88,7 @@ struct inode *ocfs2_get_system_file_inode(struct ocfs2_super *osb, ...@@ -89,8 +88,7 @@ struct inode *ocfs2_get_system_file_inode(struct ocfs2_super *osb,
/* add one more if putting into array for first time */ /* add one more if putting into array for first time */
if (arr && inode) { if (arr && inode) {
*arr = igrab(inode); *arr = igrab(inode);
if (!*arr) BUG_ON(!*arr);
BUG();
} }
return inode; return inode;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册