Lines Matching defs:journal

39 static int do_one_pass(journal_t *journal,
55 * When reading from the journal, we are going through the block device
67 static int do_readahead(journal_t *journal, unsigned int start)
77 max = start + (128 * 1024 / journal->j_blocksize);
78 if (max > journal->j_total_len)
79 max = journal->j_total_len;
87 err = jbd2_journal_bmap(journal, next, &blocknr);
95 bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize);
126 * Read a block from the journal
129 static int jread(struct buffer_head **bhp, journal_t *journal,
138 if (offset >= journal->j_total_len) {
139 printk(KERN_ERR "JBD2: corrupted journal superblock\n");
143 err = jbd2_journal_bmap(journal, offset, &blocknr);
151 bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize);
164 do_readahead(journal, offset);
199 * Count the number of in-use tags in a journal descriptor block.
202 static int count_tags(journal_t *journal, struct buffer_head *bh)
206 int nr = 0, size = journal->j_blocksize;
207 int tag_bytes = journal_tag_bytes(journal);
209 if (jbd2_journal_has_csum_v2or3(journal))
231 #define wrap(journal, var) \
233 if (var >= (journal)->j_last) \
234 var -= ((journal)->j_last - (journal)->j_first); \
237 static int fc_do_one_pass(journal_t *journal,
245 next_fc_block = journal->j_fc_first;
246 if (!journal->j_fc_replay_callback)
249 while (next_fc_block <= journal->j_fc_last) {
252 err = jread(&bh, journal, next_fc_block);
258 err = journal->j_fc_replay_callback(journal, bh, pass,
259 next_fc_block - journal->j_fc_first,
275 * jbd2_journal_recover - recovers a on-disk journal
276 * @journal: the journal to recover
286 int jbd2_journal_recover(journal_t *journal)
296 sb = journal->j_superblock;
299 * The journal superblock's s_start field (the current log head)
300 * is always zero if, and only if, the journal was cleanly
306 journal->j_transaction_sequence = be32_to_cpu(sb->s_sequence) + 1;
307 journal->j_head = be32_to_cpu(sb->s_head);
312 mapping = journal->j_fs_dev->bd_inode->i_mapping;
314 err = do_one_pass(journal, &info, PASS_SCAN);
316 err = do_one_pass(journal, &info, PASS_REVOKE);
318 err = do_one_pass(journal, &info, PASS_REPLAY);
328 journal->j_transaction_sequence = ++info.end_transaction;
329 journal->j_head = info.head_block;
331 journal->j_transaction_sequence, journal->j_head);
333 jbd2_journal_clear_revoke(journal);
334 err2 = sync_blockdev(journal->j_fs_dev);
341 if (journal->j_flags & JBD2_BARRIER) {
342 err2 = blkdev_issue_flush(journal->j_fs_dev);
350 * jbd2_journal_skip_recovery - Start journal and wipe exiting records
351 * @journal: journal to startup
353 * Locate any valid recovery information from the journal and set up the
354 * journal structures in memory to ignore it (presumably because the
358 * We perform one pass over the journal to allow us to tell the user how
360 * the journal transaction sequence numbers to the next unused ID.
362 int jbd2_journal_skip_recovery(journal_t *journal)
370 err = do_one_pass(journal, &info, PASS_SCAN);
373 printk(KERN_ERR "JBD2: error %d scanning journal\n", err);
374 ++journal->j_transaction_sequence;
375 journal->j_head = journal->j_first;
379 be32_to_cpu(journal->j_superblock->s_sequence);
381 "JBD2: ignoring %d transaction%s from the journal.\n",
384 journal->j_transaction_sequence = ++info.end_transaction;
385 journal->j_head = info.head_block;
388 journal->j_tail = 0;
392 static inline unsigned long long read_tag_block(journal_t *journal,
396 if (jbd2_has_feature_64bit(journal))
405 static int calc_chksums(journal_t *journal, struct buffer_head *bh,
412 num_blks = count_tags(journal, bh);
418 wrap(journal, *next_log_block);
419 err = jread(&obh, journal, io_block);
471 static int do_one_pass(journal_t *journal,
482 int tag_bytes = journal_tag_bytes(journal);
495 sb = journal->j_superblock;
531 next_commit_ID, next_log_block, journal->j_last);
538 err = jread(&bh, journal, next_log_block);
543 wrap(journal, next_log_block);
575 if (jbd2_journal_has_csum_v2or3(journal))
579 !jbd2_descriptor_block_csum_verify(journal,
583 * journal init. Don't error out on those yet.
604 jbd2_has_feature_checksum(journal) &&
607 if (calc_chksums(journal, bh,
616 next_log_block += count_tags(journal, bh);
617 wrap(journal, next_log_block);
628 <= journal->j_blocksize - descr_csum_size) {
635 wrap(journal, next_log_block);
636 err = jread(&obh, journal, io_block);
649 blocknr = read_tag_block(journal,
656 (journal, blocknr,
665 journal, &tag, (journal_block_tag3_t *)tagp,
679 nbh = __getblk(journal->j_fs_dev,
681 journal->j_blocksize);
694 journal->j_blocksize);
724 * and journal corruption ?
758 * commit_time is increasing, it's the same journal,
759 * otherwise it is stale journal block, just end this
772 * It likely does not belong to same journal,
788 jbd2_has_feature_checksum(journal)) {
795 journal->j_failed_commit =
815 !jbd2_commit_block_csum_verify(journal,
823 if (!jbd2_has_feature_async_commit(journal)) {
824 journal->j_failed_commit =
844 !jbd2_descriptor_block_csum_verify(journal,
857 err = scan_revoke_records(journal, bh,
897 if (jbd2_has_feature_fast_commit(journal) && pass != PASS_REVOKE) {
898 err = fc_do_one_pass(journal, info, pass);
913 static int scan_revoke_records(journal_t *journal, struct buffer_head *bh,
926 if (jbd2_journal_has_csum_v2or3(journal))
928 if (rcount > journal->j_blocksize - csum_size)
932 if (jbd2_has_feature_64bit(journal))
944 err = jbd2_journal_set_revoke(journal, blocknr, sequence);