This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / fs / jbd / commit.c
index 875e06b..5a2fe25 100644 (file)
@@ -545,6 +545,7 @@ wait_for_iobuf:
                        wait_on_buffer(bh);
                        goto wait_for_iobuf;
                }
+               cond_resched();
 
                if (unlikely(!buffer_uptodate(bh)))
                        err = -EIO;
@@ -579,7 +580,7 @@ wait_for_iobuf:
                journal_file_buffer(jh, commit_transaction, BJ_Forget);
                /* Wake up any transactions which were waiting for this
                   IO to complete */
-               wake_up_bit(&bh->b_state, BH_Unshadow);
+               wake_up_buffer(bh);
                JBUFFER_TRACE(jh, "brelse shadowed buffer");
                __brelse(bh);
        }
@@ -599,6 +600,7 @@ wait_for_iobuf:
                        wait_on_buffer(bh);
                        goto wait_for_ctlbuf;
                }
+               cond_resched();
 
                if (unlikely(!buffer_uptodate(bh)))
                        err = -EIO;
@@ -686,6 +688,30 @@ skip_commit: /* The journal should be unlocked by now. */
        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);
@@ -768,6 +794,7 @@ skip_commit: /* The journal should be unlocked by now. */
                        release_buffer_page(bh);
                }
                spin_unlock(&journal->j_list_lock);
+               cond_resched();
        }
 
        /* Done with this transaction! */