Lines Matching refs:journal

40 static int do_one_pass(journal_t *journal,
68 static int do_readahead(journal_t *journal, unsigned int start) in do_readahead() argument
78 max = start + (128 * 1024 / journal->j_blocksize); in do_readahead()
79 if (max > journal->j_total_len) in do_readahead()
80 max = journal->j_total_len; in do_readahead()
88 err = jbd2_journal_bmap(journal, next, &blocknr); in do_readahead()
96 bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize); in do_readahead()
130 static int jread(struct buffer_head **bhp, journal_t *journal, in jread() argument
139 if (offset >= journal->j_total_len) { in jread()
144 err = jbd2_journal_bmap(journal, offset, &blocknr); in jread()
152 bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize); in jread()
165 do_readahead(journal, offset); in jread()
203 static int count_tags(journal_t *journal, struct buffer_head *bh) in count_tags() argument
207 int nr = 0, size = journal->j_blocksize; in count_tags()
208 int tag_bytes = journal_tag_bytes(journal); in count_tags()
210 if (jbd2_journal_has_csum_v2or3(journal)) in count_tags()
232 #define wrap(journal, var) \ argument
234 if (var >= (journal)->j_last) \
235 var -= ((journal)->j_last - (journal)->j_first); \
238 static int fc_do_one_pass(journal_t *journal, in fc_do_one_pass() argument
246 next_fc_block = journal->j_fc_first; in fc_do_one_pass()
247 if (!journal->j_fc_replay_callback) in fc_do_one_pass()
250 while (next_fc_block <= journal->j_fc_last) { in fc_do_one_pass()
253 err = jread(&bh, journal, next_fc_block); in fc_do_one_pass()
259 err = journal->j_fc_replay_callback(journal, bh, pass, in fc_do_one_pass()
260 next_fc_block - journal->j_fc_first, in fc_do_one_pass()
287 int jbd2_journal_recover(journal_t *journal) in jbd2_journal_recover() argument
295 sb = journal->j_superblock; in jbd2_journal_recover()
305 journal->j_transaction_sequence = be32_to_cpu(sb->s_sequence) + 1; in jbd2_journal_recover()
306 journal->j_head = be32_to_cpu(sb->s_head); in jbd2_journal_recover()
310 err = do_one_pass(journal, &info, PASS_SCAN); in jbd2_journal_recover()
312 err = do_one_pass(journal, &info, PASS_REVOKE); in jbd2_journal_recover()
314 err = do_one_pass(journal, &info, PASS_REPLAY); in jbd2_journal_recover()
324 journal->j_transaction_sequence = ++info.end_transaction; in jbd2_journal_recover()
325 journal->j_head = info.head_block; in jbd2_journal_recover()
327 journal->j_transaction_sequence, journal->j_head); in jbd2_journal_recover()
329 jbd2_journal_clear_revoke(journal); in jbd2_journal_recover()
330 err2 = sync_blockdev(journal->j_fs_dev); in jbd2_journal_recover()
333 err2 = jbd2_check_fs_dev_write_error(journal); in jbd2_journal_recover()
337 if (journal->j_flags & JBD2_BARRIER) { in jbd2_journal_recover()
338 err2 = blkdev_issue_flush(journal->j_fs_dev); in jbd2_journal_recover()
358 int jbd2_journal_skip_recovery(journal_t *journal) in jbd2_journal_skip_recovery() argument
366 err = do_one_pass(journal, &info, PASS_SCAN); in jbd2_journal_skip_recovery()
370 ++journal->j_transaction_sequence; in jbd2_journal_skip_recovery()
371 journal->j_head = journal->j_first; in jbd2_journal_skip_recovery()
375 be32_to_cpu(journal->j_superblock->s_sequence); in jbd2_journal_skip_recovery()
380 journal->j_transaction_sequence = ++info.end_transaction; in jbd2_journal_skip_recovery()
381 journal->j_head = info.head_block; in jbd2_journal_skip_recovery()
384 journal->j_tail = 0; in jbd2_journal_skip_recovery()
388 static inline unsigned long long read_tag_block(journal_t *journal, in read_tag_block() argument
392 if (jbd2_has_feature_64bit(journal)) in read_tag_block()
401 static int calc_chksums(journal_t *journal, struct buffer_head *bh, in calc_chksums() argument
408 num_blks = count_tags(journal, bh); in calc_chksums()
414 wrap(journal, *next_log_block); in calc_chksums()
415 err = jread(&obh, journal, io_block); in calc_chksums()
488 static int do_one_pass(journal_t *journal, in do_one_pass() argument
499 int tag_bytes = journal_tag_bytes(journal); in do_one_pass()
512 sb = journal->j_superblock; in do_one_pass()
548 next_commit_ID, next_log_block, journal->j_last); in do_one_pass()
555 err = jread(&bh, journal, next_log_block); in do_one_pass()
560 wrap(journal, next_log_block); in do_one_pass()
592 if (jbd2_journal_has_csum_v2or3(journal)) in do_one_pass()
596 !jbd2_descriptor_block_csum_verify(journal, in do_one_pass()
621 jbd2_has_feature_checksum(journal) && in do_one_pass()
624 if (calc_chksums(journal, bh, in do_one_pass()
633 next_log_block += count_tags(journal, bh); in do_one_pass()
634 wrap(journal, next_log_block); in do_one_pass()
645 <= journal->j_blocksize - descr_csum_size) { in do_one_pass()
652 wrap(journal, next_log_block); in do_one_pass()
653 err = jread(&obh, journal, io_block); in do_one_pass()
666 blocknr = read_tag_block(journal, in do_one_pass()
673 (journal, blocknr, in do_one_pass()
682 journal, &tag, (journal_block_tag3_t *)tagp, in do_one_pass()
697 nbh = __getblk(journal->j_fs_dev, in do_one_pass()
699 journal->j_blocksize); in do_one_pass()
712 journal->j_blocksize); in do_one_pass()
806 jbd2_has_feature_checksum(journal)) { in do_one_pass()
813 journal->j_failed_commit = in do_one_pass()
833 !jbd2_commit_block_csum_verify(journal, in do_one_pass()
836 journal, in do_one_pass()
848 if (!jbd2_has_feature_async_commit(journal)) { in do_one_pass()
849 journal->j_failed_commit = in do_one_pass()
870 !jbd2_descriptor_block_csum_verify(journal, in do_one_pass()
884 err = scan_revoke_records(journal, bh, in do_one_pass()
924 if (jbd2_has_feature_fast_commit(journal) && pass != PASS_REVOKE) { in do_one_pass()
925 err = fc_do_one_pass(journal, info, pass); in do_one_pass()
940 static int scan_revoke_records(journal_t *journal, struct buffer_head *bh, in scan_revoke_records() argument
953 if (jbd2_journal_has_csum_v2or3(journal)) in scan_revoke_records()
955 if (rcount > journal->j_blocksize - csum_size) in scan_revoke_records()
959 if (jbd2_has_feature_64bit(journal)) in scan_revoke_records()
971 err = jbd2_journal_set_revoke(journal, blocknr, sequence); in scan_revoke_records()