blob: 86806d5ce22f72f7c5ec229708bc817111d20c18 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*
2 * linux/fs/jbd2/checkpoint.c
3 *
4 * Written by Stephen C. Tweedie <sct@redhat.com>, 1999
5 *
6 * Copyright 1999 Red Hat Software --- All Rights Reserved
7 *
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.
11 *
12 * Checkpoint routines for the generic filesystem journaling code.
13 * Part of the ext2fs journaling system.
14 *
15 * Checkpointing is the process of ensuring that a section of the log is
16 * committed fully to disk, so that that portion of the log can be
17 * reused.
18 */
19
20#include <linux/time.h>
21#include <linux/fs.h>
22#include <linux/jbd2.h>
23#include <linux/errno.h>
24#include <linux/slab.h>
25#include <linux/blkdev.h>
26#include <trace/events/jbd2.h>
27
28/*
29 * Unlink a buffer from a transaction checkpoint list.
30 *
31 * Called with j_list_lock held.
32 */
33static inline void __buffer_unlink_first(struct journal_head *jh)
34{
35 transaction_t *transaction = jh->b_cp_transaction;
36
37 jh->b_cpnext->b_cpprev = jh->b_cpprev;
38 jh->b_cpprev->b_cpnext = jh->b_cpnext;
39 if (transaction->t_checkpoint_list == jh) {
40 transaction->t_checkpoint_list = jh->b_cpnext;
41 if (transaction->t_checkpoint_list == jh)
42 transaction->t_checkpoint_list = NULL;
43 }
44}
45
46/*
47 * Unlink a buffer from a transaction checkpoint(io) list.
48 *
49 * Called with j_list_lock held.
50 */
51static inline void __buffer_unlink(struct journal_head *jh)
52{
53 transaction_t *transaction = jh->b_cp_transaction;
54
55 __buffer_unlink_first(jh);
56 if (transaction->t_checkpoint_io_list == jh) {
57 transaction->t_checkpoint_io_list = jh->b_cpnext;
58 if (transaction->t_checkpoint_io_list == jh)
59 transaction->t_checkpoint_io_list = NULL;
60 }
61}
62
63/*
64 * Move a buffer from the checkpoint list to the checkpoint io list
65 *
66 * Called with j_list_lock held
67 */
68static inline void __buffer_relink_io(struct journal_head *jh)
69{
70 transaction_t *transaction = jh->b_cp_transaction;
71
72 __buffer_unlink_first(jh);
73
74 if (!transaction->t_checkpoint_io_list) {
75 jh->b_cpnext = jh->b_cpprev = jh;
76 } else {
77 jh->b_cpnext = transaction->t_checkpoint_io_list;
78 jh->b_cpprev = transaction->t_checkpoint_io_list->b_cpprev;
79 jh->b_cpprev->b_cpnext = jh;
80 jh->b_cpnext->b_cpprev = jh;
81 }
82 transaction->t_checkpoint_io_list = jh;
83}
84
85/*
86 * Try to release a checkpointed buffer from its transaction.
87 * Returns 1 if we released it and 2 if we also released the
88 * whole transaction.
89 *
90 * Requires j_list_lock
91 */
92static int __try_to_free_cp_buf(struct journal_head *jh)
93{
94 int ret = 0;
95 struct buffer_head *bh = jh2bh(jh);
96
97 if (jh->b_transaction == NULL && !buffer_locked(bh) &&
98 !buffer_dirty(bh) && !buffer_write_io_error(bh)) {
99 /*
100 * Get our reference so that bh cannot be freed before
101 * we unlock it
102 */
103 get_bh(bh);
104 JBUFFER_TRACE(jh, "remove from checkpoint list");
105 ret = __jbd2_journal_remove_checkpoint(jh) + 1;
106 BUFFER_TRACE(bh, "release");
107 __brelse(bh);
108 }
109 return ret;
110}
111
112/*
113 * __jbd2_log_wait_for_space: wait until there is space in the journal.
114 *
115 * Called under j-state_lock *only*. It will be unlocked if we have to wait
116 * for a checkpoint to free up some space in the log.
117 */
118void __jbd2_log_wait_for_space(journal_t *journal)
119{
120 int nblocks, space_left;
121 /* assert_spin_locked(&journal->j_state_lock); */
122
123 nblocks = jbd_space_needed(journal);
124 while (__jbd2_log_space_left(journal) < nblocks) {
125 if (journal->j_flags & JBD2_ABORT)
126 return;
127 write_unlock(&journal->j_state_lock);
128 if (current->plug)
129 io_schedule();
130 mutex_lock(&journal->j_checkpoint_mutex);
131
132 /*
133 * Test again, another process may have checkpointed while we
134 * were waiting for the checkpoint lock. If there are no
135 * transactions ready to be checkpointed, try to recover
136 * journal space by calling cleanup_journal_tail(), and if
137 * that doesn't work, by waiting for the currently committing
138 * transaction to complete. If there is absolutely no way
139 * to make progress, this is either a BUG or corrupted
140 * filesystem, so abort the journal and leave a stack
141 * trace for forensic evidence.
142 */
143 write_lock(&journal->j_state_lock);
144 spin_lock(&journal->j_list_lock);
145 nblocks = jbd_space_needed(journal);
146 space_left = __jbd2_log_space_left(journal);
147 if (space_left < nblocks) {
148 int chkpt = journal->j_checkpoint_transactions != NULL;
149 tid_t tid = 0;
150
151 if (journal->j_committing_transaction)
152 tid = journal->j_committing_transaction->t_tid;
153 spin_unlock(&journal->j_list_lock);
154 write_unlock(&journal->j_state_lock);
155 if (chkpt) {
156 jbd2_log_do_checkpoint(journal);
157 } else if (jbd2_cleanup_journal_tail(journal) == 0) {
158 /* We were able to recover space; yay! */
159 ;
160 } else if (tid) {
161 jbd2_log_wait_commit(journal, tid);
162 } else {
163 printk(KERN_ERR "%s: needed %d blocks and "
164 "only had %d space available\n",
165 __func__, nblocks, space_left);
166 printk(KERN_ERR "%s: no way to get more "
167 "journal space in %s\n", __func__,
168 journal->j_devname);
169 WARN_ON(1);
170 jbd2_journal_abort(journal, 0);
171 }
172 write_lock(&journal->j_state_lock);
173 } else {
174 spin_unlock(&journal->j_list_lock);
175 }
176 mutex_unlock(&journal->j_checkpoint_mutex);
177 }
178}
179
180/*
181 * Clean up transaction's list of buffers submitted for io.
182 * We wait for any pending IO to complete and remove any clean
183 * buffers. Note that we take the buffers in the opposite ordering
184 * from the one in which they were submitted for IO.
185 *
186 * Return 0 on success, and return <0 if some buffers have failed
187 * to be written out.
188 *
189 * Called with j_list_lock held.
190 */
191static int __wait_cp_io(journal_t *journal, transaction_t *transaction)
192{
193 struct journal_head *jh;
194 struct buffer_head *bh;
195 tid_t this_tid;
196 int released = 0;
197 int ret = 0;
198
199 this_tid = transaction->t_tid;
200restart:
201 /* Did somebody clean up the transaction in the meanwhile? */
202 if (journal->j_checkpoint_transactions != transaction ||
203 transaction->t_tid != this_tid)
204 return ret;
205 while (!released && transaction->t_checkpoint_io_list) {
206 jh = transaction->t_checkpoint_io_list;
207 bh = jh2bh(jh);
208 get_bh(bh);
209 if (buffer_locked(bh)) {
210 spin_unlock(&journal->j_list_lock);
211 wait_on_buffer(bh);
212 /* the journal_head may have gone by now */
213 BUFFER_TRACE(bh, "brelse");
214 __brelse(bh);
215 spin_lock(&journal->j_list_lock);
216 goto restart;
217 }
218 if (unlikely(buffer_write_io_error(bh)))
219 ret = -EIO;
220
221 /*
222 * Now in whatever state the buffer currently is, we know that
223 * it has been written out and so we can drop it from the list
224 */
225 released = __jbd2_journal_remove_checkpoint(jh);
226 __brelse(bh);
227 }
228
229 return ret;
230}
231
232static void
233__flush_batch(journal_t *journal, int *batch_count)
234{
235 int i;
236 struct blk_plug plug;
237
238 blk_start_plug(&plug);
239 for (i = 0; i < *batch_count; i++)
240 write_dirty_buffer(journal->j_chkpt_bhs[i], WRITE_SYNC);
241 blk_finish_plug(&plug);
242
243 for (i = 0; i < *batch_count; i++) {
244 struct buffer_head *bh = journal->j_chkpt_bhs[i];
245 BUFFER_TRACE(bh, "brelse");
246 __brelse(bh);
247 }
248 *batch_count = 0;
249}
250
251/*
252 * Try to flush one buffer from the checkpoint list to disk.
253 *
254 * Return 1 if something happened which requires us to abort the current
255 * scan of the checkpoint list. Return <0 if the buffer has failed to
256 * be written out.
257 *
258 * Called with j_list_lock held and drops it if 1 is returned
259 */
260static int __process_buffer(journal_t *journal, struct journal_head *jh,
261 int *batch_count, transaction_t *transaction)
262{
263 struct buffer_head *bh = jh2bh(jh);
264 int ret = 0;
265
266 if (buffer_locked(bh)) {
267 get_bh(bh);
268 spin_unlock(&journal->j_list_lock);
269 wait_on_buffer(bh);
270 /* the journal_head may have gone by now */
271 BUFFER_TRACE(bh, "brelse");
272 __brelse(bh);
273 ret = 1;
274 } else if (jh->b_transaction != NULL) {
275 transaction_t *t = jh->b_transaction;
276 tid_t tid = t->t_tid;
277
278 transaction->t_chp_stats.cs_forced_to_close++;
279 spin_unlock(&journal->j_list_lock);
280 if (unlikely(journal->j_flags & JBD2_UNMOUNT))
281 /*
282 * The journal thread is dead; so starting and
283 * waiting for a commit to finish will cause
284 * us to wait for a _very_ long time.
285 */
286 printk(KERN_ERR "JBD2: %s: "
287 "Waiting for Godot: block %llu\n",
288 journal->j_devname,
289 (unsigned long long) bh->b_blocknr);
290 jbd2_log_start_commit(journal, tid);
291 jbd2_log_wait_commit(journal, tid);
292 ret = 1;
293 } else if (!buffer_dirty(bh)) {
294 ret = 1;
295 if (unlikely(buffer_write_io_error(bh)))
296 ret = -EIO;
297 get_bh(bh);
298 BUFFER_TRACE(bh, "remove from checkpoint");
299 __jbd2_journal_remove_checkpoint(jh);
300 spin_unlock(&journal->j_list_lock);
301 __brelse(bh);
302 } else {
303 /*
304 * Important: we are about to write the buffer, and
305 * possibly block, while still holding the journal lock.
306 * We cannot afford to let the transaction logic start
307 * messing around with this buffer before we write it to
308 * disk, as that would break recoverability.
309 */
310 BUFFER_TRACE(bh, "queue");
311 get_bh(bh);
312 J_ASSERT_BH(bh, !buffer_jwrite(bh));
313 journal->j_chkpt_bhs[*batch_count] = bh;
314 __buffer_relink_io(jh);
315 transaction->t_chp_stats.cs_written++;
316 (*batch_count)++;
317 if (*batch_count == JBD2_NR_BATCH) {
318 spin_unlock(&journal->j_list_lock);
319 __flush_batch(journal, batch_count);
320 ret = 1;
321 }
322 }
323 return ret;
324}
325
326/*
327 * Perform an actual checkpoint. We take the first transaction on the
328 * list of transactions to be checkpointed and send all its buffers
329 * to disk. We submit larger chunks of data at once.
330 *
331 * The journal should be locked before calling this function.
332 * Called with j_checkpoint_mutex held.
333 */
334int jbd2_log_do_checkpoint(journal_t *journal)
335{
336 transaction_t *transaction;
337 tid_t this_tid;
338 int result;
339
340 jbd_debug(1, "Start checkpoint\n");
341
342 /*
343 * First thing: if there are any transactions in the log which
344 * don't need checkpointing, just eliminate them from the
345 * journal straight away.
346 */
347 result = jbd2_cleanup_journal_tail(journal);
348 trace_jbd2_checkpoint(journal, result);
349 jbd_debug(1, "cleanup_journal_tail returned %d\n", result);
350 if (result <= 0)
351 return result;
352
353 /*
354 * OK, we need to start writing disk blocks. Take one transaction
355 * and write it.
356 */
357 result = 0;
358 spin_lock(&journal->j_list_lock);
359 if (!journal->j_checkpoint_transactions)
360 goto out;
361 transaction = journal->j_checkpoint_transactions;
362 if (transaction->t_chp_stats.cs_chp_time == 0)
363 transaction->t_chp_stats.cs_chp_time = jiffies;
364 this_tid = transaction->t_tid;
365restart:
366 /*
367 * If someone cleaned up this transaction while we slept, we're
368 * done (maybe it's a new transaction, but it fell at the same
369 * address).
370 */
371 if (journal->j_checkpoint_transactions == transaction &&
372 transaction->t_tid == this_tid) {
373 int batch_count = 0;
374 struct journal_head *jh;
375 int retry = 0, err;
376
377 while (!retry && transaction->t_checkpoint_list) {
378 jh = transaction->t_checkpoint_list;
379 retry = __process_buffer(journal, jh, &batch_count,
380 transaction);
381 if (retry < 0 && !result)
382 result = retry;
383 if (!retry && (need_resched() ||
384 spin_needbreak(&journal->j_list_lock))) {
385 spin_unlock(&journal->j_list_lock);
386 retry = 1;
387 break;
388 }
389 }
390
391 if (batch_count) {
392 if (!retry) {
393 spin_unlock(&journal->j_list_lock);
394 retry = 1;
395 }
396 __flush_batch(journal, &batch_count);
397 }
398
399 if (retry) {
400 spin_lock(&journal->j_list_lock);
401 goto restart;
402 }
403 /*
404 * Now we have cleaned up the first transaction's checkpoint
405 * list. Let's clean up the second one
406 */
407 err = __wait_cp_io(journal, transaction);
408 if (!result)
409 result = err;
410 }
411out:
412 spin_unlock(&journal->j_list_lock);
413 if (result < 0)
414 jbd2_journal_abort(journal, result);
415 else
416 result = jbd2_cleanup_journal_tail(journal);
417
418 return (result < 0) ? result : 0;
419}
420
421/*
422 * Check the list of checkpoint transactions for the journal to see if
423 * we have already got rid of any since the last update of the log tail
424 * in the journal superblock. If so, we can instantly roll the
425 * superblock forward to remove those transactions from the log.
426 *
427 * Return <0 on error, 0 on success, 1 if there was nothing to clean up.
428 *
429 * Called with the journal lock held.
430 *
431 * This is the only part of the journaling code which really needs to be
432 * aware of transaction aborts. Checkpointing involves writing to the
433 * main filesystem area rather than to the journal, so it can proceed
434 * even in abort state, but we must not update the super block if
435 * checkpointing may have failed. Otherwise, we would lose some metadata
436 * buffers which should be written-back to the filesystem.
437 */
438
439int jbd2_cleanup_journal_tail(journal_t *journal)
440{
441 tid_t first_tid;
442 unsigned long blocknr;
443
444 if (is_journal_aborted(journal))
445 return -EIO;
446
447 if (!jbd2_journal_get_log_tail(journal, &first_tid, &blocknr))
448 return 1;
449 J_ASSERT(blocknr != 0);
450
451 /*
452 * We need to make sure that any blocks that were recently written out
453 * --- perhaps by jbd2_log_do_checkpoint() --- are flushed out before
454 * we drop the transactions from the journal. It's unlikely this will
455 * be necessary, especially with an appropriately sized journal, but we
456 * need this to guarantee correctness. Fortunately
457 * jbd2_cleanup_journal_tail() doesn't get called all that often.
458 */
459 if (journal->j_flags & JBD2_BARRIER)
460 blkdev_issue_flush(journal->j_fs_dev, GFP_NOFS, NULL);
461
462 return __jbd2_update_log_tail(journal, first_tid, blocknr);
463}
464
465
466/* Checkpoint list management */
467
468/*
469 * journal_clean_one_cp_list
470 *
471 * Find all the written-back checkpoint buffers in the given list and
472 * release them. If 'destroy' is set, clean all buffers unconditionally.
473 *
474 * Called with the journal locked.
475 * Called with j_list_lock held.
476 * Returns number of buffers reaped (for debug)
477 */
478
479static int journal_clean_one_cp_list(struct journal_head *jh, int *released, bool destroy)
480{
481 struct journal_head *last_jh;
482 struct journal_head *next_jh = jh;
483 int ret, freed = 0;
484
485 *released = 0;
486 if (!jh)
487 return 0;
488
489 last_jh = jh->b_cpprev;
490 do {
491 jh = next_jh;
492 next_jh = jh->b_cpnext;
493 if (!destroy)
494 ret = __try_to_free_cp_buf(jh);
495 else
496 ret = __jbd2_journal_remove_checkpoint(jh) + 1;
497 if (ret) {
498 freed++;
499 if (ret == 2) {
500 *released = 1;
501 return freed;
502 }
503 }
504 /*
505 * This function only frees up some memory
506 * if possible so we dont have an obligation
507 * to finish processing. Bail out if preemption
508 * requested:
509 */
510 if (need_resched())
511 return freed;
512 } while (jh != last_jh);
513
514 return freed;
515}
516
517/*
518 * journal_clean_checkpoint_list
519 *
520 * Find all the written-back checkpoint buffers in the journal and release them.
521 *
522 * If 'destroy' is set, release all buffers unconditionally.
523 *
524 * Called with the journal locked.
525 * Called with j_list_lock held.
526 * Returns number of buffers reaped (for debug)
527 */
528
529int __jbd2_journal_clean_checkpoint_list(journal_t *journal, bool destroy)
530{
531 transaction_t *transaction, *last_transaction, *next_transaction;
532 int ret = 0;
533 int released;
534
535 transaction = journal->j_checkpoint_transactions;
536 if (!transaction)
537 goto out;
538
539 last_transaction = transaction->t_cpprev;
540 next_transaction = transaction;
541 do {
542 transaction = next_transaction;
543 next_transaction = transaction->t_cpnext;
544 ret += journal_clean_one_cp_list(transaction->
545 t_checkpoint_list, &released, destroy);
546 /*
547 * This function only frees up some memory if possible so we
548 * dont have an obligation to finish processing. Bail out if
549 * preemption requested:
550 */
551 if (need_resched())
552 goto out;
553 if (released)
554 continue;
555 /*
556 * It is essential that we are as careful as in the case of
557 * t_checkpoint_list with removing the buffer from the list as
558 * we can possibly see not yet submitted buffers on io_list
559 */
560 ret += journal_clean_one_cp_list(transaction->
561 t_checkpoint_io_list, &released, destroy);
562 if (need_resched())
563 goto out;
564 } while (transaction != last_transaction);
565out:
566 return ret;
567}
568
569/*
570 * Remove buffers from all checkpoint lists as journal is aborted and we just
571 * need to free memory
572 */
573void jbd2_journal_destroy_checkpoint(journal_t *journal)
574{
575 /*
576 * We loop because __jbd2_journal_clean_checkpoint_list() may abort
577 * early due to a need of rescheduling.
578 */
579 while (1) {
580 spin_lock(&journal->j_list_lock);
581 if (!journal->j_checkpoint_transactions) {
582 spin_unlock(&journal->j_list_lock);
583 break;
584 }
585 __jbd2_journal_clean_checkpoint_list(journal, true);
586 spin_unlock(&journal->j_list_lock);
587 cond_resched();
588 }
589}
590
591/*
592 * journal_remove_checkpoint: called after a buffer has been committed
593 * to disk (either by being write-back flushed to disk, or being
594 * committed to the log).
595 *
596 * We cannot safely clean a transaction out of the log until all of the
597 * buffer updates committed in that transaction have safely been stored
598 * elsewhere on disk. To achieve this, all of the buffers in a
599 * transaction need to be maintained on the transaction's checkpoint
600 * lists until they have been rewritten, at which point this function is
601 * called to remove the buffer from the existing transaction's
602 * checkpoint lists.
603 *
604 * The function returns 1 if it frees the transaction, 0 otherwise.
605 * The function can free jh and bh.
606 *
607 * This function is called with j_list_lock held.
608 */
609int __jbd2_journal_remove_checkpoint(struct journal_head *jh)
610{
611 struct transaction_chp_stats_s *stats;
612 transaction_t *transaction;
613 journal_t *journal;
614 int ret = 0;
615
616 JBUFFER_TRACE(jh, "entry");
617
618 if ((transaction = jh->b_cp_transaction) == NULL) {
619 JBUFFER_TRACE(jh, "not on transaction");
620 goto out;
621 }
622 journal = transaction->t_journal;
623
624 JBUFFER_TRACE(jh, "removing from transaction");
625 __buffer_unlink(jh);
626 jh->b_cp_transaction = NULL;
627 jbd2_journal_put_journal_head(jh);
628
629 if (transaction->t_checkpoint_list != NULL ||
630 transaction->t_checkpoint_io_list != NULL)
631 goto out;
632
633 /*
634 * There is one special case to worry about: if we have just pulled the
635 * buffer off a running or committing transaction's checkpoing list,
636 * then even if the checkpoint list is empty, the transaction obviously
637 * cannot be dropped!
638 *
639 * The locking here around t_state is a bit sleazy.
640 * See the comment at the end of jbd2_journal_commit_transaction().
641 */
642 if (transaction->t_state != T_FINISHED)
643 goto out;
644
645 /* OK, that was the last buffer for the transaction: we can now
646 safely remove this transaction from the log */
647 stats = &transaction->t_chp_stats;
648 if (stats->cs_chp_time)
649 stats->cs_chp_time = jbd2_time_diff(stats->cs_chp_time,
650 jiffies);
651 trace_jbd2_checkpoint_stats(journal->j_fs_dev->bd_dev,
652 transaction->t_tid, stats);
653
654 __jbd2_journal_drop_transaction(journal, transaction);
655 jbd2_journal_free_transaction(transaction);
656
657 /* Just in case anybody was waiting for more transactions to be
658 checkpointed... */
659 wake_up(&journal->j_wait_logspace);
660 ret = 1;
661out:
662 return ret;
663}
664
665/*
666 * journal_insert_checkpoint: put a committed buffer onto a checkpoint
667 * list so that we know when it is safe to clean the transaction out of
668 * the log.
669 *
670 * Called with the journal locked.
671 * Called with j_list_lock held.
672 */
673void __jbd2_journal_insert_checkpoint(struct journal_head *jh,
674 transaction_t *transaction)
675{
676 JBUFFER_TRACE(jh, "entry");
677 J_ASSERT_JH(jh, buffer_dirty(jh2bh(jh)) || buffer_jbddirty(jh2bh(jh)));
678 J_ASSERT_JH(jh, jh->b_cp_transaction == NULL);
679
680 /* Get reference for checkpointing transaction */
681 jbd2_journal_grab_journal_head(jh2bh(jh));
682 jh->b_cp_transaction = transaction;
683
684 if (!transaction->t_checkpoint_list) {
685 jh->b_cpnext = jh->b_cpprev = jh;
686 } else {
687 jh->b_cpnext = transaction->t_checkpoint_list;
688 jh->b_cpprev = transaction->t_checkpoint_list->b_cpprev;
689 jh->b_cpprev->b_cpnext = jh;
690 jh->b_cpnext->b_cpprev = jh;
691 }
692 transaction->t_checkpoint_list = jh;
693}
694
695/*
696 * We've finished with this transaction structure: adios...
697 *
698 * The transaction must have no links except for the checkpoint by this
699 * point.
700 *
701 * Called with the journal locked.
702 * Called with j_list_lock held.
703 */
704
705void __jbd2_journal_drop_transaction(journal_t *journal, transaction_t *transaction)
706{
707 assert_spin_locked(&journal->j_list_lock);
708 if (transaction->t_cpnext) {
709 transaction->t_cpnext->t_cpprev = transaction->t_cpprev;
710 transaction->t_cpprev->t_cpnext = transaction->t_cpnext;
711 if (journal->j_checkpoint_transactions == transaction)
712 journal->j_checkpoint_transactions =
713 transaction->t_cpnext;
714 if (journal->j_checkpoint_transactions == transaction)
715 journal->j_checkpoint_transactions = NULL;
716 }
717
718 J_ASSERT(transaction->t_state == T_FINISHED);
719 J_ASSERT(transaction->t_buffers == NULL);
720 J_ASSERT(transaction->t_forget == NULL);
721 J_ASSERT(transaction->t_iobuf_list == NULL);
722 J_ASSERT(transaction->t_shadow_list == NULL);
723 J_ASSERT(transaction->t_log_list == NULL);
724 J_ASSERT(transaction->t_checkpoint_list == NULL);
725 J_ASSERT(transaction->t_checkpoint_io_list == NULL);
726 J_ASSERT(atomic_read(&transaction->t_updates) == 0);
727 J_ASSERT(journal->j_committing_transaction != transaction);
728 J_ASSERT(journal->j_running_transaction != transaction);
729
730 trace_jbd2_drop_transaction(journal, transaction);
731
732 jbd_debug(1, "Dropping transaction %d, all done\n", transaction->t_tid);
733}