Lines Matching refs:journal
38 static int do_one_pass(journal_t *journal,
66 static int do_readahead(journal_t *journal, unsigned int start) in do_readahead() argument
76 max = start + (128 * 1024 / journal->j_blocksize); in do_readahead()
77 if (max > journal->j_total_len) in do_readahead()
78 max = journal->j_total_len; in do_readahead()
86 err = jbd2_journal_bmap(journal, next, &blocknr); in do_readahead()
94 bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize); in do_readahead()
128 static int jread(struct buffer_head **bhp, journal_t *journal, in jread() argument
137 if (offset >= journal->j_total_len) { in jread()
142 err = jbd2_journal_bmap(journal, offset, &blocknr); in jread()
150 bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize); in jread()
163 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
233 jbd2_has_feature_fast_commit(journal) ? \
234 (journal)->j_fc_last : (journal)->j_last; \
237 var -= (_wrap_last - (journal)->j_first); \
240 static int fc_do_one_pass(journal_t *journal, in fc_do_one_pass() argument
248 next_fc_block = journal->j_fc_first; in fc_do_one_pass()
249 if (!journal->j_fc_replay_callback) in fc_do_one_pass()
252 while (next_fc_block <= journal->j_fc_last) { in fc_do_one_pass()
255 err = jread(&bh, journal, next_fc_block); in fc_do_one_pass()
261 err = journal->j_fc_replay_callback(journal, bh, pass, in fc_do_one_pass()
262 next_fc_block - journal->j_fc_first, in fc_do_one_pass()
289 int jbd2_journal_recover(journal_t *journal) in jbd2_journal_recover() argument
297 sb = journal->j_superblock; in jbd2_journal_recover()
308 journal->j_transaction_sequence = be32_to_cpu(sb->s_sequence) + 1; in jbd2_journal_recover()
312 err = do_one_pass(journal, &info, PASS_SCAN); in jbd2_journal_recover()
314 err = do_one_pass(journal, &info, PASS_REVOKE); in jbd2_journal_recover()
316 err = do_one_pass(journal, &info, PASS_REPLAY); in jbd2_journal_recover()
326 journal->j_transaction_sequence = ++info.end_transaction; in jbd2_journal_recover()
328 jbd2_journal_clear_revoke(journal); in jbd2_journal_recover()
329 err2 = sync_blockdev(journal->j_fs_dev); in jbd2_journal_recover()
333 if (journal->j_flags & JBD2_BARRIER) { in jbd2_journal_recover()
334 err2 = blkdev_issue_flush(journal->j_fs_dev); in jbd2_journal_recover()
354 int jbd2_journal_skip_recovery(journal_t *journal) in jbd2_journal_skip_recovery() argument
362 err = do_one_pass(journal, &info, PASS_SCAN); in jbd2_journal_skip_recovery()
366 ++journal->j_transaction_sequence; in jbd2_journal_skip_recovery()
370 be32_to_cpu(journal->j_superblock->s_sequence); in jbd2_journal_skip_recovery()
375 journal->j_transaction_sequence = ++info.end_transaction; in jbd2_journal_skip_recovery()
378 journal->j_tail = 0; in jbd2_journal_skip_recovery()
382 static inline unsigned long long read_tag_block(journal_t *journal, in read_tag_block() argument
386 if (jbd2_has_feature_64bit(journal)) in read_tag_block()
395 static int calc_chksums(journal_t *journal, struct buffer_head *bh, in calc_chksums() argument
402 num_blks = count_tags(journal, bh); in calc_chksums()
408 wrap(journal, *next_log_block); in calc_chksums()
409 err = jread(&obh, journal, io_block); in calc_chksums()
461 static int do_one_pass(journal_t *journal, in do_one_pass() argument
472 int tag_bytes = journal_tag_bytes(journal); in do_one_pass()
485 sb = journal->j_superblock; in do_one_pass()
521 jbd2_has_feature_fast_commit(journal) ? in do_one_pass()
522 journal->j_fc_last : journal->j_last); in do_one_pass()
529 err = jread(&bh, journal, next_log_block); in do_one_pass()
534 wrap(journal, next_log_block); in do_one_pass()
566 if (jbd2_journal_has_csum_v2or3(journal)) in do_one_pass()
570 !jbd2_descriptor_block_csum_verify(journal, in do_one_pass()
595 jbd2_has_feature_checksum(journal) && in do_one_pass()
598 if (calc_chksums(journal, bh, in do_one_pass()
607 next_log_block += count_tags(journal, bh); in do_one_pass()
608 wrap(journal, next_log_block); in do_one_pass()
619 <= journal->j_blocksize - descr_csum_size) { in do_one_pass()
626 wrap(journal, next_log_block); in do_one_pass()
627 err = jread(&obh, journal, io_block); in do_one_pass()
640 blocknr = read_tag_block(journal, in do_one_pass()
647 (journal, blocknr, in do_one_pass()
656 journal, &tag, (journal_block_tag3_t *)tagp, in do_one_pass()
670 nbh = __getblk(journal->j_fs_dev, in do_one_pass()
672 journal->j_blocksize); in do_one_pass()
685 journal->j_blocksize); in do_one_pass()
779 jbd2_has_feature_checksum(journal)) { in do_one_pass()
786 journal->j_failed_commit = in do_one_pass()
806 !jbd2_commit_block_csum_verify(journal, in do_one_pass()
813 if (!jbd2_has_feature_async_commit(journal)) { in do_one_pass()
814 journal->j_failed_commit = in do_one_pass()
832 !jbd2_descriptor_block_csum_verify(journal, in do_one_pass()
845 err = scan_revoke_records(journal, bh, in do_one_pass()
883 if (jbd2_has_feature_fast_commit(journal) && pass != PASS_REVOKE) { in do_one_pass()
884 err = fc_do_one_pass(journal, info, pass); in do_one_pass()
899 static int scan_revoke_records(journal_t *journal, struct buffer_head *bh, in scan_revoke_records() argument
912 if (jbd2_journal_has_csum_v2or3(journal)) in scan_revoke_records()
914 if (rcount > journal->j_blocksize - csum_size) in scan_revoke_records()
918 if (jbd2_has_feature_64bit(journal)) in scan_revoke_records()
930 err = jbd2_journal_set_revoke(journal, blocknr, sequence); in scan_revoke_records()