checkpoint.c (6548698f929814375fa5d62ae1db96959b0418c1) checkpoint.c (71f2be213a0009098819e5c04f75ff19f84f2122)
1/*
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

--- 8 unchanged lines hidden (view full) ---

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>
1/*
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

--- 8 unchanged lines hidden (view full) ---

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>
25#include <trace/events/jbd2.h>
26
27/*
28 * Unlink a buffer from a transaction checkpoint list.
29 *
30 * Called with j_list_lock held.
31 */
32static inline void __buffer_unlink_first(struct journal_head *jh)

--- 468 unchanged lines hidden (view full) ---

501
502 /* OK, update the superblock to recover the freed space.
503 * Physical blocks come first: have we wrapped beyond the end of
504 * the log? */
505 freed = blocknr - journal->j_tail;
506 if (blocknr < journal->j_tail)
507 freed = freed + journal->j_last - journal->j_first;
508
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)

--- 468 unchanged lines hidden (view full) ---

502
503 /* OK, update the superblock to recover the freed space.
504 * Physical blocks come first: have we wrapped beyond the end of
505 * the log? */
506 freed = blocknr - journal->j_tail;
507 if (blocknr < journal->j_tail)
508 freed = freed + journal->j_last - journal->j_first;
509
510 trace_jbd2_cleanup_journal_tail(journal, first_tid, blocknr, freed);
509 jbd_debug(1,
510 "Cleaning journal tail from %d to %d (offset %lu), "
511 "freeing %lu\n",
512 journal->j_tail_sequence, first_tid, blocknr, freed);
513
514 journal->j_free += freed;
515 journal->j_tail_sequence = first_tid;
516 journal->j_tail = blocknr;
517 spin_unlock(&journal->j_state_lock);
511 jbd_debug(1,
512 "Cleaning journal tail from %d to %d (offset %lu), "
513 "freeing %lu\n",
514 journal->j_tail_sequence, first_tid, blocknr, freed);
515
516 journal->j_free += freed;
517 journal->j_tail_sequence = first_tid;
518 journal->j_tail = blocknr;
519 spin_unlock(&journal->j_state_lock);
520
521 /*
522 * If there is an external journal, we need to make sure that
523 * any data blocks that were recently written out --- perhaps
524 * by jbd2_log_do_checkpoint() --- are flushed out before we
525 * drop the transactions from the external journal. It's
526 * unlikely this will be necessary, especially with a
527 * appropriately sized journal, but we need this to guarantee
528 * correctness. Fortunately jbd2_cleanup_journal_tail()
529 * doesn't get called all that often.
530 */
531 if ((journal->j_fs_dev != journal->j_dev) &&
532 (journal->j_flags & JBD2_BARRIER))
533 blkdev_issue_flush(journal->j_fs_dev, NULL);
518 if (!(journal->j_flags & JBD2_ABORT))
519 jbd2_journal_update_superblock(journal, 1);
520 return 0;
521}
522
523
524/* Checkpoint list management */
525

--- 241 unchanged lines hidden ---
534 if (!(journal->j_flags & JBD2_ABORT))
535 jbd2_journal_update_superblock(journal, 1);
536 return 0;
537}
538
539
540/* Checkpoint list management */
541

--- 241 unchanged lines hidden ---