Skip to content

Commit

Permalink
[PATCH] BUG_ON() Conversion in fs/ocfs2/
Browse files Browse the repository at this point in the history
this changes if() BUG(); constructs to BUG_ON() which is
cleaner, contains unlikely() and can better optimized away.

Signed-off-by: Eric Sesterhenn <[email protected]>
Signed-off-by: Mark Fasheh <[email protected]>
  • Loading branch information
SesterhennEric authored and Mark Fasheh committed Feb 3, 2006
1 parent b4c7f53 commit ebdec83
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 20 deletions.
10 changes: 4 additions & 6 deletions fs/ocfs2/extent_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,7 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode,
el = &eb->h_list;
}

if (el->l_tree_depth)
BUG();
BUG_ON(el->l_tree_depth);

for (i = 0; i < le16_to_cpu(el->l_next_free_rec); i++) {
rec = &el->l_recs[i];
Expand Down Expand Up @@ -364,8 +363,8 @@ static int ocfs2_extent_map_lookup_read(struct inode *inode,
return ret;
}

if (ent->e_tree_depth)
BUG(); /* FIXME: Make sure this isn't a corruption */
/* FIXME: Make sure this isn't a corruption */
BUG_ON(ent->e_tree_depth);

*ret_ent = ent;

Expand Down Expand Up @@ -423,8 +422,7 @@ static int ocfs2_extent_map_try_insert(struct inode *inode,
le32_to_cpu(rec->e_clusters), NULL,
NULL);

if (!old_ent)
BUG();
BUG_ON(!old_ent);

ret = -EEXIST;
if (old_ent->e_tree_depth < tree_depth)
Expand Down
12 changes: 4 additions & 8 deletions fs/ocfs2/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb,

mlog_entry("(max_buffs = %d)\n", max_buffs);

if (!osb || !osb->journal->j_journal)
BUG();
BUG_ON(!osb || !osb->journal->j_journal);

if (ocfs2_is_hard_readonly(osb)) {
ret = -EROFS;
Expand Down Expand Up @@ -672,8 +671,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)

mlog_entry_void();

if (!osb)
BUG();
BUG_ON(!osb);

journal = osb->journal;
if (!journal)
Expand Down Expand Up @@ -805,8 +803,7 @@ int ocfs2_journal_wipe(struct ocfs2_journal *journal, int full)

mlog_entry_void();

if (!journal)
BUG();
BUG_ON(!journal);

status = journal_wipe(journal->j_journal, full);
if (status < 0) {
Expand Down Expand Up @@ -1271,8 +1268,7 @@ static int ocfs2_recover_node(struct ocfs2_super *osb,

/* Should not ever be called to recover ourselves -- in that
* case we should've called ocfs2_journal_load instead. */
if (osb->node_num == node_num)
BUG();
BUG_ON(osb->node_num == node_num);

slot_num = ocfs2_node_num_to_slot(si, node_num);
if (slot_num == OCFS2_INVALID_SLOT) {
Expand Down
3 changes: 1 addition & 2 deletions fs/ocfs2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1254,8 +1254,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
osb->sb = sb;
/* Save off for ocfs2_rw_direct */
osb->s_sectsize_bits = blksize_bits(sector_size);
if (!osb->s_sectsize_bits)
BUG();
BUG_ON(!osb->s_sectsize_bits);

osb->net_response_ids = 0;
spin_lock_init(&osb->net_response_lock);
Expand Down
6 changes: 2 additions & 4 deletions fs/ocfs2/sysfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ struct inode *ocfs2_get_system_file_inode(struct ocfs2_super *osb,
if (arr && ((inode = *arr) != NULL)) {
/* get a ref in addition to the array ref */
inode = igrab(inode);
if (!inode)
BUG();
BUG_ON(!inode);

return inode;
}
Expand All @@ -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 */
if (arr && inode) {
*arr = igrab(inode);
if (!*arr)
BUG();
BUG_ON(!*arr);
}
return inode;
}
Expand Down

0 comments on commit ebdec83

Please sign in to comment.