Lines Matching defs:journal
38 static int do_one_pass(journal_t *journal,
54 * When reading from the journal, we are going through the block device
66 static int do_readahead(journal_t *journal, unsigned int start)
76 max = start + (128 * 1024 / journal->j_blocksize);
77 if (max > journal->j_total_len)
78 max = journal->j_total_len;
86 err = jbd2_journal_bmap(journal, next, &blocknr);
94 bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize);
125 * Read a block from the journal
128 static int jread(struct buffer_head **bhp, journal_t *journal,
137 if (offset >= journal->j_total_len) {
138 printk(KERN_ERR "JBD2: corrupted journal superblock\n");
142 err = jbd2_journal_bmap(journal, offset, &blocknr);
150 bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize);
158 do_readahead(journal, offset);
193 * Count the number of in-use tags in a journal descriptor block.
196 static int count_tags(journal_t *journal, struct buffer_head *bh)
200 int nr = 0, size = journal->j_blocksize;
201 int tag_bytes = journal_tag_bytes(journal);
203 if (jbd2_journal_has_csum_v2or3(journal))
225 #define wrap(journal, var) \
228 jbd2_has_feature_fast_commit(journal) ? \
229 (journal)->j_fc_last : (journal)->j_last; \
232 var -= (_wrap_last - (journal)->j_first); \
235 static int fc_do_one_pass(journal_t *journal,
243 next_fc_block = journal->j_fc_first;
244 if (!journal->j_fc_replay_callback)
247 while (next_fc_block <= journal->j_fc_last) {
250 err = jread(&bh, journal, next_fc_block);
256 err = journal->j_fc_replay_callback(journal, bh, pass,
257 next_fc_block - journal->j_fc_first,
273 * jbd2_journal_recover - recovers a on-disk journal
274 * @journal: the journal to recover
284 int jbd2_journal_recover(journal_t *journal)
294 sb = journal->j_superblock;
297 * The journal superblock's s_start field (the current log head)
298 * is always zero if, and only if, the journal was cleanly
305 journal->j_transaction_sequence = be32_to_cpu(sb->s_sequence) + 1;
310 mapping = journal->j_fs_dev->bd_inode->i_mapping;
312 err = do_one_pass(journal, &info, PASS_SCAN);
314 err = do_one_pass(journal, &info, PASS_REVOKE);
316 err = do_one_pass(journal, &info, PASS_REPLAY);
326 journal->j_transaction_sequence = ++info.end_transaction;
328 jbd2_journal_clear_revoke(journal);
329 err2 = sync_blockdev(journal->j_fs_dev);
336 if (journal->j_flags & JBD2_BARRIER) {
337 err2 = blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL);
345 * jbd2_journal_skip_recovery - Start journal and wipe exiting records
346 * @journal: journal to startup
348 * Locate any valid recovery information from the journal and set up the
349 * journal structures in memory to ignore it (presumably because the
353 * We perform one pass over the journal to allow us to tell the user how
355 * the journal transaction sequence numbers to the next unused ID.
357 int jbd2_journal_skip_recovery(journal_t *journal)
365 err = do_one_pass(journal, &info, PASS_SCAN);
368 printk(KERN_ERR "JBD2: error %d scanning journal\n", err);
369 ++journal->j_transaction_sequence;
373 be32_to_cpu(journal->j_superblock->s_sequence);
375 "JBD2: ignoring %d transaction%s from the journal.\n",
378 journal->j_transaction_sequence = ++info.end_transaction;
381 journal->j_tail = 0;
385 static inline unsigned long long read_tag_block(journal_t *journal,
389 if (jbd2_has_feature_64bit(journal))
398 static int calc_chksums(journal_t *journal, struct buffer_head *bh,
405 num_blks = count_tags(journal, bh);
411 wrap(journal, *next_log_block);
412 err = jread(&obh, journal, io_block);
464 static int do_one_pass(journal_t *journal,
475 int tag_bytes = journal_tag_bytes(journal);
488 sb = journal->j_superblock;
524 jbd2_has_feature_fast_commit(journal) ?
525 journal->j_fc_last : journal->j_last);
532 err = jread(&bh, journal, next_log_block);
537 wrap(journal, next_log_block);
569 if (jbd2_journal_has_csum_v2or3(journal))
573 !jbd2_descriptor_block_csum_verify(journal,
577 * journal init. Don't error out on those yet.
598 jbd2_has_feature_checksum(journal) &&
601 if (calc_chksums(journal, bh,
610 next_log_block += count_tags(journal, bh);
611 wrap(journal, next_log_block);
622 <= journal->j_blocksize - descr_csum_size) {
629 wrap(journal, next_log_block);
630 err = jread(&obh, journal, io_block);
643 blocknr = read_tag_block(journal,
650 (journal, blocknr,
659 journal, tag, obh->b_data,
673 nbh = __getblk(journal->j_fs_dev,
675 journal->j_blocksize);
688 journal->j_blocksize);
719 * and journal corruption ?
753 * commit_time is increasing, it's the same journal,
754 * otherwise it is stale journal block, just end this
767 * It likely does not belong to same journal,
784 jbd2_has_feature_checksum(journal)) {
791 journal->j_failed_commit =
811 !jbd2_commit_block_csum_verify(journal,
818 if (!jbd2_has_feature_async_commit(journal)) {
819 journal->j_failed_commit =
837 !jbd2_descriptor_block_csum_verify(journal,
850 err = scan_revoke_records(journal, bh,
888 if (jbd2_has_feature_fast_commit(journal) && pass != PASS_REVOKE) {
889 err = fc_do_one_pass(journal, info, pass);
904 static int scan_revoke_records(journal_t *journal, struct buffer_head *bh,
917 if (jbd2_journal_has_csum_v2or3(journal))
919 if (rcount > journal->j_blocksize - csum_size)
923 if (jbd2_has_feature_64bit(journal))
935 err = jbd2_journal_set_revoke(journal, blocknr, sequence);