Lines Matching refs:journal
42 static int do_one_pass(journal_t *journal,
70 static int do_readahead(journal_t *journal, unsigned int start) in do_readahead() argument
80 max = start + (128 * 1024 / journal->j_blocksize); in do_readahead()
81 if (max > journal->j_maxlen) in do_readahead()
82 max = journal->j_maxlen; in do_readahead()
90 err = jbd2_journal_bmap(journal, next, &blocknr); in do_readahead()
98 bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize); in do_readahead()
132 static int jread(struct buffer_head **bhp, journal_t *journal, in jread() argument
141 if (offset >= journal->j_maxlen) { in jread()
146 err = jbd2_journal_bmap(journal, offset, &blocknr); in jread()
154 bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize); in jread()
162 do_readahead(journal, offset); in jread()
201 static int count_tags(journal_t *journal, struct buffer_head *bh) in count_tags() argument
205 int nr = 0, size = journal->j_blocksize; in count_tags()
206 int tag_bytes = journal_tag_bytes(journal); in count_tags()
208 if (jbd2_journal_has_csum_v2or3(journal)) in count_tags()
230 #define wrap(journal, var) \ argument
232 if (var >= (journal)->j_last) \
233 var -= ((journal)->j_last - (journal)->j_first); \
248 int jbd2_journal_recover(journal_t *journal) in jbd2_journal_recover() argument
256 sb = journal->j_superblock; in jbd2_journal_recover()
267 journal->j_transaction_sequence = be32_to_cpu(sb->s_sequence) + 1; in jbd2_journal_recover()
271 err = do_one_pass(journal, &info, PASS_SCAN); in jbd2_journal_recover()
273 err = do_one_pass(journal, &info, PASS_REVOKE); in jbd2_journal_recover()
275 err = do_one_pass(journal, &info, PASS_REPLAY); in jbd2_journal_recover()
285 journal->j_transaction_sequence = ++info.end_transaction; in jbd2_journal_recover()
287 jbd2_journal_clear_revoke(journal); in jbd2_journal_recover()
288 err2 = sync_blockdev(journal->j_fs_dev); in jbd2_journal_recover()
292 if (journal->j_flags & JBD2_BARRIER) { in jbd2_journal_recover()
293 err2 = blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL); in jbd2_journal_recover()
313 int jbd2_journal_skip_recovery(journal_t *journal) in jbd2_journal_skip_recovery() argument
321 err = do_one_pass(journal, &info, PASS_SCAN); in jbd2_journal_skip_recovery()
325 ++journal->j_transaction_sequence; in jbd2_journal_skip_recovery()
329 be32_to_cpu(journal->j_superblock->s_sequence); in jbd2_journal_skip_recovery()
334 journal->j_transaction_sequence = ++info.end_transaction; in jbd2_journal_skip_recovery()
337 journal->j_tail = 0; in jbd2_journal_skip_recovery()
341 static inline unsigned long long read_tag_block(journal_t *journal, in read_tag_block() argument
345 if (jbd2_has_feature_64bit(journal)) in read_tag_block()
354 static int calc_chksums(journal_t *journal, struct buffer_head *bh, in calc_chksums() argument
361 num_blks = count_tags(journal, bh); in calc_chksums()
367 wrap(journal, *next_log_block); in calc_chksums()
368 err = jread(&obh, journal, io_block); in calc_chksums()
420 static int do_one_pass(journal_t *journal, in do_one_pass() argument
431 int tag_bytes = journal_tag_bytes(journal); in do_one_pass()
442 sb = journal->j_superblock; in do_one_pass()
477 next_commit_ID, next_log_block, journal->j_last); in do_one_pass()
484 err = jread(&bh, journal, next_log_block); in do_one_pass()
489 wrap(journal, next_log_block); in do_one_pass()
521 if (jbd2_journal_has_csum_v2or3(journal)) in do_one_pass()
525 !jbd2_descr_block_csum_verify(journal, in do_one_pass()
541 jbd2_has_feature_checksum(journal) && in do_one_pass()
543 if (calc_chksums(journal, bh, in do_one_pass()
552 next_log_block += count_tags(journal, bh); in do_one_pass()
553 wrap(journal, next_log_block); in do_one_pass()
564 <= journal->j_blocksize - descr_csum_size) { in do_one_pass()
571 wrap(journal, next_log_block); in do_one_pass()
572 err = jread(&obh, journal, io_block); in do_one_pass()
585 blocknr = read_tag_block(journal, in do_one_pass()
592 (journal, blocknr, in do_one_pass()
601 journal, tag, obh->b_data, in do_one_pass()
615 nbh = __getblk(journal->j_fs_dev, in do_one_pass()
617 journal->j_blocksize); in do_one_pass()
630 journal->j_blocksize); in do_one_pass()
696 jbd2_has_feature_checksum(journal)) { in do_one_pass()
706 journal->j_failed_commit = in do_one_pass()
736 if (!jbd2_has_feature_async_commit(journal)) { in do_one_pass()
737 journal->j_failed_commit = in do_one_pass()
746 !jbd2_commit_block_csum_verify(journal, in do_one_pass()
750 if (!jbd2_has_feature_async_commit(journal)) { in do_one_pass()
751 journal->j_failed_commit = in do_one_pass()
769 err = scan_revoke_records(journal, bh, in do_one_pass()
836 static int scan_revoke_records(journal_t *journal, struct buffer_head *bh, in scan_revoke_records() argument
849 if (!jbd2_revoke_block_csum_verify(journal, header)) in scan_revoke_records()
852 if (jbd2_journal_has_csum_v2or3(journal)) in scan_revoke_records()
854 if (rcount > journal->j_blocksize - csum_size) in scan_revoke_records()
858 if (jbd2_has_feature_64bit(journal)) in scan_revoke_records()
870 err = jbd2_journal_set_revoke(journal, blocknr, sequence); in scan_revoke_records()