__journal_file_buffer(jh, commit_transaction,
BJ_Locked);
jbd_unlock_bh_state(bh);
- if (need_resched()) {
+ if (lock_need_resched(&journal->j_list_lock)) {
spin_unlock(&journal->j_list_lock);
goto write_out_data;
}
jbd_unlock_bh_state(bh);
journal_remove_journal_head(bh);
put_bh(bh);
- if (need_resched()) {
+ if (lock_need_resched(&journal->j_list_lock)) {
spin_unlock(&journal->j_list_lock);
goto write_out_data;
}
jbd_unlock_bh_state(bh);
}
put_bh(bh);
- if (need_resched()) {
- spin_unlock(&journal->j_list_lock);
- cond_resched();
- spin_lock(&journal->j_list_lock);
- }
+ cond_resched_lock(&journal->j_list_lock);
}
spin_unlock(&journal->j_list_lock);
+ if (err)
+ __journal_abort_hard(journal);
+
journal_write_revoke_records(journal, commit_transaction);
jbd_debug(3, "JBD: commit phase 2\n");
wait_on_buffer(bh);
goto wait_for_iobuf;
}
+ if (cond_resched())
+ goto wait_for_iobuf;
if (unlikely(!buffer_uptodate(bh)))
err = -EIO;
journal_file_buffer(jh, commit_transaction, BJ_Forget);
/* Wake up any transactions which were waiting for this
IO to complete */
- wake_up_buffer(bh);
+ wake_up_bit(&bh->b_state, BH_Unshadow);
JBUFFER_TRACE(jh, "brelse shadowed buffer");
__brelse(bh);
}
wait_on_buffer(bh);
goto wait_for_ctlbuf;
}
+ if (cond_resched())
+ goto wait_for_ctlbuf;
if (unlikely(!buffer_uptodate(bh)))
err = -EIO;
if (err)
__journal_abort_hard(journal);
- /*
- * Call any callbacks that had been registered for handles in this
- * transaction. It is up to the callback to free any allocated
- * memory.
- *
- * The spinlocking (t_jcb_lock) here is surely unnecessary...
- */
- spin_lock(&commit_transaction->t_jcb_lock);
- if (!list_empty(&commit_transaction->t_jcb)) {
- struct list_head *p, *n;
- int error = is_journal_aborted(journal);
-
- list_for_each_safe(p, n, &commit_transaction->t_jcb) {
- struct journal_callback *jcb;
-
- jcb = list_entry(p, struct journal_callback, jcb_list);
- list_del(p);
- spin_unlock(&commit_transaction->t_jcb_lock);
- jcb->jcb_func(jcb, error);
- spin_lock(&commit_transaction->t_jcb_lock);
- }
- }
- spin_unlock(&commit_transaction->t_jcb_lock);
-
jbd_debug(3, "JBD: commit phase 7\n");
J_ASSERT(commit_transaction->t_sync_datalist == NULL);
J_ASSERT(commit_transaction->t_shadow_list == NULL);
J_ASSERT(commit_transaction->t_log_list == NULL);
+restart_loop:
while (commit_transaction->t_forget) {
transaction_t *cp_transaction;
struct buffer_head *bh;
release_buffer_page(bh);
}
spin_unlock(&journal->j_list_lock);
+ if (cond_resched())
+ goto restart_loop;
}
/* Done with this transaction! */