diff options
author | Eric Sesterhenn / snakebyte <snakebyte@gmx.de> | 2006-01-27 04:32:52 -0500 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2006-02-03 16:54:22 -0500 |
commit | ebdec83ba46c123fe3bfdcaacf62d0dfe8fe4187 (patch) | |
tree | acd18f3170c1de8295375cadb0a33fa23066524e | |
parent | b4c7f538508adcde7a0a5162faec0b2ab19b90bd (diff) |
[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: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
-rw-r--r-- | fs/ocfs2/extent_map.c | 10 | ||||
-rw-r--r-- | fs/ocfs2/journal.c | 12 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 3 | ||||
-rw-r--r-- | fs/ocfs2/sysfile.c | 6 |
4 files changed, 11 insertions, 20 deletions
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c index eb2bd8a4ca82..b6ba292e9544 100644 --- a/fs/ocfs2/extent_map.c +++ b/fs/ocfs2/extent_map.c | |||
@@ -262,8 +262,7 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode, | |||
262 | el = &eb->h_list; | 262 | el = &eb->h_list; |
263 | } | 263 | } |
264 | 264 | ||
265 | if (el->l_tree_depth) | 265 | BUG_ON(el->l_tree_depth); |
266 | BUG(); | ||
267 | 266 | ||
268 | for (i = 0; i < le16_to_cpu(el->l_next_free_rec); i++) { | 267 | for (i = 0; i < le16_to_cpu(el->l_next_free_rec); i++) { |
269 | rec = &el->l_recs[i]; | 268 | rec = &el->l_recs[i]; |
@@ -364,8 +363,8 @@ static int ocfs2_extent_map_lookup_read(struct inode *inode, | |||
364 | return ret; | 363 | return ret; |
365 | } | 364 | } |
366 | 365 | ||
367 | if (ent->e_tree_depth) | 366 | /* FIXME: Make sure this isn't a corruption */ |
368 | BUG(); /* FIXME: Make sure this isn't a corruption */ | 367 | BUG_ON(ent->e_tree_depth); |
369 | 368 | ||
370 | *ret_ent = ent; | 369 | *ret_ent = ent; |
371 | 370 | ||
@@ -423,8 +422,7 @@ static int ocfs2_extent_map_try_insert(struct inode *inode, | |||
423 | le32_to_cpu(rec->e_clusters), NULL, | 422 | le32_to_cpu(rec->e_clusters), NULL, |
424 | NULL); | 423 | NULL); |
425 | 424 | ||
426 | if (!old_ent) | 425 | BUG_ON(!old_ent); |
427 | BUG(); | ||
428 | 426 | ||
429 | ret = -EEXIST; | 427 | ret = -EEXIST; |
430 | if (old_ent->e_tree_depth < tree_depth) | 428 | if (old_ent->e_tree_depth < tree_depth) |
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index ccabed9a0aad..b71b3385fdbd 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -147,8 +147,7 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb, | |||
147 | 147 | ||
148 | mlog_entry("(max_buffs = %d)\n", max_buffs); | 148 | mlog_entry("(max_buffs = %d)\n", max_buffs); |
149 | 149 | ||
150 | if (!osb || !osb->journal->j_journal) | 150 | BUG_ON(!osb || !osb->journal->j_journal); |
151 | BUG(); | ||
152 | 151 | ||
153 | if (ocfs2_is_hard_readonly(osb)) { | 152 | if (ocfs2_is_hard_readonly(osb)) { |
154 | ret = -EROFS; | 153 | ret = -EROFS; |
@@ -672,8 +671,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) | |||
672 | 671 | ||
673 | mlog_entry_void(); | 672 | mlog_entry_void(); |
674 | 673 | ||
675 | if (!osb) | 674 | BUG_ON(!osb); |
676 | BUG(); | ||
677 | 675 | ||
678 | journal = osb->journal; | 676 | journal = osb->journal; |
679 | if (!journal) | 677 | if (!journal) |
@@ -805,8 +803,7 @@ int ocfs2_journal_wipe(struct ocfs2_journal *journal, int full) | |||
805 | 803 | ||
806 | mlog_entry_void(); | 804 | mlog_entry_void(); |
807 | 805 | ||
808 | if (!journal) | 806 | BUG_ON(!journal); |
809 | BUG(); | ||
810 | 807 | ||
811 | status = journal_wipe(journal->j_journal, full); | 808 | status = journal_wipe(journal->j_journal, full); |
812 | if (status < 0) { | 809 | if (status < 0) { |
@@ -1271,8 +1268,7 @@ static int ocfs2_recover_node(struct ocfs2_super *osb, | |||
1271 | 1268 | ||
1272 | /* Should not ever be called to recover ourselves -- in that | 1269 | /* Should not ever be called to recover ourselves -- in that |
1273 | * case we should've called ocfs2_journal_load instead. */ | 1270 | * case we should've called ocfs2_journal_load instead. */ |
1274 | if (osb->node_num == node_num) | 1271 | BUG_ON(osb->node_num == node_num); |
1275 | BUG(); | ||
1276 | 1272 | ||
1277 | slot_num = ocfs2_node_num_to_slot(si, node_num); | 1273 | slot_num = ocfs2_node_num_to_slot(si, node_num); |
1278 | if (slot_num == OCFS2_INVALID_SLOT) { | 1274 | if (slot_num == OCFS2_INVALID_SLOT) { |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index e7e17bdf6296..046824b6b625 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -1254,8 +1254,7 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1254 | osb->sb = sb; | 1254 | osb->sb = sb; |
1255 | /* Save off for ocfs2_rw_direct */ | 1255 | /* Save off for ocfs2_rw_direct */ |
1256 | osb->s_sectsize_bits = blksize_bits(sector_size); | 1256 | osb->s_sectsize_bits = blksize_bits(sector_size); |
1257 | if (!osb->s_sectsize_bits) | 1257 | BUG_ON(!osb->s_sectsize_bits); |
1258 | BUG(); | ||
1259 | 1258 | ||
1260 | osb->net_response_ids = 0; | 1259 | osb->net_response_ids = 0; |
1261 | spin_lock_init(&osb->net_response_lock); | 1260 | spin_lock_init(&osb->net_response_lock); |
diff --git a/fs/ocfs2/sysfile.c b/fs/ocfs2/sysfile.c index 600a8bc5b541..fc29cb7a437d 100644 --- a/fs/ocfs2/sysfile.c +++ b/fs/ocfs2/sysfile.c | |||
@@ -77,8 +77,7 @@ struct inode *ocfs2_get_system_file_inode(struct ocfs2_super *osb, | |||
77 | if (arr && ((inode = *arr) != NULL)) { | 77 | if (arr && ((inode = *arr) != NULL)) { |
78 | /* get a ref in addition to the array ref */ | 78 | /* get a ref in addition to the array ref */ |
79 | inode = igrab(inode); | 79 | inode = igrab(inode); |
80 | if (!inode) | 80 | BUG_ON(!inode); |
81 | BUG(); | ||
82 | 81 | ||
83 | return inode; | 82 | return inode; |
84 | } | 83 | } |
@@ -89,8 +88,7 @@ struct inode *ocfs2_get_system_file_inode(struct ocfs2_super *osb, | |||
89 | /* add one more if putting into array for first time */ | 88 | /* add one more if putting into array for first time */ |
90 | if (arr && inode) { | 89 | if (arr && inode) { |
91 | *arr = igrab(inode); | 90 | *arr = igrab(inode); |
92 | if (!*arr) | 91 | BUG_ON(!*arr); |
93 | BUG(); | ||
94 | } | 92 | } |
95 | return inode; | 93 | return inode; |
96 | } | 94 | } |