1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#include <linux/time.h>
17#include <linux/fs.h>
18#include <linux/jbd2.h>
19#include <linux/errno.h>
20#include <linux/slab.h>
21#include <linux/mm.h>
22#include <linux/pagemap.h>
23
24
25
26
27static void journal_end_buffer_io_sync(struct buffer_head *bh, int uptodate)
28{
29 BUFFER_TRACE(bh, "");
30 if (uptodate)
31 set_buffer_uptodate(bh);
32 else
33 clear_buffer_uptodate(bh);
34 unlock_buffer(bh);
35}
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51static void release_buffer_page(struct buffer_head *bh)
52{
53 struct page *page;
54
55 if (buffer_dirty(bh))
56 goto nope;
57 if (atomic_read(&bh->b_count) != 1)
58 goto nope;
59 page = bh->b_page;
60 if (!page)
61 goto nope;
62 if (page->mapping)
63 goto nope;
64
65
66 if (TestSetPageLocked(page))
67 goto nope;
68
69 page_cache_get(page);
70 __brelse(bh);
71 try_to_free_buffers(page);
72 unlock_page(page);
73 page_cache_release(page);
74 return;
75
76nope:
77 __brelse(bh);
78}
79
80
81
82
83
84
85static int inverted_lock(journal_t *journal, struct buffer_head *bh)
86{
87 if (!jbd_trylock_bh_state(bh)) {
88 spin_unlock(&journal->j_list_lock);
89 schedule();
90 return 0;
91 }
92 return 1;
93}
94
95
96
97
98
99
100
101
102static int journal_write_commit_record(journal_t *journal,
103 transaction_t *commit_transaction)
104{
105 struct journal_head *descriptor;
106 struct buffer_head *bh;
107 int i, ret;
108 int barrier_done = 0;
109
110 if (is_journal_aborted(journal))
111 return 0;
112
113 descriptor = jbd2_journal_get_descriptor_buffer(journal);
114 if (!descriptor)
115 return 1;
116
117 bh = jh2bh(descriptor);
118
119
120 for (i = 0; i < bh->b_size; i += 512) {
121 journal_header_t *tmp = (journal_header_t*)bh->b_data;
122 tmp->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER);
123 tmp->h_blocktype = cpu_to_be32(JBD2_COMMIT_BLOCK);
124 tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid);
125 }
126
127 JBUFFER_TRACE(descriptor, "write commit block");
128 set_buffer_dirty(bh);
129 if (journal->j_flags & JBD2_BARRIER) {
130 set_buffer_ordered(bh);
131 barrier_done = 1;
132 }
133 ret = sync_dirty_buffer(bh);
134
135
136
137
138
139 if (ret == -EOPNOTSUPP && barrier_done) {
140 char b[BDEVNAME_SIZE];
141
142 printk(KERN_WARNING
143 "JBD: barrier-based sync failed on %s - "
144 "disabling barriers\n",
145 bdevname(journal->j_dev, b));
146 spin_lock(&journal->j_state_lock);
147 journal->j_flags &= ~JBD2_BARRIER;
148 spin_unlock(&journal->j_state_lock);
149
150
151 clear_buffer_ordered(bh);
152 set_buffer_uptodate(bh);
153 set_buffer_dirty(bh);
154 ret = sync_dirty_buffer(bh);
155 }
156 put_bh(bh);
157 jbd2_journal_put_journal_head(descriptor);
158
159 return (ret == -EIO);
160}
161
162static void journal_do_submit_data(struct buffer_head **wbuf, int bufs)
163{
164 int i;
165
166 for (i = 0; i < bufs; i++) {
167 wbuf[i]->b_end_io = end_buffer_write_sync;
168
169 submit_bh(WRITE, wbuf[i]);
170 }
171}
172
173
174
175
176static void journal_submit_data_buffers(journal_t *journal,
177 transaction_t *commit_transaction)
178{
179 struct journal_head *jh;
180 struct buffer_head *bh;
181 int locked;
182 int bufs = 0;
183 struct buffer_head **wbuf = journal->j_wbuf;
184
185
186
187
188
189
190
191
192
193write_out_data:
194 cond_resched();
195 spin_lock(&journal->j_list_lock);
196
197 while (commit_transaction->t_sync_datalist) {
198 jh = commit_transaction->t_sync_datalist;
199 bh = jh2bh(jh);
200 locked = 0;
201
202
203
204 get_bh(bh);
205
206
207
208
209
210 if (buffer_dirty(bh)) {
211 if (test_set_buffer_locked(bh)) {
212 BUFFER_TRACE(bh, "needs blocking lock");
213 spin_unlock(&journal->j_list_lock);
214
215 journal_do_submit_data(wbuf, bufs);
216 bufs = 0;
217 lock_buffer(bh);
218 spin_lock(&journal->j_list_lock);
219 }
220 locked = 1;
221 }
222
223 if (!inverted_lock(journal, bh)) {
224 jbd_lock_bh_state(bh);
225 spin_lock(&journal->j_list_lock);
226 }
227
228 if (!buffer_jbd(bh)
229 || jh->b_transaction != commit_transaction
230 || jh->b_jlist != BJ_SyncData) {
231 jbd_unlock_bh_state(bh);
232 if (locked)
233 unlock_buffer(bh);
234 BUFFER_TRACE(bh, "already cleaned up");
235 put_bh(bh);
236 continue;
237 }
238 if (locked && test_clear_buffer_dirty(bh)) {
239 BUFFER_TRACE(bh, "needs writeout, adding to array");
240 wbuf[bufs++] = bh;
241 __jbd2_journal_file_buffer(jh, commit_transaction,
242 BJ_Locked);
243 jbd_unlock_bh_state(bh);
244 if (bufs == journal->j_wbufsize) {
245 spin_unlock(&journal->j_list_lock);
246 journal_do_submit_data(wbuf, bufs);
247 bufs = 0;
248 goto write_out_data;
249 }
250 } else if (!locked && buffer_locked(bh)) {
251 __jbd2_journal_file_buffer(jh, commit_transaction,
252 BJ_Locked);
253 jbd_unlock_bh_state(bh);
254 put_bh(bh);
255 } else {
256 BUFFER_TRACE(bh, "writeout complete: unfile");
257 __jbd2_journal_unfile_buffer(jh);
258 jbd_unlock_bh_state(bh);
259 if (locked)
260 unlock_buffer(bh);
261 jbd2_journal_remove_journal_head(bh);
262
263
264 put_bh(bh);
265 put_bh(bh);
266 }
267
268 if (lock_need_resched(&journal->j_list_lock)) {
269 spin_unlock(&journal->j_list_lock);
270 goto write_out_data;
271 }
272 }
273 spin_unlock(&journal->j_list_lock);
274 journal_do_submit_data(wbuf, bufs);
275}
276
277static inline void write_tag_block(int tag_bytes, journal_block_tag_t *tag,
278 unsigned long long block)
279{
280 tag->t_blocknr = cpu_to_be32(block & (u32)~0);
281 if (tag_bytes > JBD2_TAG_SIZE32)
282 tag->t_blocknr_high = cpu_to_be32((block >> 31) >> 1);
283}
284
285
286
287
288
289
290
291void jbd2_journal_commit_transaction(journal_t *journal)
292{
293 transaction_t *commit_transaction;
294 struct journal_head *jh, *new_jh, *descriptor;
295 struct buffer_head **wbuf = journal->j_wbuf;
296 int bufs;
297 int flags;
298 int err;
299 unsigned long long blocknr;
300 char *tagp = NULL;
301 journal_header_t *header;
302 journal_block_tag_t *tag = NULL;
303 int space_left = 0;
304 int first_tag = 0;
305 int tag_flag;
306 int i;
307 int tag_bytes = journal_tag_bytes(journal);
308
309
310
311
312
313
314#ifdef COMMIT_STATS
315 spin_lock(&journal->j_list_lock);
316 summarise_journal_usage(journal);
317 spin_unlock(&journal->j_list_lock);
318#endif
319
320
321 if (journal->j_flags & JBD2_FLUSHED) {
322 jbd_debug(3, "super block updated\n");
323 jbd2_journal_update_superblock(journal, 1);
324 } else {
325 jbd_debug(3, "superblock not updated\n");
326 }
327
328 J_ASSERT(journal->j_running_transaction != NULL);
329 J_ASSERT(journal->j_committing_transaction == NULL);
330
331 commit_transaction = journal->j_running_transaction;
332 J_ASSERT(commit_transaction->t_state == T_RUNNING);
333
334 jbd_debug(1, "JBD: starting commit of transaction %d\n",
335 commit_transaction->t_tid);
336
337 spin_lock(&journal->j_state_lock);
338 commit_transaction->t_state = T_LOCKED;
339
340 spin_lock(&commit_transaction->t_handle_lock);
341 while (commit_transaction->t_updates) {
342 DEFINE_WAIT(wait);
343
344 prepare_to_wait(&journal->j_wait_updates, &wait,
345 TASK_UNINTERRUPTIBLE);
346 if (commit_transaction->t_updates) {
347 spin_unlock(&commit_transaction->t_handle_lock);
348 spin_unlock(&journal->j_state_lock);
349 schedule();
350 spin_lock(&journal->j_state_lock);
351 spin_lock(&commit_transaction->t_handle_lock);
352 }
353 finish_wait(&journal->j_wait_updates, &wait);
354 }
355 spin_unlock(&commit_transaction->t_handle_lock);
356
357 J_ASSERT (commit_transaction->t_outstanding_credits <=
358 journal->j_max_transaction_buffers);
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376 while (commit_transaction->t_reserved_list) {
377 jh = commit_transaction->t_reserved_list;
378 JBUFFER_TRACE(jh, "reserved, unused: refile");
379
380
381
382
383 if (jh->b_committed_data) {
384 struct buffer_head *bh = jh2bh(jh);
385
386 jbd_lock_bh_state(bh);
387 jbd2_free(jh->b_committed_data, bh->b_size);
388 jh->b_committed_data = NULL;
389 jbd_unlock_bh_state(bh);
390 }
391 jbd2_journal_refile_buffer(journal, jh);
392 }
393
394
395
396
397
398
399 spin_lock(&journal->j_list_lock);
400 __jbd2_journal_clean_checkpoint_list(journal);
401 spin_unlock(&journal->j_list_lock);
402
403 jbd_debug (3, "JBD: commit phase 1\n");
404
405
406
407
408 jbd2_journal_switch_revoke_table(journal);
409
410 commit_transaction->t_state = T_FLUSH;
411 journal->j_committing_transaction = commit_transaction;
412 journal->j_running_transaction = NULL;
413 commit_transaction->t_log_start = journal->j_head;
414 wake_up(&journal->j_wait_transaction_locked);
415 spin_unlock(&journal->j_state_lock);
416
417 jbd_debug (3, "JBD: commit phase 2\n");
418
419
420
421
422
423 spin_lock(&journal->j_list_lock);
424 if (commit_transaction->t_buffers) {
425 new_jh = jh = commit_transaction->t_buffers->b_tnext;
426 do {
427 J_ASSERT_JH(new_jh, new_jh->b_modified == 1 ||
428 new_jh->b_modified == 0);
429 new_jh->b_modified = 0;
430 new_jh = new_jh->b_tnext;
431 } while (new_jh != jh);
432 }
433 spin_unlock(&journal->j_list_lock);
434
435
436
437
438
439 err = 0;
440 journal_submit_data_buffers(journal, commit_transaction);
441
442
443
444
445 spin_lock(&journal->j_list_lock);
446 while (commit_transaction->t_locked_list) {
447 struct buffer_head *bh;
448
449 jh = commit_transaction->t_locked_list->b_tprev;
450 bh = jh2bh(jh);
451 get_bh(bh);
452 if (buffer_locked(bh)) {
453 spin_unlock(&journal->j_list_lock);
454 wait_on_buffer(bh);
455 if (unlikely(!buffer_uptodate(bh)))
456 err = -EIO;
457 spin_lock(&journal->j_list_lock);
458 }
459 if (!inverted_lock(journal, bh)) {
460 put_bh(bh);
461 spin_lock(&journal->j_list_lock);
462 continue;
463 }
464 if (buffer_jbd(bh) && jh->b_jlist == BJ_Locked) {
465 __jbd2_journal_unfile_buffer(jh);
466 jbd_unlock_bh_state(bh);
467 jbd2_journal_remove_journal_head(bh);
468 put_bh(bh);
469 } else {
470 jbd_unlock_bh_state(bh);
471 }
472 put_bh(bh);
473 cond_resched_lock(&journal->j_list_lock);
474 }
475 spin_unlock(&journal->j_list_lock);
476
477 if (err)
478 jbd2_journal_abort(journal, err);
479
480 jbd2_journal_write_revoke_records(journal, commit_transaction);
481
482 jbd_debug(3, "JBD: commit phase 2\n");
483
484
485
486
487
488
489
490 J_ASSERT (commit_transaction->t_sync_datalist == NULL);
491
492 jbd_debug (3, "JBD: commit phase 3\n");
493
494
495
496
497
498
499 commit_transaction->t_state = T_COMMIT;
500
501 descriptor = NULL;
502 bufs = 0;
503 while (commit_transaction->t_buffers) {
504
505
506
507 jh = commit_transaction->t_buffers;
508
509
510
511
512 if (is_journal_aborted(journal)) {
513 JBUFFER_TRACE(jh, "journal is aborting: refile");
514 jbd2_journal_refile_buffer(journal, jh);
515
516
517
518
519 if (!commit_transaction->t_buffers)
520 goto start_journal_io;
521 continue;
522 }
523
524
525
526
527 if (!descriptor) {
528 struct buffer_head *bh;
529
530 J_ASSERT (bufs == 0);
531
532 jbd_debug(4, "JBD: get descriptor\n");
533
534 descriptor = jbd2_journal_get_descriptor_buffer(journal);
535 if (!descriptor) {
536 jbd2_journal_abort(journal, -EIO);
537 continue;
538 }
539
540 bh = jh2bh(descriptor);
541 jbd_debug(4, "JBD: got buffer %llu (%p)\n",
542 (unsigned long long)bh->b_blocknr, bh->b_data);
543 header = (journal_header_t *)&bh->b_data[0];
544 header->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER);
545 header->h_blocktype = cpu_to_be32(JBD2_DESCRIPTOR_BLOCK);
546 header->h_sequence = cpu_to_be32(commit_transaction->t_tid);
547
548 tagp = &bh->b_data[sizeof(journal_header_t)];
549 space_left = bh->b_size - sizeof(journal_header_t);
550 first_tag = 1;
551 set_buffer_jwrite(bh);
552 set_buffer_dirty(bh);
553 wbuf[bufs++] = bh;
554
555
556
557 BUFFER_TRACE(bh, "ph3: file as descriptor");
558 jbd2_journal_file_buffer(descriptor, commit_transaction,
559 BJ_LogCtl);
560 }
561
562
563
564 err = jbd2_journal_next_log_block(journal, &blocknr);
565
566
567
568 if (err) {
569 jbd2_journal_abort(journal, err);
570 continue;
571 }
572
573
574
575
576
577
578 commit_transaction->t_outstanding_credits--;
579
580
581
582
583 atomic_inc(&jh2bh(jh)->b_count);
584
585
586
587
588
589 set_bit(BH_JWrite, &jh2bh(jh)->b_state);
590
591
592
593
594
595
596 JBUFFER_TRACE(jh, "ph3: write metadata");
597 flags = jbd2_journal_write_metadata_buffer(commit_transaction,
598 jh, &new_jh, blocknr);
599 set_bit(BH_JWrite, &jh2bh(new_jh)->b_state);
600 wbuf[bufs++] = jh2bh(new_jh);
601
602
603
604
605 tag_flag = 0;
606 if (flags & 1)
607 tag_flag |= JBD2_FLAG_ESCAPE;
608 if (!first_tag)
609 tag_flag |= JBD2_FLAG_SAME_UUID;
610
611 tag = (journal_block_tag_t *) tagp;
612 write_tag_block(tag_bytes, tag, jh2bh(jh)->b_blocknr);
613 tag->t_flags = cpu_to_be32(tag_flag);
614 tagp += tag_bytes;
615 space_left -= tag_bytes;
616
617 if (first_tag) {
618 memcpy (tagp, journal->j_uuid, 16);
619 tagp += 16;
620 space_left -= 16;
621 first_tag = 0;
622 }
623
624
625
626
627 if (bufs == journal->j_wbufsize ||
628 commit_transaction->t_buffers == NULL ||
629 space_left < tag_bytes + 16) {
630
631 jbd_debug(4, "JBD: Submit %d IOs\n", bufs);
632
633
634
635
636
637 tag->t_flags |= cpu_to_be32(JBD2_FLAG_LAST_TAG);
638
639start_journal_io:
640 for (i = 0; i < bufs; i++) {
641 struct buffer_head *bh = wbuf[i];
642 lock_buffer(bh);
643 clear_buffer_dirty(bh);
644 set_buffer_uptodate(bh);
645 bh->b_end_io = journal_end_buffer_io_sync;
646 submit_bh(WRITE, bh);
647 }
648 cond_resched();
649
650
651
652 descriptor = NULL;
653 bufs = 0;
654 }
655 }
656
657
658
659
660
661
662
663
664
665
666
667
668 jbd_debug(3, "JBD: commit phase 4\n");
669
670
671
672
673
674wait_for_iobuf:
675 while (commit_transaction->t_iobuf_list != NULL) {
676 struct buffer_head *bh;
677
678 jh = commit_transaction->t_iobuf_list->b_tprev;
679 bh = jh2bh(jh);
680 if (buffer_locked(bh)) {
681 wait_on_buffer(bh);
682 goto wait_for_iobuf;
683 }
684 if (cond_resched())
685 goto wait_for_iobuf;
686
687 if (unlikely(!buffer_uptodate(bh)))
688 err = -EIO;
689
690 clear_buffer_jwrite(bh);
691
692 JBUFFER_TRACE(jh, "ph4: unfile after journal write");
693 jbd2_journal_unfile_buffer(journal, jh);
694
695
696
697
698
699 BUFFER_TRACE(bh, "dumping temporary bh");
700 jbd2_journal_put_journal_head(jh);
701 __brelse(bh);
702 J_ASSERT_BH(bh, atomic_read(&bh->b_count) == 0);
703 free_buffer_head(bh);
704
705
706
707 jh = commit_transaction->t_shadow_list->b_tprev;
708 bh = jh2bh(jh);
709 clear_bit(BH_JWrite, &bh->b_state);
710 J_ASSERT_BH(bh, buffer_jbddirty(bh));
711
712
713
714
715
716 JBUFFER_TRACE(jh, "file as BJ_Forget");
717 jbd2_journal_file_buffer(jh, commit_transaction, BJ_Forget);
718
719
720 wake_up_bit(&bh->b_state, BH_Unshadow);
721 JBUFFER_TRACE(jh, "brelse shadowed buffer");
722 __brelse(bh);
723 }
724
725 J_ASSERT (commit_transaction->t_shadow_list == NULL);
726
727 jbd_debug(3, "JBD: commit phase 5\n");
728
729
730 wait_for_ctlbuf:
731 while (commit_transaction->t_log_list != NULL) {
732 struct buffer_head *bh;
733
734 jh = commit_transaction->t_log_list->b_tprev;
735 bh = jh2bh(jh);
736 if (buffer_locked(bh)) {
737 wait_on_buffer(bh);
738 goto wait_for_ctlbuf;
739 }
740 if (cond_resched())
741 goto wait_for_ctlbuf;
742
743 if (unlikely(!buffer_uptodate(bh)))
744 err = -EIO;
745
746 BUFFER_TRACE(bh, "ph5: control buffer writeout done: unfile");
747 clear_buffer_jwrite(bh);
748 jbd2_journal_unfile_buffer(journal, jh);
749 jbd2_journal_put_journal_head(jh);
750 __brelse(bh);
751
752 }
753
754 jbd_debug(3, "JBD: commit phase 6\n");
755
756 if (journal_write_commit_record(journal, commit_transaction))
757 err = -EIO;
758
759 if (err)
760 jbd2_journal_abort(journal, err);
761
762
763
764
765
766
767 jbd_debug(3, "JBD: commit phase 7\n");
768
769 J_ASSERT(commit_transaction->t_sync_datalist == NULL);
770 J_ASSERT(commit_transaction->t_buffers == NULL);
771 J_ASSERT(commit_transaction->t_checkpoint_list == NULL);
772 J_ASSERT(commit_transaction->t_iobuf_list == NULL);
773 J_ASSERT(commit_transaction->t_shadow_list == NULL);
774 J_ASSERT(commit_transaction->t_log_list == NULL);
775
776restart_loop:
777
778
779
780
781 spin_lock(&journal->j_list_lock);
782 while (commit_transaction->t_forget) {
783 transaction_t *cp_transaction;
784 struct buffer_head *bh;
785
786 jh = commit_transaction->t_forget;
787 spin_unlock(&journal->j_list_lock);
788 bh = jh2bh(jh);
789 jbd_lock_bh_state(bh);
790 J_ASSERT_JH(jh, jh->b_transaction == commit_transaction ||
791 jh->b_transaction == journal->j_running_transaction);
792
793
794
795
796
797
798
799
800
801
802
803 if (jh->b_committed_data) {
804 jbd2_free(jh->b_committed_data, bh->b_size);
805 jh->b_committed_data = NULL;
806 if (jh->b_frozen_data) {
807 jh->b_committed_data = jh->b_frozen_data;
808 jh->b_frozen_data = NULL;
809 }
810 } else if (jh->b_frozen_data) {
811 jbd2_free(jh->b_frozen_data, bh->b_size);
812 jh->b_frozen_data = NULL;
813 }
814
815 spin_lock(&journal->j_list_lock);
816 cp_transaction = jh->b_cp_transaction;
817 if (cp_transaction) {
818 JBUFFER_TRACE(jh, "remove from old cp transaction");
819 __jbd2_journal_remove_checkpoint(jh);
820 }
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836 if (buffer_freed(bh)) {
837 clear_buffer_freed(bh);
838 clear_buffer_jbddirty(bh);
839 }
840
841 if (buffer_jbddirty(bh)) {
842 JBUFFER_TRACE(jh, "add to new checkpointing trans");
843 __jbd2_journal_insert_checkpoint(jh, commit_transaction);
844 JBUFFER_TRACE(jh, "refile for checkpoint writeback");
845 __jbd2_journal_refile_buffer(jh);
846 jbd_unlock_bh_state(bh);
847 } else {
848 J_ASSERT_BH(bh, !buffer_dirty(bh));
849
850
851
852
853
854
855
856 JBUFFER_TRACE(jh, "refile or unfile freed buffer");
857 __jbd2_journal_refile_buffer(jh);
858 if (!jh->b_transaction) {
859 jbd_unlock_bh_state(bh);
860
861 jbd2_journal_remove_journal_head(bh);
862 release_buffer_page(bh);
863 } else
864 jbd_unlock_bh_state(bh);
865 }
866 cond_resched_lock(&journal->j_list_lock);
867 }
868 spin_unlock(&journal->j_list_lock);
869
870
871
872
873
874
875 spin_lock(&journal->j_state_lock);
876 spin_lock(&journal->j_list_lock);
877
878
879
880
881 if (commit_transaction->t_forget) {
882 spin_unlock(&journal->j_list_lock);
883 spin_unlock(&journal->j_state_lock);
884 goto restart_loop;
885 }
886
887
888
889 jbd_debug(3, "JBD: commit phase 8\n");
890
891 J_ASSERT(commit_transaction->t_state == T_COMMIT);
892
893 commit_transaction->t_state = T_FINISHED;
894 J_ASSERT(commit_transaction == journal->j_committing_transaction);
895 journal->j_commit_sequence = commit_transaction->t_tid;
896 journal->j_committing_transaction = NULL;
897 spin_unlock(&journal->j_state_lock);
898
899 if (commit_transaction->t_checkpoint_list == NULL &&
900 commit_transaction->t_checkpoint_io_list == NULL) {
901 __jbd2_journal_drop_transaction(journal, commit_transaction);
902 } else {
903 if (journal->j_checkpoint_transactions == NULL) {
904 journal->j_checkpoint_transactions = commit_transaction;
905 commit_transaction->t_cpnext = commit_transaction;
906 commit_transaction->t_cpprev = commit_transaction;
907 } else {
908 commit_transaction->t_cpnext =
909 journal->j_checkpoint_transactions;
910 commit_transaction->t_cpprev =
911 commit_transaction->t_cpnext->t_cpprev;
912 commit_transaction->t_cpnext->t_cpprev =
913 commit_transaction;
914 commit_transaction->t_cpprev->t_cpnext =
915 commit_transaction;
916 }
917 }
918 spin_unlock(&journal->j_list_lock);
919
920 jbd_debug(1, "JBD: commit %d complete, head %d\n",
921 journal->j_commit_sequence, journal->j_tail_sequence);
922
923 wake_up(&journal->j_wait_done_commit);
924}
925