aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/journal.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs/journal.c')
-rw-r--r--fs/reiserfs/journal.c49
1 files changed, 16 insertions, 33 deletions
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index e6b5ccf23f15..ad8cbc49883a 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -718,8 +718,7 @@ static int add_to_chunk(struct buffer_chunk *chunk, struct buffer_head *bh,
718 spinlock_t * lock, void (fn) (struct buffer_chunk *)) 718 spinlock_t * lock, void (fn) (struct buffer_chunk *))
719{ 719{
720 int ret = 0; 720 int ret = 0;
721 if (chunk->nr >= CHUNK_SIZE) 721 BUG_ON(chunk->nr >= CHUNK_SIZE);
722 BUG();
723 chunk->bh[chunk->nr++] = bh; 722 chunk->bh[chunk->nr++] = bh;
724 if (chunk->nr >= CHUNK_SIZE) { 723 if (chunk->nr >= CHUNK_SIZE) {
725 ret = 1; 724 ret = 1;
@@ -788,8 +787,7 @@ static inline int __add_jh(struct reiserfs_journal *j, struct buffer_head *bh,
788 /* buffer must be locked for __add_jh, should be able to have 787 /* buffer must be locked for __add_jh, should be able to have
789 * two adds at the same time 788 * two adds at the same time
790 */ 789 */
791 if (bh->b_private) 790 BUG_ON(bh->b_private);
792 BUG();
793 jh->bh = bh; 791 jh->bh = bh;
794 bh->b_private = jh; 792 bh->b_private = jh;
795 } 793 }
@@ -2967,8 +2965,7 @@ static int do_journal_begin_r(struct reiserfs_transaction_handle *th,
2967 int retval; 2965 int retval;
2968 2966
2969 reiserfs_check_lock_depth(p_s_sb, "journal_begin"); 2967 reiserfs_check_lock_depth(p_s_sb, "journal_begin");
2970 if (nblocks > journal->j_trans_max) 2968 BUG_ON(nblocks > journal->j_trans_max);
2971 BUG();
2972 2969
2973 PROC_INFO_INC(p_s_sb, journal.journal_being); 2970 PROC_INFO_INC(p_s_sb, journal.journal_being);
2974 /* set here for journal_join */ 2971 /* set here for journal_join */
@@ -3084,9 +3081,8 @@ struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct
3084 if (reiserfs_transaction_running(s)) { 3081 if (reiserfs_transaction_running(s)) {
3085 th = current->journal_info; 3082 th = current->journal_info;
3086 th->t_refcount++; 3083 th->t_refcount++;
3087 if (th->t_refcount < 2) { 3084 BUG_ON(th->t_refcount < 2);
3088 BUG(); 3085
3089 }
3090 return th; 3086 return th;
3091 } 3087 }
3092 th = kmalloc(sizeof(struct reiserfs_transaction_handle), GFP_NOFS); 3088 th = kmalloc(sizeof(struct reiserfs_transaction_handle), GFP_NOFS);
@@ -3126,9 +3122,7 @@ static int journal_join(struct reiserfs_transaction_handle *th,
3126 ** pointer 3122 ** pointer
3127 */ 3123 */
3128 th->t_handle_save = cur_th; 3124 th->t_handle_save = cur_th;
3129 if (cur_th && cur_th->t_refcount > 1) { 3125 BUG_ON(cur_th && cur_th->t_refcount > 1);
3130 BUG();
3131 }
3132 return do_journal_begin_r(th, p_s_sb, nblocks, JBEGIN_JOIN); 3126 return do_journal_begin_r(th, p_s_sb, nblocks, JBEGIN_JOIN);
3133} 3127}
3134 3128
@@ -3141,9 +3135,7 @@ int journal_join_abort(struct reiserfs_transaction_handle *th,
3141 ** pointer 3135 ** pointer
3142 */ 3136 */
3143 th->t_handle_save = cur_th; 3137 th->t_handle_save = cur_th;
3144 if (cur_th && cur_th->t_refcount > 1) { 3138 BUG_ON(cur_th && cur_th->t_refcount > 1);
3145 BUG();
3146 }
3147 return do_journal_begin_r(th, p_s_sb, nblocks, JBEGIN_ABORT); 3139 return do_journal_begin_r(th, p_s_sb, nblocks, JBEGIN_ABORT);
3148} 3140}
3149 3141
@@ -3178,8 +3170,7 @@ int journal_begin(struct reiserfs_transaction_handle *th,
3178 current->journal_info = th; 3170 current->journal_info = th;
3179 } 3171 }
3180 ret = do_journal_begin_r(th, p_s_sb, nblocks, JBEGIN_REG); 3172 ret = do_journal_begin_r(th, p_s_sb, nblocks, JBEGIN_REG);
3181 if (current->journal_info != th) 3173 BUG_ON(current->journal_info != th);
3182 BUG();
3183 3174
3184 /* I guess this boils down to being the reciprocal of clm-2100 above. 3175 /* I guess this boils down to being the reciprocal of clm-2100 above.
3185 * If do_journal_begin_r fails, we need to put it back, since journal_end 3176 * 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,
3324 /* we aren't allowed to close a nested transaction on a different 3315 /* we aren't allowed to close a nested transaction on a different
3325 ** filesystem from the one in the task struct 3316 ** filesystem from the one in the task struct
3326 */ 3317 */
3327 if (cur_th->t_super != th->t_super) 3318 BUG_ON(cur_th->t_super != th->t_super);
3328 BUG();
3329 3319
3330 if (th != cur_th) { 3320 if (th != cur_th) {
3331 memcpy(current->journal_info, th, sizeof(*th)); 3321 memcpy(current->journal_info, th, sizeof(*th));
@@ -3444,9 +3434,7 @@ int journal_end_sync(struct reiserfs_transaction_handle *th,
3444 3434
3445 BUG_ON(!th->t_trans_id); 3435 BUG_ON(!th->t_trans_id);
3446 /* you can sync while nested, very, very bad */ 3436 /* you can sync while nested, very, very bad */
3447 if (th->t_refcount > 1) { 3437 BUG_ON(th->t_refcount > 1);
3448 BUG();
3449 }
3450 if (journal->j_len == 0) { 3438 if (journal->j_len == 0) {
3451 reiserfs_prepare_for_journal(p_s_sb, SB_BUFFER_WITH_SB(p_s_sb), 3439 reiserfs_prepare_for_journal(p_s_sb, SB_BUFFER_WITH_SB(p_s_sb),
3452 1); 3440 1);
@@ -3556,9 +3544,8 @@ static int check_journal_end(struct reiserfs_transaction_handle *th,
3556 ** will be dealt with by next transaction that actually writes something, but should be taken 3544 ** will be dealt with by next transaction that actually writes something, but should be taken
3557 ** care of in this trans 3545 ** care of in this trans
3558 */ 3546 */
3559 if (journal->j_len == 0) { 3547 BUG_ON(journal->j_len == 0);
3560 BUG(); 3548
3561 }
3562 /* if wcount > 0, and we are called to with flush or commit_now, 3549 /* if wcount > 0, and we are called to with flush or commit_now,
3563 ** we wait on j_join_wait. We will wake up when the last writer has 3550 ** we wait on j_join_wait. We will wake up when the last writer has
3564 ** finished the transaction, and started it on its way to the disk. 3551 ** 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,
3592 unlock_journal(p_s_sb); 3579 unlock_journal(p_s_sb);
3593 } 3580 }
3594 } 3581 }
3595 if (journal->j_trans_id == trans_id) { 3582 BUG_ON(journal->j_trans_id == trans_id);
3596 BUG(); 3583
3597 }
3598 if (commit_now 3584 if (commit_now
3599 && journal_list_still_alive(p_s_sb, trans_id) 3585 && journal_list_still_alive(p_s_sb, trans_id)
3600 && wait_on_commit) { 3586 && wait_on_commit) {
@@ -4074,9 +4060,7 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
4074 set_commit_trans_len(commit, journal->j_len); 4060 set_commit_trans_len(commit, journal->j_len);
4075 4061
4076 /* special check in case all buffers in the journal were marked for not logging */ 4062 /* special check in case all buffers in the journal were marked for not logging */
4077 if (journal->j_len == 0) { 4063 BUG_ON(journal->j_len == 0);
4078 BUG();
4079 }
4080 4064
4081 /* we're about to dirty all the log blocks, mark the description block 4065 /* we're about to dirty all the log blocks, mark the description block
4082 * dirty now too. Don't mark the commit block dirty until all the 4066 * 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,
4173 journal, jl, &jl->j_tail_bh_list); 4157 journal, jl, &jl->j_tail_bh_list);
4174 lock_kernel(); 4158 lock_kernel();
4175 } 4159 }
4176 if (!list_empty(&jl->j_tail_bh_list)) 4160 BUG_ON(!list_empty(&jl->j_tail_bh_list));
4177 BUG();
4178 up(&jl->j_commit_lock); 4161 up(&jl->j_commit_lock);
4179 4162
4180 /* honor the flush wishes from the caller, simple commits can 4163 /* honor the flush wishes from the caller, simple commits can