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()
158 do_readahead(journal, offset); in jread()
196 static int count_tags(journal_t *journal, struct buffer_head *bh) in count_tags() argument
200 int nr = 0, size = journal->j_blocksize; in count_tags()
201 int tag_bytes = journal_tag_bytes(journal); in count_tags()
203 if (jbd2_journal_has_csum_v2or3(journal)) in count_tags()
225 #define wrap(journal, var) \ argument
227 if (var >= (journal)->j_last) \
228 var -= ((journal)->j_last - (journal)->j_first); \
231 static int fc_do_one_pass(journal_t *journal, in fc_do_one_pass() argument
239 next_fc_block = journal->j_fc_first; in fc_do_one_pass()
240 if (!journal->j_fc_replay_callback) in fc_do_one_pass()
243 while (next_fc_block <= journal->j_fc_last) { in fc_do_one_pass()
246 err = jread(&bh, journal, next_fc_block); in fc_do_one_pass()
252 err = journal->j_fc_replay_callback(journal, bh, pass, in fc_do_one_pass()
253 next_fc_block - journal->j_fc_first, in fc_do_one_pass()
280 int jbd2_journal_recover(journal_t *journal) in jbd2_journal_recover() argument
290 sb = journal->j_superblock; in jbd2_journal_recover()
301 journal->j_transaction_sequence = be32_to_cpu(sb->s_sequence) + 1; in jbd2_journal_recover()
306 mapping = journal->j_fs_dev->bd_inode->i_mapping; in jbd2_journal_recover()
308 err = do_one_pass(journal, &info, PASS_SCAN); in jbd2_journal_recover()
310 err = do_one_pass(journal, &info, PASS_REVOKE); in jbd2_journal_recover()
312 err = do_one_pass(journal, &info, PASS_REPLAY); in jbd2_journal_recover()
322 journal->j_transaction_sequence = ++info.end_transaction; in jbd2_journal_recover()
324 jbd2_journal_clear_revoke(journal); in jbd2_journal_recover()
325 err2 = sync_blockdev(journal->j_fs_dev); in jbd2_journal_recover()
332 if (journal->j_flags & JBD2_BARRIER) { in jbd2_journal_recover()
333 err2 = blkdev_issue_flush(journal->j_fs_dev); in jbd2_journal_recover()
353 int jbd2_journal_skip_recovery(journal_t *journal) in jbd2_journal_skip_recovery() argument
361 err = do_one_pass(journal, &info, PASS_SCAN); in jbd2_journal_skip_recovery()
365 ++journal->j_transaction_sequence; in jbd2_journal_skip_recovery()
369 be32_to_cpu(journal->j_superblock->s_sequence); in jbd2_journal_skip_recovery()
374 journal->j_transaction_sequence = ++info.end_transaction; in jbd2_journal_skip_recovery()
377 journal->j_tail = 0; in jbd2_journal_skip_recovery()
381 static inline unsigned long long read_tag_block(journal_t *journal, in read_tag_block() argument
385 if (jbd2_has_feature_64bit(journal)) in read_tag_block()
394 static int calc_chksums(journal_t *journal, struct buffer_head *bh, in calc_chksums() argument
401 num_blks = count_tags(journal, bh); in calc_chksums()
407 wrap(journal, *next_log_block); in calc_chksums()
408 err = jread(&obh, journal, io_block); in calc_chksums()
460 static int do_one_pass(journal_t *journal, in do_one_pass() argument
471 int tag_bytes = journal_tag_bytes(journal); in do_one_pass()
484 sb = journal->j_superblock; in do_one_pass()
519 next_commit_ID, next_log_block, journal->j_last); in do_one_pass()
526 err = jread(&bh, journal, next_log_block); in do_one_pass()
531 wrap(journal, next_log_block); in do_one_pass()
563 if (jbd2_journal_has_csum_v2or3(journal)) in do_one_pass()
567 !jbd2_descriptor_block_csum_verify(journal, in do_one_pass()
592 jbd2_has_feature_checksum(journal) && in do_one_pass()
595 if (calc_chksums(journal, bh, in do_one_pass()
604 next_log_block += count_tags(journal, bh); in do_one_pass()
605 wrap(journal, next_log_block); in do_one_pass()
616 <= journal->j_blocksize - descr_csum_size) { in do_one_pass()
623 wrap(journal, next_log_block); in do_one_pass()
624 err = jread(&obh, journal, io_block); in do_one_pass()
637 blocknr = read_tag_block(journal, in do_one_pass()
644 (journal, blocknr, in do_one_pass()
653 journal, &tag, (journal_block_tag3_t *)tagp, in do_one_pass()
667 nbh = __getblk(journal->j_fs_dev, in do_one_pass()
669 journal->j_blocksize); in do_one_pass()
682 journal->j_blocksize); in do_one_pass()
777 jbd2_has_feature_checksum(journal)) { in do_one_pass()
784 journal->j_failed_commit = in do_one_pass()
804 !jbd2_commit_block_csum_verify(journal, in do_one_pass()
811 if (!jbd2_has_feature_async_commit(journal)) { in do_one_pass()
812 journal->j_failed_commit = in do_one_pass()
830 !jbd2_descriptor_block_csum_verify(journal, in do_one_pass()
843 err = scan_revoke_records(journal, bh, in do_one_pass()
881 if (jbd2_has_feature_fast_commit(journal) && pass != PASS_REVOKE) { in do_one_pass()
882 err = fc_do_one_pass(journal, info, pass); in do_one_pass()
897 static int scan_revoke_records(journal_t *journal, struct buffer_head *bh, in scan_revoke_records() argument
910 if (jbd2_journal_has_csum_v2or3(journal)) in scan_revoke_records()
912 if (rcount > journal->j_blocksize - csum_size) in scan_revoke_records()
916 if (jbd2_has_feature_64bit(journal)) in scan_revoke_records()
928 err = jbd2_journal_set_revoke(journal, blocknr, sequence); in scan_revoke_records()