Lines Matching refs:journal

48 	journal_t *journal;  member
82 bh = getblk(trans->journal->j_dev, 0, trans->journal->j_blocksize); in journal_commit_trans()
91 if (jfs_has_feature_checksum(trans->journal)) { in journal_commit_trans()
95 cbh = getblk(trans->journal->j_dev, 0, in journal_commit_trans()
96 trans->journal->j_blocksize); in journal_commit_trans()
103 err = journal_bmap(trans->journal, cblk, in journal_commit_trans()
135 jbd2_commit_block_csum_set(trans->journal, bh); in journal_commit_trans()
136 err = journal_bmap(trans->journal, trans->block, &bh->b_blocknr); in journal_commit_trans()
183 if (journal_has_csum_v2or3(trans->journal)) in journal_add_revoke_to_trans()
188 bh = getblk(trans->journal->j_dev, curr_blk, in journal_add_revoke_to_trans()
189 trans->journal->j_blocksize); in journal_add_revoke_to_trans()
198 if (jfs_has_feature_64bit(trans->journal)) in journal_add_revoke_to_trans()
205 if (offset + sz > trans->journal->j_blocksize - csum_size) { in journal_add_revoke_to_trans()
207 jbd2_revoke_csum_set(trans->journal, bh); in journal_add_revoke_to_trans()
209 err = journal_bmap(trans->journal, curr_blk, in journal_add_revoke_to_trans()
226 ext2fs_blocks_count(trans->journal->j_fs_dev->k_fs->super)) { in journal_add_revoke_to_trans()
231 if (jfs_has_feature_64bit(trans->journal)) in journal_add_revoke_to_trans()
242 jbd2_revoke_csum_set(trans->journal, bh); in journal_add_revoke_to_trans()
244 err = journal_bmap(trans->journal, curr_blk, &bh->b_blocknr); in journal_add_revoke_to_trans()
287 if (journal_has_csum_v2or3(trans->journal)) in journal_add_blocks_to_trans()
292 data_bh = getblk(trans->journal->j_dev, curr_blk, in journal_add_blocks_to_trans()
293 trans->journal->j_blocksize); in journal_add_blocks_to_trans()
299 bh = getblk(trans->journal->j_dev, curr_blk, in journal_add_blocks_to_trans()
300 trans->journal->j_blocksize); in journal_add_blocks_to_trans()
313 j = fread(data_bh->b_data, trans->journal->j_blocksize, 1, fp); in journal_add_blocks_to_trans()
319 tag_bytes = journal_tag_bytes(trans->journal); in journal_add_blocks_to_trans()
323 (char *)jdb_buf + trans->journal->j_blocksize - csum_size) { in journal_add_blocks_to_trans()
324 jbd2_descr_block_csum_set(trans->journal, bh); in journal_add_blocks_to_trans()
325 err = journal_bmap(trans->journal, jdb_blk, in journal_add_blocks_to_trans()
343 ext2fs_blocks_count(trans->journal->j_fs_dev->k_fs->super)) { in journal_add_blocks_to_trans()
355 trans->journal->j_superblock->s_uuid, in journal_add_blocks_to_trans()
356 sizeof(trans->journal->j_superblock->s_uuid)); in journal_add_blocks_to_trans()
365 if (jfs_has_feature_64bit(trans->journal)) in journal_add_blocks_to_trans()
367 jbd2_block_tag_csum_set(trans->journal, jdbt, data_bh, in journal_add_blocks_to_trans()
371 err = journal_bmap(trans->journal, curr_blk, in journal_add_blocks_to_trans()
390 jbd2_descr_block_csum_set(trans->journal, bh); in journal_add_blocks_to_trans()
391 err = journal_bmap(trans->journal, jdb_blk, &bh->b_blocknr); in journal_add_blocks_to_trans()
411 static blk64_t journal_guess_blocks(journal_t *journal, blk64_t data_blocks, in journal_guess_blocks() argument
418 bs = journal->j_blocksize; in journal_guess_blocks()
419 if (journal_has_csum_v2or3(journal)) in journal_guess_blocks()
421 sz = jfs_has_feature_64bit(journal) ? sizeof(__u64) : sizeof(__u32); in journal_guess_blocks()
425 bs = journal->j_blocksize - 16; in journal_guess_blocks()
426 if (journal_has_csum_v2or3(journal)) in journal_guess_blocks()
428 sz = journal_tag_bytes(journal); in journal_guess_blocks()
436 static errcode_t journal_open_trans(journal_t *journal, in journal_open_trans() argument
440 trans->fs = journal->j_fs_dev->k_fs; in journal_open_trans()
441 trans->journal = journal; in journal_open_trans()
444 if (journal->j_tail == 0) { in journal_open_trans()
446 trans->tid = journal->j_tail_sequence; in journal_open_trans()
447 trans->start = journal->j_first; in journal_open_trans()
450 trans->tid = journal->j_transaction_sequence; in journal_open_trans()
451 trans->start = journal->j_head; in journal_open_trans()
455 if (trans->start + blocks > journal->j_last) in journal_open_trans()
466 journal_t *journal; in journal_close_trans() local
473 journal = trans->journal; in journal_close_trans()
474 if (journal->j_tail == 0) { in journal_close_trans()
476 journal->j_tail_sequence = trans->tid; in journal_close_trans()
477 journal->j_tail = trans->start; in journal_close_trans()
478 journal->j_superblock->s_start = ext2fs_cpu_to_be32(trans->start); in journal_close_trans()
482 journal->j_head = trans->end + 1; in journal_close_trans()
483 journal->j_transaction_sequence = trans->tid + 1; in journal_close_trans()
497 static errcode_t journal_write(journal_t *journal, in journal_write() argument
507 jfs_set_feature_revoke(journal); in journal_write()
508 mark_buffer_dirty(journal->j_sb_buffer); in journal_write()
511 blocks = journal_guess_blocks(journal, block_len, revoke_len); in journal_write()
512 err = journal_open_trans(journal, &trans, blocks); in journal_write()
610 #define wrap(journal, var) \ argument
612 if (var >= (journal)->j_last) \
613 var -= ((journal)->j_last - (journal)->j_first); \
620 static int count_tags(journal_t *journal, char *buf) in count_tags() argument
624 int nr = 0, size = journal->j_blocksize; in count_tags()
625 int tag_bytes = journal_tag_bytes(journal); in count_tags()
627 if (journal_has_csum_v2or3(journal)) in count_tags()
647 static errcode_t journal_find_head(journal_t *journal) in journal_find_head() argument
664 sb = journal->j_superblock; in journal_find_head()
672 bh = getblk(journal->j_dev, 0, journal->j_blocksize); in journal_find_head()
685 journal->j_last); in journal_find_head()
690 err = journal_bmap(journal, next_log_block, &bh->b_blocknr); in journal_find_head()
700 wrap(journal, next_log_block); in journal_find_head()
732 next_log_block += count_tags(journal, bh->b_data); in journal_find_head()
733 wrap(journal, next_log_block); in journal_find_head()
756 journal->j_transaction_sequence = next_commit_ID; in journal_find_head()
757 journal->j_head = head_block; in journal_find_head()
763 static void update_journal_csum(journal_t *journal, int ver) in update_journal_csum() argument
767 if (journal->j_format_version < 2) in update_journal_csum()
770 if (journal->j_tail != 0 || in update_journal_csum()
772 journal->j_fs_dev->k_fs->super)) { in update_journal_csum()
778 jsb = journal->j_superblock; in update_journal_csum()
779 if (ext2fs_has_feature_metadata_csum(journal->j_fs_dev->k_fs->super)) { in update_journal_csum()
783 jfs_clear_feature_csum3(journal); in update_journal_csum()
784 jfs_set_feature_csum2(journal); in update_journal_csum()
785 jfs_clear_feature_checksum(journal); in update_journal_csum()
788 jfs_set_feature_csum3(journal); in update_journal_csum()
789 jfs_clear_feature_csum2(journal); in update_journal_csum()
790 jfs_clear_feature_checksum(journal); in update_journal_csum()
796 journal->j_superblock->s_checksum_type = JBD2_CRC32C_CHKSUM; in update_journal_csum()
797 journal->j_csum_seed = jbd2_chksum(journal, ~0, jsb->s_uuid, in update_journal_csum()
800 jfs_clear_feature_csum3(journal); in update_journal_csum()
801 jfs_clear_feature_csum2(journal); in update_journal_csum()
802 jfs_set_feature_checksum(journal); in update_journal_csum()
806 static void update_uuid(journal_t *journal) in update_uuid() argument
811 if (journal->j_format_version < 2) in update_uuid()
814 for (z = 0; z < sizeof(journal->j_superblock->s_uuid); z++) in update_uuid()
815 if (journal->j_superblock->s_uuid[z]) in update_uuid()
820 fs = journal->j_fs_dev->k_fs; in update_uuid()
824 if (jfs_has_feature_64bit(journal) && in update_uuid()
828 if (journal->j_tail != 0 || in update_uuid()
834 memcpy(journal->j_superblock->s_uuid, fs->super->s_uuid, in update_uuid()
838 static void update_64bit_flag(journal_t *journal) in update_64bit_flag() argument
840 if (journal->j_format_version < 2) in update_64bit_flag()
843 if (!ext2fs_has_feature_64bit(journal->j_fs_dev->k_fs->super)) in update_64bit_flag()
846 if (jfs_has_feature_64bit(journal) && in update_64bit_flag()
847 ext2fs_has_feature_64bit(journal->j_fs_dev->k_fs->super)) in update_64bit_flag()
850 if (journal->j_tail != 0 || in update_64bit_flag()
852 journal->j_fs_dev->k_fs->super)) { in update_64bit_flag()
857 jfs_set_feature_64bit(journal); in update_64bit_flag()
864 journal_t *journal; in do_journal_open() local
913 journal = current_journal; in do_journal_open()
916 "maxlen=%lu\n", journal->j_tail_sequence, in do_journal_open()
917 journal->j_transaction_sequence, journal->j_tail, in do_journal_open()
918 journal->j_first, journal->j_last); in do_journal_open()
920 update_uuid(journal); in do_journal_open()
921 update_64bit_flag(journal); in do_journal_open()
923 update_journal_csum(journal, csum_ver); in do_journal_open()
925 err = journal_find_head(journal); in do_journal_open()