Lines Matching refs:journal
97 int journal_bmap(journal_t *journal, blk64_t block, unsigned long long *phys) in journal_bmap() argument
103 struct inode *inode = journal->j_inode; in journal_bmap()
288 journal_t *journal = NULL; in e2fsck_get_journal() local
298 journal = e2fsck_allocate_memory(ctx, sizeof(journal_t), "journal"); in e2fsck_get_journal()
299 if (!journal) { in e2fsck_get_journal()
314 journal->j_dev = dev_journal; in e2fsck_get_journal()
315 journal->j_fs_dev = dev_fs; in e2fsck_get_journal()
316 journal->j_inode = NULL; in e2fsck_get_journal()
317 journal->j_blocksize = ctx->fs->blocksize; in e2fsck_get_journal()
358 if (EXT2_I_SIZE(&j_inode->i_ext2) / journal->j_blocksize < in e2fsck_get_journal()
379 journal->j_maxlen = EXT2_I_SIZE(&j_inode->i_ext2) / in e2fsck_get_journal()
380 journal->j_blocksize; in e2fsck_get_journal()
391 journal->j_inode = j_inode; in e2fsck_get_journal()
393 if ((ret = journal_bmap(journal, 0, &start)) != 0) { in e2fsck_get_journal()
503 journal->j_maxlen = (maxlen < 1ULL << 32) ? maxlen : (1ULL << 32) - 1; in e2fsck_get_journal()
507 if (!(bh = getblk(dev_journal, start, journal->j_blocksize))) { in e2fsck_get_journal()
512 journal->j_sb_buffer = bh; in e2fsck_get_journal()
513 journal->j_superblock = (journal_superblock_t *)bh->b_data; in e2fsck_get_journal()
520 *ret_journal = journal; in e2fsck_get_journal()
530 if (journal) in e2fsck_get_journal()
531 ext2fs_free_mem(&journal); in e2fsck_get_journal()
568 static void clear_v2_journal_fields(journal_t *journal) in clear_v2_journal_fields() argument
570 e2fsck_t ctx = journal->j_dev->k_ctx; in clear_v2_journal_fields()
579 memset(((char *) journal->j_superblock) + V1_SB_SIZE, 0, in clear_v2_journal_fields()
581 mark_buffer_dirty(journal->j_sb_buffer); in clear_v2_journal_fields()
585 static errcode_t e2fsck_journal_load(journal_t *journal) in e2fsck_journal_load() argument
587 e2fsck_t ctx = journal->j_dev->k_ctx; in e2fsck_journal_load()
589 struct buffer_head *jbh = journal->j_sb_buffer; in e2fsck_journal_load()
601 jsb = journal->j_superblock; in e2fsck_journal_load()
608 journal->j_format_version = 1; in e2fsck_journal_load()
613 clear_v2_journal_fields(journal); in e2fsck_journal_load()
617 journal->j_format_version = 2; in e2fsck_journal_load()
620 clear_v2_journal_fields(journal); in e2fsck_journal_load()
643 if (JFS_HAS_INCOMPAT_FEATURE(journal, ~JFS_KNOWN_INCOMPAT_FEATURES)) in e2fsck_journal_load()
646 if (JFS_HAS_RO_COMPAT_FEATURE(journal, ~JFS_KNOWN_ROCOMPAT_FEATURES)) in e2fsck_journal_load()
650 if (jfs_has_feature_csum2(journal) && jfs_has_feature_csum3(journal)) in e2fsck_journal_load()
653 if (journal_has_csum_v2or3(journal) && in e2fsck_journal_load()
654 jfs_has_feature_checksum(journal)) in e2fsck_journal_load()
657 if (!e2fsck_journal_verify_csum_type(journal, jsb) || in e2fsck_journal_load()
658 !e2fsck_journal_sb_csum_verify(journal, jsb)) in e2fsck_journal_load()
661 if (journal_has_csum_v2or3(journal)) in e2fsck_journal_load()
662 journal->j_csum_seed = jbd2_chksum(journal, ~0, jsb->s_uuid, in e2fsck_journal_load()
668 if (jsb->s_blocksize != htonl(journal->j_blocksize)) { in e2fsck_journal_load()
675 if (ntohl(jsb->s_maxlen) < journal->j_maxlen) in e2fsck_journal_load()
676 journal->j_maxlen = ntohl(jsb->s_maxlen); in e2fsck_journal_load()
677 else if (ntohl(jsb->s_maxlen) > journal->j_maxlen) { in e2fsck_journal_load()
684 journal->j_tail_sequence = ntohl(jsb->s_sequence); in e2fsck_journal_load()
685 journal->j_transaction_sequence = journal->j_tail_sequence; in e2fsck_journal_load()
686 journal->j_tail = ntohl(jsb->s_start); in e2fsck_journal_load()
687 journal->j_first = ntohl(jsb->s_first); in e2fsck_journal_load()
688 journal->j_last = ntohl(jsb->s_maxlen); in e2fsck_journal_load()
694 journal_t *journal) in e2fsck_journal_reset_super() argument
720 jsb->s_maxlen = htonl(journal->j_maxlen); in e2fsck_journal_reset_super()
732 e2fsck_journal_sb_csum_set(journal, jsb); in e2fsck_journal_reset_super()
734 mark_buffer_dirty(journal->j_sb_buffer); in e2fsck_journal_reset_super()
735 ll_rw_block(WRITE, 1, &journal->j_sb_buffer); in e2fsck_journal_reset_super()
739 journal_t *journal, in e2fsck_journal_fix_corrupt_super() argument
747 e2fsck_journal_reset_super(ctx, journal->j_superblock, in e2fsck_journal_fix_corrupt_super()
748 journal); in e2fsck_journal_fix_corrupt_super()
749 journal->j_transaction_sequence = 1; in e2fsck_journal_fix_corrupt_super()
760 static void e2fsck_journal_release(e2fsck_t ctx, journal_t *journal, in e2fsck_journal_release() argument
766 mark_buffer_clean(journal->j_sb_buffer); in e2fsck_journal_release()
768 jsb = journal->j_superblock; in e2fsck_journal_release()
769 jsb->s_sequence = htonl(journal->j_tail_sequence); in e2fsck_journal_release()
772 e2fsck_journal_sb_csum_set(journal, jsb); in e2fsck_journal_release()
773 mark_buffer_dirty(journal->j_sb_buffer); in e2fsck_journal_release()
775 brelse(journal->j_sb_buffer); in e2fsck_journal_release()
784 if (journal->j_inode) in e2fsck_journal_release()
785 ext2fs_free_mem(&journal->j_inode); in e2fsck_journal_release()
787 if (journal->j_fs_dev) in e2fsck_journal_release()
788 ext2fs_free_mem(&journal->j_fs_dev); in e2fsck_journal_release()
789 ext2fs_free_mem(&journal); in e2fsck_journal_release()
799 journal_t *journal; in e2fsck_check_ext3_journal() local
815 retval = e2fsck_get_journal(ctx, &journal); in e2fsck_check_ext3_journal()
825 retval = e2fsck_journal_load(journal); in e2fsck_check_ext3_journal()
836 retval = e2fsck_journal_fix_corrupt_super(ctx, journal, in e2fsck_check_ext3_journal()
838 e2fsck_journal_release(ctx, journal, 0, 1); in e2fsck_check_ext3_journal()
875 journal->j_superblock->s_start != 0) { in e2fsck_check_ext3_journal()
911 journal->j_superblock->s_errno) { in e2fsck_check_ext3_journal()
914 journal->j_superblock->s_errno = 0; in e2fsck_check_ext3_journal()
915 e2fsck_journal_sb_csum_set(journal, journal->j_superblock); in e2fsck_check_ext3_journal()
916 mark_buffer_dirty(journal->j_sb_buffer); in e2fsck_check_ext3_journal()
919 e2fsck_journal_release(ctx, journal, reset, 0); in e2fsck_check_ext3_journal()
926 journal_t *journal; in recover_ext3_journal() local
932 retval = e2fsck_get_journal(ctx, &journal); in recover_ext3_journal()
936 retval = e2fsck_journal_load(journal); in recover_ext3_journal()
940 retval = journal_init_revoke(journal, 1024); in recover_ext3_journal()
944 retval = -journal_recover(journal); in recover_ext3_journal()
948 if (journal->j_failed_commit) { in recover_ext3_journal()
949 pctx.ino = journal->j_failed_commit; in recover_ext3_journal()
951 journal->j_superblock->s_errno = -EINVAL; in recover_ext3_journal()
952 mark_buffer_dirty(journal->j_sb_buffer); in recover_ext3_journal()
955 journal->j_tail_sequence = journal->j_transaction_sequence; in recover_ext3_journal()
958 journal_destroy_revoke(journal); in recover_ext3_journal()
960 e2fsck_journal_release(ctx, journal, 1, 0); in recover_ext3_journal()