Lines Matching refs:journal
102 int journal_bmap(journal_t *journal, blk64_t block, unsigned long long *phys) in journal_bmap() argument
108 struct inode *inode = journal->j_inode; in journal_bmap()
299 journal_t *journal = NULL; in ext2fs_get_journal() local
306 retval = ext2fs_get_memzero(sizeof(journal_t), &journal); in ext2fs_get_journal()
319 journal->j_dev = dev_journal; in ext2fs_get_journal()
320 journal->j_fs_dev = dev_fs; in ext2fs_get_journal()
321 journal->j_inode = NULL; in ext2fs_get_journal()
322 journal->j_blocksize = fs->blocksize; in ext2fs_get_journal()
357 if (EXT2_I_SIZE(&j_inode->i_ext2) / journal->j_blocksize < in ext2fs_get_journal()
378 journal->j_maxlen = EXT2_I_SIZE(&j_inode->i_ext2) / in ext2fs_get_journal()
379 journal->j_blocksize; in ext2fs_get_journal()
390 journal->j_inode = j_inode; in ext2fs_get_journal()
392 retval = (errcode_t)journal_bmap(journal, 0, &start); in ext2fs_get_journal()
493 journal->j_maxlen = (maxlen < 1ULL << 32) ? maxlen : in ext2fs_get_journal()
498 bh = getblk(dev_journal, start, journal->j_blocksize); in ext2fs_get_journal()
504 journal->j_sb_buffer = bh; in ext2fs_get_journal()
505 journal->j_superblock = (journal_superblock_t *)bh->b_data; in ext2fs_get_journal()
512 *ret_journal = journal; in ext2fs_get_journal()
520 if (journal) in ext2fs_get_journal()
521 ext2fs_free_mem(&journal); in ext2fs_get_journal()
541 static void clear_v2_journal_fields(journal_t *journal) in clear_v2_journal_fields() argument
543 ext2_filsys fs = journal->j_dev->k_fs; in clear_v2_journal_fields()
545 memset(((char *) journal->j_superblock) + V1_SB_SIZE, 0, in clear_v2_journal_fields()
547 mark_buffer_dirty(journal->j_sb_buffer); in clear_v2_journal_fields()
551 static errcode_t ext2fs_journal_load(journal_t *journal) in ext2fs_journal_load() argument
553 ext2_filsys fs = journal->j_dev->k_fs; in ext2fs_journal_load()
555 struct buffer_head *jbh = journal->j_sb_buffer; in ext2fs_journal_load()
561 jsb = journal->j_superblock; in ext2fs_journal_load()
568 journal->j_format_version = 1; in ext2fs_journal_load()
573 clear_v2_journal_fields(journal); in ext2fs_journal_load()
577 journal->j_format_version = 2; in ext2fs_journal_load()
580 clear_v2_journal_fields(journal); in ext2fs_journal_load()
601 if (JFS_HAS_INCOMPAT_FEATURE(journal, ~JFS_KNOWN_INCOMPAT_FEATURES)) in ext2fs_journal_load()
604 if (JFS_HAS_RO_COMPAT_FEATURE(journal, ~JFS_KNOWN_ROCOMPAT_FEATURES)) in ext2fs_journal_load()
608 if (jfs_has_feature_csum2(journal) && jfs_has_feature_csum3(journal)) in ext2fs_journal_load()
611 if (journal_has_csum_v2or3(journal) && in ext2fs_journal_load()
612 jfs_has_feature_checksum(journal)) in ext2fs_journal_load()
615 if (!ext2fs_journal_verify_csum_type(journal, jsb) || in ext2fs_journal_load()
616 !ext2fs_journal_sb_csum_verify(journal, jsb)) in ext2fs_journal_load()
619 if (journal_has_csum_v2or3(journal)) in ext2fs_journal_load()
620 journal->j_csum_seed = jbd2_chksum(journal, ~0, jsb->s_uuid, in ext2fs_journal_load()
626 if (jsb->s_blocksize != htonl(journal->j_blocksize)) in ext2fs_journal_load()
629 if (ntohl(jsb->s_maxlen) < journal->j_maxlen) in ext2fs_journal_load()
630 journal->j_maxlen = ntohl(jsb->s_maxlen); in ext2fs_journal_load()
631 else if (ntohl(jsb->s_maxlen) > journal->j_maxlen) in ext2fs_journal_load()
634 journal->j_tail_sequence = ntohl(jsb->s_sequence); in ext2fs_journal_load()
635 journal->j_transaction_sequence = journal->j_tail_sequence; in ext2fs_journal_load()
636 journal->j_tail = ntohl(jsb->s_start); in ext2fs_journal_load()
637 journal->j_first = ntohl(jsb->s_first); in ext2fs_journal_load()
638 journal->j_last = ntohl(jsb->s_maxlen); in ext2fs_journal_load()
643 static void ext2fs_journal_release(ext2_filsys fs, journal_t *journal, in ext2fs_journal_release() argument
649 mark_buffer_clean(journal->j_sb_buffer); in ext2fs_journal_release()
651 jsb = journal->j_superblock; in ext2fs_journal_release()
652 jsb->s_sequence = htonl(journal->j_tail_sequence); in ext2fs_journal_release()
655 ext2fs_journal_sb_csum_set(journal, jsb); in ext2fs_journal_release()
656 mark_buffer_dirty(journal->j_sb_buffer); in ext2fs_journal_release()
658 brelse(journal->j_sb_buffer); in ext2fs_journal_release()
669 if (journal->j_inode) in ext2fs_journal_release()
670 ext2fs_free_mem(&journal->j_inode); in ext2fs_journal_release()
672 if (journal->j_fs_dev) in ext2fs_journal_release()
673 ext2fs_free_mem(&journal->j_fs_dev); in ext2fs_journal_release()
674 ext2fs_free_mem(&journal); in ext2fs_journal_release()
684 journal_t *journal; in ext2fs_check_ext3_journal() local
694 retval = ext2fs_get_journal(fs, &journal); in ext2fs_check_ext3_journal()
698 retval = ext2fs_journal_load(journal); in ext2fs_check_ext3_journal()
714 journal->j_superblock->s_start != 0) { in ext2fs_check_ext3_journal()
725 journal->j_superblock->s_errno) { in ext2fs_check_ext3_journal()
728 journal->j_superblock->s_errno = 0; in ext2fs_check_ext3_journal()
729 ext2fs_journal_sb_csum_set(journal, journal->j_superblock); in ext2fs_check_ext3_journal()
730 mark_buffer_dirty(journal->j_sb_buffer); in ext2fs_check_ext3_journal()
734 ext2fs_journal_release(fs, journal, 0, retval ? 1 : 0); in ext2fs_check_ext3_journal()
740 journal_t *journal; in recover_ext3_journal() local
744 retval = ext2fs_get_journal(fs, &journal); in recover_ext3_journal()
748 retval = ext2fs_journal_load(journal); in recover_ext3_journal()
752 retval = journal_init_revoke(journal, 1024); in recover_ext3_journal()
756 retval = -journal_recover(journal); in recover_ext3_journal()
760 if (journal->j_failed_commit) { in recover_ext3_journal()
761 journal->j_superblock->s_errno = -EINVAL; in recover_ext3_journal()
762 mark_buffer_dirty(journal->j_sb_buffer); in recover_ext3_journal()
766 journal_destroy_revoke(journal); in recover_ext3_journal()
768 ext2fs_journal_release(fs, journal, 1, 0); in recover_ext3_journal()
830 journal_t *journal; in ext2fs_open_journal() local
834 retval = ext2fs_get_journal(fs, &journal); in ext2fs_open_journal()
838 retval = ext2fs_journal_load(journal); in ext2fs_open_journal()
842 retval = journal_init_revoke(journal, 1024); in ext2fs_open_journal()
846 if (journal->j_failed_commit) { in ext2fs_open_journal()
847 journal->j_superblock->s_errno = -EINVAL; in ext2fs_open_journal()
848 mark_buffer_dirty(journal->j_sb_buffer); in ext2fs_open_journal()
851 *j = journal; in ext2fs_open_journal()
855 journal_destroy_revoke(journal); in ext2fs_open_journal()
857 ext2fs_journal_release(fs, journal, 1, 0); in ext2fs_open_journal()
863 journal_t *journal = *j; in ext2fs_close_journal() local
865 journal_destroy_revoke(journal); in ext2fs_close_journal()
867 ext2fs_journal_release(fs, journal, 0, 0); in ext2fs_close_journal()