@@ -718,8 +718,7 @@ static int add_to_chunk(struct buffer_chunk *chunk, struct buffer_head *bh,
718718 spinlock_t * lock , void (fn ) (struct buffer_chunk * ))
719719{
720720 int ret = 0 ;
721- if (chunk -> nr >= CHUNK_SIZE )
722- BUG ();
721+ BUG_ON (chunk -> nr >= CHUNK_SIZE );
723722 chunk -> bh [chunk -> nr ++ ] = bh ;
724723 if (chunk -> nr >= CHUNK_SIZE ) {
725724 ret = 1 ;
@@ -788,8 +787,7 @@ static inline int __add_jh(struct reiserfs_journal *j, struct buffer_head *bh,
788787 /* buffer must be locked for __add_jh, should be able to have
789788 * two adds at the same time
790789 */
791- if (bh -> b_private )
792- BUG ();
790+ BUG_ON (bh -> b_private );
793791 jh -> bh = bh ;
794792 bh -> b_private = jh ;
795793 }
@@ -2967,8 +2965,7 @@ static int do_journal_begin_r(struct reiserfs_transaction_handle *th,
29672965 int retval ;
29682966
29692967 reiserfs_check_lock_depth (p_s_sb , "journal_begin" );
2970- if (nblocks > journal -> j_trans_max )
2971- BUG ();
2968+ BUG_ON (nblocks > journal -> j_trans_max );
29722969
29732970 PROC_INFO_INC (p_s_sb , journal .journal_being );
29742971 /* set here for journal_join */
@@ -3084,9 +3081,8 @@ struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct
30843081 if (reiserfs_transaction_running (s )) {
30853082 th = current -> journal_info ;
30863083 th -> t_refcount ++ ;
3087- if (th -> t_refcount < 2 ) {
3088- BUG ();
3089- }
3084+ BUG_ON (th -> t_refcount < 2 );
3085+
30903086 return th ;
30913087 }
30923088 th = kmalloc (sizeof (struct reiserfs_transaction_handle ), GFP_NOFS );
@@ -3126,9 +3122,7 @@ static int journal_join(struct reiserfs_transaction_handle *th,
31263122 ** pointer
31273123 */
31283124 th -> t_handle_save = cur_th ;
3129- if (cur_th && cur_th -> t_refcount > 1 ) {
3130- BUG ();
3131- }
3125+ BUG_ON (cur_th && cur_th -> t_refcount > 1 );
31323126 return do_journal_begin_r (th , p_s_sb , nblocks , JBEGIN_JOIN );
31333127}
31343128
@@ -3141,9 +3135,7 @@ int journal_join_abort(struct reiserfs_transaction_handle *th,
31413135 ** pointer
31423136 */
31433137 th -> t_handle_save = cur_th ;
3144- if (cur_th && cur_th -> t_refcount > 1 ) {
3145- BUG ();
3146- }
3138+ BUG_ON (cur_th && cur_th -> t_refcount > 1 );
31473139 return do_journal_begin_r (th , p_s_sb , nblocks , JBEGIN_ABORT );
31483140}
31493141
@@ -3178,8 +3170,7 @@ int journal_begin(struct reiserfs_transaction_handle *th,
31783170 current -> journal_info = th ;
31793171 }
31803172 ret = do_journal_begin_r (th , p_s_sb , nblocks , JBEGIN_REG );
3181- if (current -> journal_info != th )
3182- BUG ();
3173+ BUG_ON (current -> journal_info != th );
31833174
31843175 /* I guess this boils down to being the reciprocal of clm-2100 above.
31853176 * If do_journal_begin_r fails, we need to put it back, since journal_end
@@ -3324,8 +3315,7 @@ int journal_end(struct reiserfs_transaction_handle *th,
33243315 /* we aren't allowed to close a nested transaction on a different
33253316 ** filesystem from the one in the task struct
33263317 */
3327- if (cur_th -> t_super != th -> t_super )
3328- BUG ();
3318+ BUG_ON (cur_th -> t_super != th -> t_super );
33293319
33303320 if (th != cur_th ) {
33313321 memcpy (current -> journal_info , th , sizeof (* th ));
@@ -3444,9 +3434,7 @@ int journal_end_sync(struct reiserfs_transaction_handle *th,
34443434
34453435 BUG_ON (!th -> t_trans_id );
34463436 /* you can sync while nested, very, very bad */
3447- if (th -> t_refcount > 1 ) {
3448- BUG ();
3449- }
3437+ BUG_ON (th -> t_refcount > 1 );
34503438 if (journal -> j_len == 0 ) {
34513439 reiserfs_prepare_for_journal (p_s_sb , SB_BUFFER_WITH_SB (p_s_sb ),
34523440 1 );
@@ -3556,9 +3544,8 @@ static int check_journal_end(struct reiserfs_transaction_handle *th,
35563544 ** will be dealt with by next transaction that actually writes something, but should be taken
35573545 ** care of in this trans
35583546 */
3559- if (journal -> j_len == 0 ) {
3560- BUG ();
3561- }
3547+ BUG_ON (journal -> j_len == 0 );
3548+
35623549 /* if wcount > 0, and we are called to with flush or commit_now,
35633550 ** we wait on j_join_wait. We will wake up when the last writer has
35643551 ** finished the transaction, and started it on its way to the disk.
@@ -3592,9 +3579,8 @@ static int check_journal_end(struct reiserfs_transaction_handle *th,
35923579 unlock_journal (p_s_sb );
35933580 }
35943581 }
3595- if (journal -> j_trans_id == trans_id ) {
3596- BUG ();
3597- }
3582+ BUG_ON (journal -> j_trans_id == trans_id );
3583+
35983584 if (commit_now
35993585 && journal_list_still_alive (p_s_sb , trans_id )
36003586 && wait_on_commit ) {
@@ -4074,9 +4060,7 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
40744060 set_commit_trans_len (commit , journal -> j_len );
40754061
40764062 /* special check in case all buffers in the journal were marked for not logging */
4077- if (journal -> j_len == 0 ) {
4078- BUG ();
4079- }
4063+ BUG_ON (journal -> j_len == 0 );
40804064
40814065 /* we're about to dirty all the log blocks, mark the description block
40824066 * dirty now too. Don't mark the commit block dirty until all the
@@ -4173,8 +4157,7 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
41734157 journal , jl , & jl -> j_tail_bh_list );
41744158 lock_kernel ();
41754159 }
4176- if (!list_empty (& jl -> j_tail_bh_list ))
4177- BUG ();
4160+ BUG_ON (!list_empty (& jl -> j_tail_bh_list ));
41784161 up (& jl -> j_commit_lock );
41794162
41804163 /* honor the flush wishes from the caller, simple commits can
0 commit comments