4 * Written by Stephen C. Tweedie <sct@redhat.com>, 1998
6 * Copyright 1998 Red Hat corp --- All Rights Reserved
8 * This file is part of the Linux kernel and is made available under
9 * the terms of the GNU General Public License, version 2, or at your
10 * option, any later version, incorporated herein by reference.
12 * Journal commit routines for the generic filesystem journaling code;
13 * part of the ext2fs journaling system.
16 #include <linux/time.h>
18 #include <linux/jbd.h>
19 #include <linux/errno.h>
20 #include <linux/slab.h>
22 #include <linux/pagemap.h>
23 #include <linux/smp_lock.h>
26 * Default IO end handler for temporary BJ_IO buffer_heads.
28 static void journal_end_buffer_io_sync(struct buffer_head *bh, int uptodate)
32 set_buffer_uptodate(bh);
34 clear_buffer_uptodate(bh);
39 * When an ext3-ordered file is truncated, it is possible that many pages are
40 * not sucessfully freed, because they are attached to a committing transaction.
41 * After the transaction commits, these pages are left on the LRU, with no
42 * ->mapping, and with attached buffers. These pages are trivially reclaimable
43 * by the VM, but their apparent absence upsets the VM accounting, and it makes
44 * the numbers in /proc/meminfo look odd.
46 * So here, we have a buffer which has just come off the forget list. Look to
47 * see if we can strip all buffers from the backing page.
49 * Called under lock_journal(), and possibly under journal_datalist_lock. The
50 * caller provided us with a ref against the buffer, and we drop that here.
52 static void release_buffer_page(struct buffer_head *bh)
58 if (atomic_read(&bh->b_count) != 1)
66 /* OK, it's a truncated page */
67 if (TestSetPageLocked(page))
72 try_to_free_buffers(page);
74 page_cache_release(page);
82 * Try to acquire jbd_lock_bh_state() against the buffer, when j_list_lock is
83 * held. For ranking reasons we must trylock. If we lose, schedule away and
84 * return 0. j_list_lock is dropped in this case.
86 static int inverted_lock(journal_t *journal, struct buffer_head *bh)
88 if (!jbd_trylock_bh_state(bh)) {
89 spin_unlock(&journal->j_list_lock);
97 * journal_commit_transaction
99 * The primary function for committing a transaction to the log. This
100 * function is called by the journal thread to begin a complete commit.
102 void journal_commit_transaction(journal_t *journal)
104 transaction_t *commit_transaction;
105 struct journal_head *jh, *new_jh, *descriptor;
106 struct buffer_head *wbuf[64];
110 unsigned long blocknr;
112 journal_header_t *header;
113 journal_block_tag_t *tag = NULL;
120 * First job: lock down the current transaction and wait for
121 * all outstanding updates to complete.
125 spin_lock(&journal->j_list_lock);
126 summarise_journal_usage(journal);
127 spin_unlock(&journal->j_list_lock);
130 /* Do we need to erase the effects of a prior journal_flush? */
131 if (journal->j_flags & JFS_FLUSHED) {
132 jbd_debug(3, "super block updated\n");
133 journal_update_superblock(journal, 1);
135 jbd_debug(3, "superblock not updated\n");
138 J_ASSERT(journal->j_running_transaction != NULL);
139 J_ASSERT(journal->j_committing_transaction == NULL);
141 commit_transaction = journal->j_running_transaction;
142 J_ASSERT(commit_transaction->t_state == T_RUNNING);
144 jbd_debug(1, "JBD: starting commit of transaction %d\n",
145 commit_transaction->t_tid);
147 spin_lock(&journal->j_state_lock);
148 commit_transaction->t_state = T_LOCKED;
150 spin_lock(&commit_transaction->t_handle_lock);
151 while (commit_transaction->t_updates) {
154 prepare_to_wait(&journal->j_wait_updates, &wait,
155 TASK_UNINTERRUPTIBLE);
156 if (commit_transaction->t_updates) {
157 spin_unlock(&commit_transaction->t_handle_lock);
158 spin_unlock(&journal->j_state_lock);
160 spin_lock(&journal->j_state_lock);
161 spin_lock(&commit_transaction->t_handle_lock);
163 finish_wait(&journal->j_wait_updates, &wait);
165 spin_unlock(&commit_transaction->t_handle_lock);
167 J_ASSERT (commit_transaction->t_outstanding_credits <=
168 journal->j_max_transaction_buffers);
171 * First thing we are allowed to do is to discard any remaining
172 * BJ_Reserved buffers. Note, it is _not_ permissible to assume
173 * that there are no such buffers: if a large filesystem
174 * operation like a truncate needs to split itself over multiple
175 * transactions, then it may try to do a journal_restart() while
176 * there are still BJ_Reserved buffers outstanding. These must
177 * be released cleanly from the current transaction.
179 * In this case, the filesystem must still reserve write access
180 * again before modifying the buffer in the new transaction, but
181 * we do not require it to remember exactly which old buffers it
182 * has reserved. This is consistent with the existing behaviour
183 * that multiple journal_get_write_access() calls to the same
184 * buffer are perfectly permissable.
186 while (commit_transaction->t_reserved_list) {
187 jh = commit_transaction->t_reserved_list;
188 JBUFFER_TRACE(jh, "reserved, unused: refile");
190 * A journal_get_undo_access()+journal_release_buffer() may
191 * leave undo-committed data.
193 if (jh->b_committed_data) {
194 struct buffer_head *bh = jh2bh(jh);
196 jbd_lock_bh_state(bh);
197 if (jh->b_committed_data) {
198 kfree(jh->b_committed_data);
199 jh->b_committed_data = NULL;
201 jbd_unlock_bh_state(bh);
203 journal_refile_buffer(journal, jh);
207 * Now try to drop any written-back buffers from the journal's
208 * checkpoint lists. We do this *before* commit because it potentially
211 spin_lock(&journal->j_list_lock);
212 __journal_clean_checkpoint_list(journal);
213 spin_unlock(&journal->j_list_lock);
215 jbd_debug (3, "JBD: commit phase 1\n");
218 * Switch to a new revoke table.
220 journal_switch_revoke_table(journal);
222 commit_transaction->t_state = T_FLUSH;
223 journal->j_committing_transaction = commit_transaction;
224 journal->j_running_transaction = NULL;
225 commit_transaction->t_log_start = journal->j_head;
226 wake_up(&journal->j_wait_transaction_locked);
227 spin_unlock(&journal->j_state_lock);
229 jbd_debug (3, "JBD: commit phase 2\n");
232 * Now start flushing things to disk, in the order they appear
233 * on the transaction lists. Data blocks go first.
238 * Whenever we unlock the journal and sleep, things can get added
239 * onto ->t_sync_datalist, so we have to keep looping back to
240 * write_out_data until we *know* that the list is empty.
244 * Cleanup any flushed data buffers from the data list. Even in
245 * abort mode, we want to flush this out as soon as possible.
249 spin_lock(&journal->j_list_lock);
251 while (commit_transaction->t_sync_datalist) {
252 struct buffer_head *bh;
254 jh = commit_transaction->t_sync_datalist;
255 commit_transaction->t_sync_datalist = jh->b_tnext;
257 if (buffer_locked(bh)) {
258 BUFFER_TRACE(bh, "locked");
259 if (!inverted_lock(journal, bh))
261 __journal_unfile_buffer(jh);
262 __journal_file_buffer(jh, commit_transaction,
264 jbd_unlock_bh_state(bh);
265 if (need_resched()) {
266 spin_unlock(&journal->j_list_lock);
270 if (buffer_dirty(bh)) {
271 BUFFER_TRACE(bh, "start journal writeout");
274 if (bufs == ARRAY_SIZE(wbuf)) {
275 jbd_debug(2, "submit %d writes\n",
277 spin_unlock(&journal->j_list_lock);
278 ll_rw_block(WRITE, bufs, wbuf);
279 journal_brelse_array(wbuf, bufs);
284 BUFFER_TRACE(bh, "writeout complete: unfile");
285 if (!inverted_lock(journal, bh))
287 __journal_unfile_buffer(jh);
288 jbd_unlock_bh_state(bh);
289 journal_remove_journal_head(bh);
291 if (need_resched()) {
292 spin_unlock(&journal->j_list_lock);
300 spin_unlock(&journal->j_list_lock);
301 ll_rw_block(WRITE, bufs, wbuf);
302 journal_brelse_array(wbuf, bufs);
303 spin_lock(&journal->j_list_lock);
307 * Wait for all previously submitted IO to complete.
309 while (commit_transaction->t_locked_list) {
310 struct buffer_head *bh;
312 jh = commit_transaction->t_locked_list->b_tprev;
315 if (buffer_locked(bh)) {
316 spin_unlock(&journal->j_list_lock);
318 if (unlikely(!buffer_uptodate(bh)))
320 spin_lock(&journal->j_list_lock);
322 if (!inverted_lock(journal, bh)) {
324 spin_lock(&journal->j_list_lock);
327 if (buffer_jbd(bh) && jh->b_jlist == BJ_Locked) {
328 __journal_unfile_buffer(jh);
329 jbd_unlock_bh_state(bh);
330 journal_remove_journal_head(bh);
333 jbd_unlock_bh_state(bh);
336 if (need_resched()) {
337 spin_unlock(&journal->j_list_lock);
339 spin_lock(&journal->j_list_lock);
342 spin_unlock(&journal->j_list_lock);
344 journal_write_revoke_records(journal, commit_transaction);
346 jbd_debug(3, "JBD: commit phase 2\n");
349 * If we found any dirty or locked buffers, then we should have
350 * looped back up to the write_out_data label. If there weren't
351 * any then journal_clean_data_list should have wiped the list
352 * clean by now, so check that it is in fact empty.
354 J_ASSERT (commit_transaction->t_sync_datalist == NULL);
356 jbd_debug (3, "JBD: commit phase 3\n");
359 * Way to go: we have now written out all of the data for a
360 * transaction! Now comes the tricky part: we need to write out
361 * metadata. Loop over the transaction's entire buffer list:
363 commit_transaction->t_state = T_COMMIT;
367 while (commit_transaction->t_buffers) {
369 /* Find the next buffer to be journaled... */
371 jh = commit_transaction->t_buffers;
373 /* If we're in abort mode, we just un-journal the buffer and
374 release it for background writing. */
376 if (is_journal_aborted(journal)) {
377 JBUFFER_TRACE(jh, "journal is aborting: refile");
378 journal_refile_buffer(journal, jh);
379 /* If that was the last one, we need to clean up
380 * any descriptor buffers which may have been
381 * already allocated, even if we are now
383 if (!commit_transaction->t_buffers)
384 goto start_journal_io;
388 /* Make sure we have a descriptor block in which to
389 record the metadata buffer. */
392 struct buffer_head *bh;
394 J_ASSERT (bufs == 0);
396 jbd_debug(4, "JBD: get descriptor\n");
398 descriptor = journal_get_descriptor_buffer(journal);
400 __journal_abort_hard(journal);
404 bh = jh2bh(descriptor);
405 jbd_debug(4, "JBD: got buffer %llu (%p)\n",
406 (unsigned long long)bh->b_blocknr, bh->b_data);
407 header = (journal_header_t *)&bh->b_data[0];
408 header->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER);
409 header->h_blocktype = cpu_to_be32(JFS_DESCRIPTOR_BLOCK);
410 header->h_sequence = cpu_to_be32(commit_transaction->t_tid);
412 tagp = &bh->b_data[sizeof(journal_header_t)];
413 space_left = bh->b_size - sizeof(journal_header_t);
415 set_buffer_jwrite(bh);
416 set_buffer_dirty(bh);
419 /* Record it so that we can wait for IO
421 BUFFER_TRACE(bh, "ph3: file as descriptor");
422 journal_file_buffer(descriptor, commit_transaction,
426 /* Where is the buffer to be written? */
428 err = journal_next_log_block(journal, &blocknr);
429 /* If the block mapping failed, just abandon the buffer
430 and repeat this loop: we'll fall into the
431 refile-on-abort condition above. */
433 __journal_abort_hard(journal);
438 * start_this_handle() uses t_outstanding_credits to determine
439 * the free space in the log, but this counter is changed
440 * by journal_next_log_block() also.
442 commit_transaction->t_outstanding_credits--;
444 /* Bump b_count to prevent truncate from stumbling over
445 the shadowed buffer! @@@ This can go if we ever get
446 rid of the BJ_IO/BJ_Shadow pairing of buffers. */
447 atomic_inc(&jh2bh(jh)->b_count);
449 /* Make a temporary IO buffer with which to write it out
450 (this will requeue both the metadata buffer and the
451 temporary IO buffer). new_bh goes on BJ_IO*/
453 set_bit(BH_JWrite, &jh2bh(jh)->b_state);
455 * akpm: journal_write_metadata_buffer() sets
456 * new_bh->b_transaction to commit_transaction.
457 * We need to clean this up before we release new_bh
458 * (which is of type BJ_IO)
460 JBUFFER_TRACE(jh, "ph3: write metadata");
461 flags = journal_write_metadata_buffer(commit_transaction,
462 jh, &new_jh, blocknr);
463 set_bit(BH_JWrite, &jh2bh(new_jh)->b_state);
464 wbuf[bufs++] = jh2bh(new_jh);
466 /* Record the new block's tag in the current descriptor
471 tag_flag |= JFS_FLAG_ESCAPE;
473 tag_flag |= JFS_FLAG_SAME_UUID;
475 tag = (journal_block_tag_t *) tagp;
476 tag->t_blocknr = cpu_to_be32(jh2bh(jh)->b_blocknr);
477 tag->t_flags = cpu_to_be32(tag_flag);
478 tagp += sizeof(journal_block_tag_t);
479 space_left -= sizeof(journal_block_tag_t);
482 memcpy (tagp, journal->j_uuid, 16);
488 /* If there's no more to do, or if the descriptor is full,
491 if (bufs == ARRAY_SIZE(wbuf) ||
492 commit_transaction->t_buffers == NULL ||
493 space_left < sizeof(journal_block_tag_t) + 16) {
495 jbd_debug(4, "JBD: Submit %d IOs\n", bufs);
497 /* Write an end-of-descriptor marker before
498 submitting the IOs. "tag" still points to
499 the last tag we set up. */
501 tag->t_flags |= cpu_to_be32(JFS_FLAG_LAST_TAG);
504 for (i = 0; i < bufs; i++) {
505 struct buffer_head *bh = wbuf[i];
507 clear_buffer_dirty(bh);
508 set_buffer_uptodate(bh);
509 bh->b_end_io = journal_end_buffer_io_sync;
510 submit_bh(WRITE, bh);
514 /* Force a new descriptor to be generated next
515 time round the loop. */
521 /* Lo and behold: we have just managed to send a transaction to
522 the log. Before we can commit it, wait for the IO so far to
523 complete. Control buffers being written are on the
524 transaction's t_log_list queue, and metadata buffers are on
525 the t_iobuf_list queue.
527 Wait for the buffers in reverse order. That way we are
528 less likely to be woken up until all IOs have completed, and
529 so we incur less scheduling load.
532 jbd_debug(3, "JBD: commit phase 4\n");
535 * akpm: these are BJ_IO, and j_list_lock is not needed.
536 * See __journal_try_to_free_buffer.
539 while (commit_transaction->t_iobuf_list != NULL) {
540 struct buffer_head *bh;
542 jh = commit_transaction->t_iobuf_list->b_tprev;
544 if (buffer_locked(bh)) {
550 if (unlikely(!buffer_uptodate(bh)))
553 clear_buffer_jwrite(bh);
555 JBUFFER_TRACE(jh, "ph4: unfile after journal write");
556 journal_unfile_buffer(journal, jh);
559 * ->t_iobuf_list should contain only dummy buffer_heads
560 * which were created by journal_write_metadata_buffer().
562 BUFFER_TRACE(bh, "dumping temporary bh");
563 journal_put_journal_head(jh);
565 J_ASSERT_BH(bh, atomic_read(&bh->b_count) == 0);
566 free_buffer_head(bh);
568 /* We also have to unlock and free the corresponding
570 jh = commit_transaction->t_shadow_list->b_tprev;
572 clear_bit(BH_JWrite, &bh->b_state);
573 J_ASSERT_BH(bh, buffer_jbddirty(bh));
575 /* The metadata is now released for reuse, but we need
576 to remember it against this transaction so that when
577 we finally commit, we can do any checkpointing
579 JBUFFER_TRACE(jh, "file as BJ_Forget");
580 journal_file_buffer(jh, commit_transaction, BJ_Forget);
581 /* Wake up any transactions which were waiting for this
584 JBUFFER_TRACE(jh, "brelse shadowed buffer");
588 J_ASSERT (commit_transaction->t_shadow_list == NULL);
590 jbd_debug(3, "JBD: commit phase 5\n");
592 /* Here we wait for the revoke record and descriptor record buffers */
594 while (commit_transaction->t_log_list != NULL) {
595 struct buffer_head *bh;
597 jh = commit_transaction->t_log_list->b_tprev;
599 if (buffer_locked(bh)) {
601 goto wait_for_ctlbuf;
605 if (unlikely(!buffer_uptodate(bh)))
608 BUFFER_TRACE(bh, "ph5: control buffer writeout done: unfile");
609 clear_buffer_jwrite(bh);
610 journal_unfile_buffer(journal, jh);
611 journal_put_journal_head(jh);
612 __brelse(bh); /* One for getblk */
613 /* AKPM: bforget here */
616 jbd_debug(3, "JBD: commit phase 6\n");
618 if (is_journal_aborted(journal))
621 /* Done it all: now write the commit record. We should have
622 * cleaned up our previous buffers by now, so if we are in abort
623 * mode we can now just skip the rest of the journal write
626 descriptor = journal_get_descriptor_buffer(journal);
628 __journal_abort_hard(journal);
632 /* AKPM: buglet - add `i' to tmp! */
633 for (i = 0; i < jh2bh(descriptor)->b_size; i += 512) {
634 journal_header_t *tmp =
635 (journal_header_t*)jh2bh(descriptor)->b_data;
636 tmp->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER);
637 tmp->h_blocktype = cpu_to_be32(JFS_COMMIT_BLOCK);
638 tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid);
641 JBUFFER_TRACE(descriptor, "write commit block");
643 struct buffer_head *bh = jh2bh(descriptor);
645 int barrier_done = 0;
647 set_buffer_dirty(bh);
648 if (journal->j_flags & JFS_BARRIER) {
649 set_buffer_ordered(bh);
652 ret = sync_dirty_buffer(bh);
653 /* is it possible for another commit to fail at roughly
654 * the same time as this one? If so, we don't want to
655 * trust the barrier flag in the super, but instead want
656 * to remember if we sent a barrier request
658 if (ret == -EOPNOTSUPP && barrier_done) {
659 char b[BDEVNAME_SIZE];
662 "JBD: barrier-based sync failed on %s - "
663 "disabling barriers\n",
664 bdevname(journal->j_dev, b));
665 spin_lock(&journal->j_state_lock);
666 journal->j_flags &= ~JFS_BARRIER;
667 spin_unlock(&journal->j_state_lock);
669 /* And try again, without the barrier */
670 clear_buffer_ordered(bh);
671 set_buffer_uptodate(bh);
672 set_buffer_dirty(bh);
673 ret = sync_dirty_buffer(bh);
675 if (unlikely(ret == -EIO))
677 put_bh(bh); /* One for getblk() */
678 journal_put_journal_head(descriptor);
681 /* End of a transaction! Finally, we can do checkpoint
682 processing: any buffers committed as a result of this
683 transaction can be removed from any checkpoint list it was on
686 skip_commit: /* The journal should be unlocked by now. */
689 __journal_abort_hard(journal);
692 * Call any callbacks that had been registered for handles in this
693 * transaction. It is up to the callback to free any allocated
696 * The spinlocking (t_jcb_lock) here is surely unnecessary...
698 spin_lock(&commit_transaction->t_jcb_lock);
699 if (!list_empty(&commit_transaction->t_jcb)) {
700 struct list_head *p, *n;
701 int error = is_journal_aborted(journal);
703 list_for_each_safe(p, n, &commit_transaction->t_jcb) {
704 struct journal_callback *jcb;
706 jcb = list_entry(p, struct journal_callback, jcb_list);
708 spin_unlock(&commit_transaction->t_jcb_lock);
709 jcb->jcb_func(jcb, error);
710 spin_lock(&commit_transaction->t_jcb_lock);
713 spin_unlock(&commit_transaction->t_jcb_lock);
715 jbd_debug(3, "JBD: commit phase 7\n");
717 J_ASSERT(commit_transaction->t_sync_datalist == NULL);
718 J_ASSERT(commit_transaction->t_buffers == NULL);
719 J_ASSERT(commit_transaction->t_checkpoint_list == NULL);
720 J_ASSERT(commit_transaction->t_iobuf_list == NULL);
721 J_ASSERT(commit_transaction->t_shadow_list == NULL);
722 J_ASSERT(commit_transaction->t_log_list == NULL);
724 while (commit_transaction->t_forget) {
725 transaction_t *cp_transaction;
726 struct buffer_head *bh;
728 jh = commit_transaction->t_forget;
730 jbd_lock_bh_state(bh);
731 J_ASSERT_JH(jh, jh->b_transaction == commit_transaction ||
732 jh->b_transaction == journal->j_running_transaction);
735 * If there is undo-protected committed data against
736 * this buffer, then we can remove it now. If it is a
737 * buffer needing such protection, the old frozen_data
738 * field now points to a committed version of the
739 * buffer, so rotate that field to the new committed
742 * Otherwise, we can just throw away the frozen data now.
744 if (jh->b_committed_data) {
745 kfree(jh->b_committed_data);
746 jh->b_committed_data = NULL;
747 if (jh->b_frozen_data) {
748 jh->b_committed_data = jh->b_frozen_data;
749 jh->b_frozen_data = NULL;
751 } else if (jh->b_frozen_data) {
752 kfree(jh->b_frozen_data);
753 jh->b_frozen_data = NULL;
756 spin_lock(&journal->j_list_lock);
757 cp_transaction = jh->b_cp_transaction;
758 if (cp_transaction) {
759 JBUFFER_TRACE(jh, "remove from old cp transaction");
760 __journal_remove_checkpoint(jh);
763 /* Only re-checkpoint the buffer_head if it is marked
764 * dirty. If the buffer was added to the BJ_Forget list
765 * by journal_forget, it may no longer be dirty and
766 * there's no point in keeping a checkpoint record for
769 /* A buffer which has been freed while still being
770 * journaled by a previous transaction may end up still
771 * being dirty here, but we want to avoid writing back
772 * that buffer in the future now that the last use has
773 * been committed. That's not only a performance gain,
774 * it also stops aliasing problems if the buffer is left
775 * behind for writeback and gets reallocated for another
776 * use in a different page. */
777 if (buffer_freed(bh)) {
778 clear_buffer_freed(bh);
779 clear_buffer_jbddirty(bh);
782 if (buffer_jbddirty(bh)) {
783 JBUFFER_TRACE(jh, "add to new checkpointing trans");
784 __journal_insert_checkpoint(jh, commit_transaction);
785 JBUFFER_TRACE(jh, "refile for checkpoint writeback");
786 __journal_refile_buffer(jh);
787 jbd_unlock_bh_state(bh);
789 J_ASSERT_BH(bh, !buffer_dirty(bh));
790 J_ASSERT_JH(jh, jh->b_next_transaction == NULL);
791 __journal_unfile_buffer(jh);
792 jbd_unlock_bh_state(bh);
793 journal_remove_journal_head(bh); /* needs a brelse */
794 release_buffer_page(bh);
796 spin_unlock(&journal->j_list_lock);
800 /* Done with this transaction! */
802 jbd_debug(3, "JBD: commit phase 8\n");
804 J_ASSERT(commit_transaction->t_state == T_COMMIT);
807 * This is a bit sleazy. We borrow j_list_lock to protect
808 * journal->j_committing_transaction in __journal_remove_checkpoint.
809 * Really, __jornal_remove_checkpoint should be using j_state_lock but
810 * it's a bit hassle to hold that across __journal_remove_checkpoint
812 spin_lock(&journal->j_state_lock);
813 spin_lock(&journal->j_list_lock);
814 commit_transaction->t_state = T_FINISHED;
815 J_ASSERT(commit_transaction == journal->j_committing_transaction);
816 journal->j_commit_sequence = commit_transaction->t_tid;
817 journal->j_committing_transaction = NULL;
818 spin_unlock(&journal->j_state_lock);
820 if (commit_transaction->t_checkpoint_list == NULL) {
821 __journal_drop_transaction(journal, commit_transaction);
823 if (journal->j_checkpoint_transactions == NULL) {
824 journal->j_checkpoint_transactions = commit_transaction;
825 commit_transaction->t_cpnext = commit_transaction;
826 commit_transaction->t_cpprev = commit_transaction;
828 commit_transaction->t_cpnext =
829 journal->j_checkpoint_transactions;
830 commit_transaction->t_cpprev =
831 commit_transaction->t_cpnext->t_cpprev;
832 commit_transaction->t_cpnext->t_cpprev =
834 commit_transaction->t_cpprev->t_cpnext =
838 spin_unlock(&journal->j_list_lock);
840 jbd_debug(1, "JBD: commit %d complete, head %d\n",
841 journal->j_commit_sequence, journal->j_tail_sequence);
843 wake_up(&journal->j_wait_done_commit);