• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/fs/jbd2/

Lines Matching refs:journal

2  * linux/fs/jbd2/journal.c
12 * Generic filesystem journal-writing code; part of the ext2fs
19 * We do not actually manage the physical storage of the journal in this
20 * file: that is left to a per-journal policy function, which allows us
21 * to store the journal within a filesystem-specified area for ext2
93 static void __journal_abort_soft (journal_t *journal, int errno);
109 * journal.
114 * filesystem to disk. The journal thread is responsible for writing
125 journal_t *journal = arg;
132 setup_timer(&journal->j_commit_timer, commit_timeout,
135 /* Record that the journal thread is running */
136 journal->j_task = current;
137 wake_up(&journal->j_wait_done_commit);
142 write_lock(&journal->j_state_lock);
145 if (journal->j_flags & JBD2_UNMOUNT)
149 journal->j_commit_sequence, journal->j_commit_request);
151 if (journal->j_commit_sequence != journal->j_commit_request) {
153 write_unlock(&journal->j_state_lock);
154 del_timer_sync(&journal->j_commit_timer);
155 jbd2_journal_commit_transaction(journal);
156 write_lock(&journal->j_state_lock);
160 wake_up(&journal->j_wait_done_commit);
163 * The simpler the better. Flushing journal isn't a
168 write_unlock(&journal->j_state_lock);
170 write_lock(&journal->j_state_lock);
179 prepare_to_wait(&journal->j_wait_commit, &wait,
181 if (journal->j_commit_sequence != journal->j_commit_request)
183 transaction = journal->j_running_transaction;
187 if (journal->j_flags & JBD2_UNMOUNT)
190 write_unlock(&journal->j_state_lock);
192 write_lock(&journal->j_state_lock);
194 finish_wait(&journal->j_wait_commit, &wait);
202 transaction = journal->j_running_transaction;
204 journal->j_commit_request = transaction->t_tid;
210 write_unlock(&journal->j_state_lock);
211 del_timer_sync(&journal->j_commit_timer);
212 journal->j_task = NULL;
213 wake_up(&journal->j_wait_done_commit);
218 static int jbd2_journal_start_thread(journal_t *journal)
222 t = kthread_run(kjournald2, journal, "jbd2/%s",
223 journal->j_devname);
227 wait_event(journal->j_wait_done_commit, journal->j_task != NULL);
231 static void journal_kill_thread(journal_t *journal)
233 write_lock(&journal->j_state_lock);
234 journal->j_flags |= JBD2_UNMOUNT;
236 while (journal->j_task) {
237 wake_up(&journal->j_wait_commit);
238 write_unlock(&journal->j_state_lock);
239 wait_event(journal->j_wait_done_commit, journal->j_task == NULL);
240 write_lock(&journal->j_state_lock);
242 write_unlock(&journal->j_state_lock);
246 * jbd2_journal_write_metadata_buffer: write a metadata buffer to the journal.
271 * We assume that the journal has already been locked in this function.
296 journal_t *journal = transaction->t_journal;
423 spin_lock(&journal->j_list_lock);
425 spin_unlock(&journal->j_list_lock);
435 * Allocation code for the journal file. Manage the space left in the
436 * journal, so that we can begin checkpointing when appropriate.
440 * __jbd2_log_space_left: Return the number of free blocks left in the journal.
442 * Called with the journal already locked.
447 int __jbd2_log_space_left(journal_t *journal)
449 int left = journal->j_free;
451 /* assert_spin_locked(&journal->j_state_lock); */
471 int __jbd2_log_start_commit(journal_t *journal, tid_t target)
476 if (!tid_geq(journal->j_commit_request, target)) {
482 journal->j_commit_request = target;
484 journal->j_commit_request,
485 journal->j_commit_sequence);
486 wake_up(&journal->j_wait_commit);
492 int jbd2_log_start_commit(journal_t *journal, tid_t tid)
496 write_lock(&journal->j_state_lock);
497 ret = __jbd2_log_start_commit(journal, tid);
498 write_unlock(&journal->j_state_lock);
512 int jbd2_journal_force_commit_nested(journal_t *journal)
517 read_lock(&journal->j_state_lock);
518 if (journal->j_running_transaction && !current->journal_info) {
519 transaction = journal->j_running_transaction;
520 __jbd2_log_start_commit(journal, transaction->t_tid);
521 } else if (journal->j_committing_transaction)
522 transaction = journal->j_committing_transaction;
525 read_unlock(&journal->j_state_lock);
530 read_unlock(&journal->j_state_lock);
531 jbd2_log_wait_commit(journal, tid);
540 int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid)
544 write_lock(&journal->j_state_lock);
545 if (journal->j_running_transaction) {
546 tid_t tid = journal->j_running_transaction->t_tid;
548 __jbd2_log_start_commit(journal, tid);
554 } else if (journal->j_committing_transaction) {
560 *ptid = journal->j_committing_transaction->t_tid;
563 write_unlock(&journal->j_state_lock);
569 * The caller may not hold the journal lock.
571 int jbd2_log_wait_commit(journal_t *journal, tid_t tid)
575 read_lock(&journal->j_state_lock);
577 if (!tid_geq(journal->j_commit_request, tid)) {
580 __func__, journal->j_commit_request, tid);
583 while (tid_gt(tid, journal->j_commit_sequence)) {
585 tid, journal->j_commit_sequence);
586 wake_up(&journal->j_wait_commit);
587 read_unlock(&journal->j_state_lock);
588 wait_event(journal->j_wait_done_commit,
589 !tid_gt(tid, journal->j_commit_sequence));
590 read_lock(&journal->j_state_lock);
592 read_unlock(&journal->j_state_lock);
594 if (unlikely(is_journal_aborted(journal))) {
595 printk(KERN_EMERG "journal commit I/O error\n");
605 int jbd2_journal_next_log_block(journal_t *journal, unsigned long long *retp)
609 write_lock(&journal->j_state_lock);
610 J_ASSERT(journal->j_free > 1);
612 blocknr = journal->j_head;
613 journal->j_head++;
614 journal->j_free--;
615 if (journal->j_head == journal->j_last)
616 journal->j_head = journal->j_first;
617 write_unlock(&journal->j_state_lock);
618 return jbd2_journal_bmap(journal, blocknr, retp);
622 * Conversion of logical to physical block numbers for the journal
624 * On external journals the journal blocks are identity-mapped, so
628 int jbd2_journal_bmap(journal_t *journal, unsigned long blocknr,
634 if (journal->j_inode) {
635 ret = bmap(journal->j_inode, blocknr);
639 printk(KERN_ALERT "%s: journal block not found "
641 __func__, blocknr, journal->j_devname);
643 __journal_abort_soft(journal, err);
646 *retp = blocknr; /* +journal->j_blk_offset */
653 * the journal without copying their contents, but for journal
661 struct journal_head *jbd2_journal_get_descriptor_buffer(journal_t *journal)
667 err = jbd2_journal_next_log_block(journal, &blocknr);
672 bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize);
676 memset(bh->b_data, 0, journal->j_blocksize);
684 journal_t *journal;
708 s->journal->j_max_transaction_buffers);
722 div_u64(s->journal->j_average_commit_time, 1000));
745 journal_t *journal = PDE(inode)->data;
758 spin_lock(&journal->j_history_lock);
759 memcpy(s->stats, &journal->j_stats, size);
760 s->journal = journal;
761 spin_unlock(&journal->j_history_lock);
794 static void jbd2_stats_proc_init(journal_t *journal)
796 journal->j_proc_entry = proc_mkdir(journal->j_devname, proc_jbd2_stats);
797 if (journal->j_proc_entry) {
798 proc_create_data("info", S_IRUGO, journal->j_proc_entry,
799 &jbd2_seq_info_fops, journal);
803 static void jbd2_stats_proc_exit(journal_t *journal)
805 remove_proc_entry("info", journal->j_proc_entry);
806 remove_proc_entry(journal->j_devname, proc_jbd2_stats);
810 * Management for journal control blocks: functions to create and
812 * journal blocks from disk. */
816 * journal structures from from scratch, or loaded them from disk. */
820 journal_t *journal;
823 journal = kzalloc(sizeof(*journal), GFP_KERNEL);
824 if (!journal)
827 init_waitqueue_head(&journal->j_wait_transaction_locked);
828 init_waitqueue_head(&journal->j_wait_logspace);
829 init_waitqueue_head(&journal->j_wait_done_commit);
830 init_waitqueue_head(&journal->j_wait_checkpoint);
831 init_waitqueue_head(&journal->j_wait_commit);
832 init_waitqueue_head(&journal->j_wait_updates);
833 mutex_init(&journal->j_barrier);
834 mutex_init(&journal->j_checkpoint_mutex);
835 spin_lock_init(&journal->j_revoke_lock);
836 spin_lock_init(&journal->j_list_lock);
837 rwlock_init(&journal->j_state_lock);
839 journal->j_commit_interval = (HZ * JBD2_DEFAULT_MAX_COMMIT_AGE);
840 journal->j_min_batch_time = 0;
841 journal->j_max_batch_time = 15000; /* 15ms */
843 /* The journal is marked for error until we succeed with recovery! */
844 journal->j_flags = JBD2_ABORT;
847 err = jbd2_journal_init_revoke(journal, JOURNAL_REVOKE_DEFAULT_HASH);
849 kfree(journal);
853 spin_lock_init(&journal->j_history_lock);
855 return journal;
862 * Create a journal structure assigned some fixed set of disk blocks to
863 * the journal. We don't actually touch those disk blocks yet, but we
865 * system where the journal blocks are.
870 * journal_t * jbd2_journal_init_dev() - creates and initialises a journal structure
871 * @bdev: Block device on which to create the journal
872 * @fs_dev: Device which hold journalled filesystem for this journal.
873 * @start: Block nr Start of journal.
874 * @len: Length of the journal in blocks.
879 * jbd2_journal_init_dev creates a journal which maps a fixed contiguous
887 journal_t *journal = journal_init_common();
892 if (!journal)
895 /* journal descriptor can store up to n blocks -bzzz */
896 journal->j_blocksize = blocksize;
897 jbd2_stats_proc_init(journal);
898 n = journal->j_blocksize / sizeof(journal_block_tag_t);
899 journal->j_wbufsize = n;
900 journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL);
901 if (!journal->j_wbuf) {
906 journal->j_dev = bdev;
907 journal->j_fs_dev = fs_dev;
908 journal->j_blk_offset = start;
909 journal->j_maxlen = len;
910 bdevname(journal->j_dev, journal->j_devname);
911 p = journal->j_devname;
915 bh = __getblk(journal->j_dev, start, journal->j_blocksize);
918 "%s: Cannot get buffer for journal superblock\n",
922 journal->j_sb_buffer = bh;
923 journal->j_superblock = (journal_superblock_t *)bh->b_data;
925 return journal;
927 kfree(journal->j_wbuf);
928 jbd2_stats_proc_exit(journal);
929 kfree(journal);
934 * journal_t * jbd2_journal_init_inode () - creates a journal which maps to a inode.
935 * @inode: An inode to create the journal in
937 * jbd2_journal_init_inode creates a journal which maps an on-disk inode as
938 * the journal. The inode must exist already, must support bmap() and
944 journal_t *journal = journal_init_common();
950 if (!journal)
953 journal->j_dev = journal->j_fs_dev = inode->i_sb->s_bdev;
954 journal->j_inode = inode;
955 bdevname(journal->j_dev, journal->j_devname);
956 p = journal->j_devname;
959 p = journal->j_devname + strlen(journal->j_devname);
960 sprintf(p, "-%lu", journal->j_inode->i_ino);
962 "journal %p: inode %s/%ld, size %Ld, bits %d, blksize %ld\n",
963 journal, inode->i_sb->s_id, inode->i_ino,
967 journal->j_maxlen = inode->i_size >> inode->i_sb->s_blocksize_bits;
968 journal->j_blocksize = inode->i_sb->s_blocksize;
969 jbd2_stats_proc_init(journal);
971 /* journal descriptor can store up to n blocks -bzzz */
972 n = journal->j_blocksize / sizeof(journal_block_tag_t);
973 journal->j_wbufsize = n;
974 journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL);
975 if (!journal->j_wbuf) {
981 err = jbd2_journal_bmap(journal, 0, &blocknr);
984 printk(KERN_ERR "%s: Cannnot locate journal superblock\n",
989 bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize);
992 "%s: Cannot get buffer for journal superblock\n",
996 journal->j_sb_buffer = bh;
997 journal->j_superblock = (journal_superblock_t *)bh->b_data;
999 return journal;
1001 kfree(journal->j_wbuf);
1002 jbd2_stats_proc_exit(journal);
1003 kfree(journal);
1008 * If the journal init or create aborts, we need to mark the journal
1009 * superblock as being NULL to prevent the journal destroy from writing
1012 static void journal_fail_superblock (journal_t *journal)
1014 struct buffer_head *bh = journal->j_sb_buffer;
1016 journal->j_sb_buffer = NULL;
1022 * a journal, and after recovering an old journal to reset it for
1026 static int journal_reset(journal_t *journal)
1028 journal_superblock_t *sb = journal->j_superblock;
1036 journal_fail_superblock(journal);
1040 journal->j_first = first;
1041 journal->j_last = last;
1043 journal->j_head = first;
1044 journal->j_tail = first;
1045 journal->j_free = last - first;
1047 journal->j_tail_sequence = journal->j_transaction_sequence;
1048 journal->j_commit_sequence = journal->j_transaction_sequence - 1;
1049 journal->j_commit_request = journal->j_commit_sequence;
1051 journal->j_max_transaction_buffers = journal->j_maxlen / 4;
1054 jbd2_journal_update_superblock(journal, 1);
1055 return jbd2_journal_start_thread(journal);
1059 * void jbd2_journal_update_superblock() - Update journal sb on disk.
1060 * @journal: The journal to update.
1063 * Update a journal's dynamic superblock fields and write it to disk,
1066 void jbd2_journal_update_superblock(journal_t *journal, int wait)
1068 journal_superblock_t *sb = journal->j_superblock;
1069 struct buffer_head *bh = journal->j_sb_buffer;
1078 if (sb->s_start == 0 && journal->j_tail_sequence ==
1079 journal->j_transaction_sequence) {
1082 journal->j_tail, journal->j_tail_sequence,
1083 journal->j_errno);
1089 * Oh, dear. A previous attempt to write the journal
1097 "for journal superblock update for %s.\n",
1098 journal->j_devname);
1103 read_lock(&journal->j_state_lock);
1105 journal->j_tail, journal->j_tail_sequence, journal->j_errno);
1107 sb->s_sequence = cpu_to_be32(journal->j_tail_sequence);
1108 sb->s_start = cpu_to_be32(journal->j_tail);
1109 sb->s_errno = cpu_to_be32(journal->j_errno);
1110 read_unlock(&journal->j_state_lock);
1118 "when updating journal superblock for %s.\n",
1119 journal->j_devname);
1131 write_lock(&journal->j_state_lock);
1133 journal->j_flags &= ~JBD2_FLUSHED;
1135 journal->j_flags |= JBD2_FLUSHED;
1136 write_unlock(&journal->j_state_lock);
1140 * Read the superblock for a given journal, performing initial
1144 static int journal_get_superblock(journal_t *journal)
1150 bh = journal->j_sb_buffer;
1158 "JBD: IO error reading journal superblock\n");
1163 sb = journal->j_superblock;
1168 sb->s_blocksize != cpu_to_be32(journal->j_blocksize)) {
1169 printk(KERN_WARNING "JBD: no valid journal superblock found\n");
1175 journal->j_format_version = 1;
1178 journal->j_format_version = 2;
1185 if (be32_to_cpu(sb->s_maxlen) < journal->j_maxlen)
1186 journal->j_maxlen = be32_to_cpu(sb->s_maxlen);
1187 else if (be32_to_cpu(sb->s_maxlen) > journal->j_maxlen) {
1188 printk (KERN_WARNING "JBD: journal file too short\n");
1195 journal_fail_superblock(journal);
1200 * Load the on-disk journal superblock and read the key fields into the
1204 static int load_superblock(journal_t *journal)
1209 err = journal_get_superblock(journal);
1213 sb = journal->j_superblock;
1215 journal->j_tail_sequence = be32_to_cpu(sb->s_sequence);
1216 journal->j_tail = be32_to_cpu(sb->s_start);
1217 journal->j_first = be32_to_cpu(sb->s_first);
1218 journal->j_last = be32_to_cpu(sb->s_maxlen);
1219 journal->j_errno = be32_to_cpu(sb->s_errno);
1226 * int jbd2_journal_load() - Read journal from disk.
1227 * @journal: Journal to act on.
1230 * a journal, read the journal from disk to initialise the in-memory
1233 int jbd2_journal_load(journal_t *journal)
1238 err = load_superblock(journal);
1242 sb = journal->j_superblock;
1246 if (journal->j_format_version >= 2) {
1252 "JBD: Unrecognised features on journal\n");
1265 * data from the journal. */
1266 if (jbd2_journal_recover(journal))
1269 if (journal->j_failed_commit) {
1270 printk(KERN_ERR "JBD2: journal transaction %u on %s "
1271 "is corrupt.\n", journal->j_failed_commit,
1272 journal->j_devname);
1276 /* OK, we've finished with the dynamic journal bits:
1279 if (journal_reset(journal))
1282 journal->j_flags &= ~JBD2_ABORT;
1283 journal->j_flags |= JBD2_LOADED;
1293 * @journal: Journal to act on.
1297 * Return <0 if we couldn't clean up the journal.
1299 int jbd2_journal_destroy(journal_t *journal)
1304 journal_kill_thread(journal);
1307 if (journal->j_running_transaction)
1308 jbd2_journal_commit_transaction(journal);
1313 spin_lock(&journal->j_list_lock);
1314 while (journal->j_checkpoint_transactions != NULL) {
1315 spin_unlock(&journal->j_list_lock);
1316 mutex_lock(&journal->j_checkpoint_mutex);
1317 jbd2_log_do_checkpoint(journal);
1318 mutex_unlock(&journal->j_checkpoint_mutex);
1319 spin_lock(&journal->j_list_lock);
1322 J_ASSERT(journal->j_running_transaction == NULL);
1323 J_ASSERT(journal->j_committing_transaction == NULL);
1324 J_ASSERT(journal->j_checkpoint_transactions == NULL);
1325 spin_unlock(&journal->j_list_lock);
1327 if (journal->j_sb_buffer) {
1328 if (!is_journal_aborted(journal)) {
1329 /* We can now mark the journal as empty. */
1330 journal->j_tail = 0;
1331 journal->j_tail_sequence =
1332 ++journal->j_transaction_sequence;
1333 jbd2_journal_update_superblock(journal, 1);
1337 brelse(journal->j_sb_buffer);
1340 if (journal->j_proc_entry)
1341 jbd2_stats_proc_exit(journal);
1342 if (journal->j_inode)
1343 iput(journal->j_inode);
1344 if (journal->j_revoke)
1345 jbd2_journal_destroy_revoke(journal);
1346 kfree(journal->j_wbuf);
1347 kfree(journal);
1355 * @journal: Journal to check.
1360 * Check whether the journal uses all of a given set of
1364 int jbd2_journal_check_used_features (journal_t *journal, unsigned long compat,
1371 if (journal->j_format_version == 1)
1374 sb = journal->j_superblock;
1386 * @journal: Journal to check.
1392 * all of a given set of features on this journal. Return true
1395 int jbd2_journal_check_available_features (journal_t *journal, unsigned long compat,
1405 if (journal->j_format_version != 2)
1417 * int jbd2_journal_set_features () - Mark a given journal feature in the superblock
1418 * @journal: Journal to act on.
1423 * Mark a given journal feature as present on the
1428 int jbd2_journal_set_features (journal_t *journal, unsigned long compat,
1433 if (jbd2_journal_check_used_features(journal, compat, ro, incompat))
1436 if (!jbd2_journal_check_available_features(journal, compat, ro, incompat))
1442 sb = journal->j_superblock;
1452 * jbd2_journal_clear_features () - Clear a given journal feature in the
1454 * @journal: Journal to act on.
1459 * Clear a given journal feature as present on the
1462 void jbd2_journal_clear_features(journal_t *journal, unsigned long compat,
1470 sb = journal->j_superblock;
1479 * int jbd2_journal_update_format () - Update on-disk journal structure.
1480 * @journal: Journal to act on.
1482 * Given an initialised but unloaded journal struct, poke about in the
1485 int jbd2_journal_update_format (journal_t *journal)
1490 err = journal_get_superblock(journal);
1494 sb = journal->j_superblock;
1500 return journal_convert_superblock_v1(journal, sb);
1507 static int journal_convert_superblock_v1(journal_t *journal,
1523 journal->j_format_version = 2;
1525 bh = journal->j_sb_buffer;
1534 * int jbd2_journal_flush () - Flush journal
1535 * @journal: Journal to act on.
1537 * Flush all data for a given journal to disk and empty the journal.
1542 int jbd2_journal_flush(journal_t *journal)
1548 write_lock(&journal->j_state_lock);
1551 if (journal->j_running_transaction) {
1552 transaction = journal->j_running_transaction;
1553 __jbd2_log_start_commit(journal, transaction->t_tid);
1554 } else if (journal->j_committing_transaction)
1555 transaction = journal->j_committing_transaction;
1561 write_unlock(&journal->j_state_lock);
1562 jbd2_log_wait_commit(journal, tid);
1564 write_unlock(&journal->j_state_lock);
1568 spin_lock(&journal->j_list_lock);
1569 while (!err && journal->j_checkpoint_transactions != NULL) {
1570 spin_unlock(&journal->j_list_lock);
1571 mutex_lock(&journal->j_checkpoint_mutex);
1572 err = jbd2_log_do_checkpoint(journal);
1573 mutex_unlock(&journal->j_checkpoint_mutex);
1574 spin_lock(&journal->j_list_lock);
1576 spin_unlock(&journal->j_list_lock);
1578 if (is_journal_aborted(journal))
1581 jbd2_cleanup_journal_tail(journal);
1583 /* Finally, mark the journal as really needing no recovery.
1586 * commits of data to the journal will restore the current
1588 write_lock(&journal->j_state_lock);
1589 old_tail = journal->j_tail;
1590 journal->j_tail = 0;
1591 write_unlock(&journal->j_state_lock);
1592 jbd2_journal_update_superblock(journal, 1);
1593 write_lock(&journal->j_state_lock);
1594 journal->j_tail = old_tail;
1596 J_ASSERT(!journal->j_running_transaction);
1597 J_ASSERT(!journal->j_committing_transaction);
1598 J_ASSERT(!journal->j_checkpoint_transactions);
1599 J_ASSERT(journal->j_head == journal->j_tail);
1600 J_ASSERT(journal->j_tail_sequence == journal->j_transaction_sequence);
1601 write_unlock(&journal->j_state_lock);
1606 * int jbd2_journal_wipe() - Wipe journal contents
1607 * @journal: Journal to act on.
1610 * Wipe out all of the contents of a journal, safely. This will produce
1611 * a warning if the journal contains any valid recovery information.
1614 * If 'write' is non-zero, then we wipe out the journal on disk; otherwise
1618 int jbd2_journal_wipe(journal_t *journal, int write)
1622 J_ASSERT (!(journal->j_flags & JBD2_LOADED));
1624 err = load_superblock(journal);
1628 if (!journal->j_tail)
1631 printk (KERN_WARNING "JBD: %s recovery information on journal\n",
1634 err = jbd2_journal_skip_recovery(journal);
1636 jbd2_journal_update_superblock(journal, 1);
1644 * for journal abort.
1651 * Quick version for internal journal use (doesn't lock the journal).
1653 * and don't attempt to make any other journal updates.
1655 void __jbd2_journal_abort_hard(journal_t *journal)
1659 if (journal->j_flags & JBD2_ABORT)
1662 printk(KERN_ERR "Aborting journal on device %s.\n",
1663 journal->j_devname);
1665 write_lock(&journal->j_state_lock);
1666 journal->j_flags |= JBD2_ABORT;
1667 transaction = journal->j_running_transaction;
1669 __jbd2_log_start_commit(journal, transaction->t_tid);
1670 write_unlock(&journal->j_state_lock);
1673 /* Soft abort: record the abort error status in the journal superblock,
1675 static void __journal_abort_soft (journal_t *journal, int errno)
1677 if (journal->j_flags & JBD2_ABORT)
1680 if (!journal->j_errno)
1681 journal->j_errno = errno;
1683 __jbd2_journal_abort_hard(journal);
1686 jbd2_journal_update_superblock(journal, 1);
1690 * void jbd2_journal_abort () - Shutdown the journal immediately.
1691 * @journal: the journal to shutdown.
1692 * @errno: an error number to record in the journal indicating
1696 * journal (not of a single transaction). This operation cannot be
1697 * undone without closing and reopening the journal.
1709 * hitting the journal. Atomicity cannot be guaranteed on an aborted
1713 * Any attempt to get a new transaction handle on a journal which is in
1718 * Recursive transactions are not disturbed by journal abort until the
1722 * which will be recorded (if possible) in the journal superblock. This
1730 * writes are done to the journal (unless there are any already in
1735 void jbd2_journal_abort(journal_t *journal, int errno)
1737 __journal_abort_soft(journal, errno);
1741 * int jbd2_journal_errno () - returns the journal's error state.
1742 * @journal: journal to examine.
1745 * time the journal was mounted - if the journal was stopped
1748 * If the journal has been aborted on this mount time -EROFS will
1751 int jbd2_journal_errno(journal_t *journal)
1755 read_lock(&journal->j_state_lock);
1756 if (journal->j_flags & JBD2_ABORT)
1759 err = journal->j_errno;
1760 read_unlock(&journal->j_state_lock);
1765 * int jbd2_journal_clear_err () - clears the journal's error state
1766 * @journal: journal to act on.
1771 int jbd2_journal_clear_err(journal_t *journal)
1775 write_lock(&journal->j_state_lock);
1776 if (journal->j_flags & JBD2_ABORT)
1779 journal->j_errno = 0;
1780 write_unlock(&journal->j_state_lock);
1785 * void jbd2_journal_ack_err() - Ack journal err.
1786 * @journal: journal to act on.
1791 void jbd2_journal_ack_err(journal_t *journal)
1793 write_lock(&journal->j_state_lock);
1794 if (journal->j_errno)
1795 journal->j_flags |= JBD2_ACK_ERR;
1796 write_unlock(&journal->j_state_lock);
1807 size_t journal_tag_bytes(journal_t *journal)
1809 if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT))
2010 * Doesn't need the journal lock.
2162 void jbd2_journal_release_jbd_inode(journal_t *journal,
2165 if (!journal)
2168 spin_lock(&journal->j_list_lock);
2175 spin_unlock(&journal->j_list_lock);
2185 spin_unlock(&journal->j_list_lock);