Whamcloud - gitweb
Rename functions, types, constants to reflect jbd2 usage
authorTheodore Ts'o <tytso@mit.edu>
Fri, 8 Nov 2019 22:17:35 +0000 (17:17 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 9 Nov 2019 06:55:14 +0000 (01:55 -0500)
We had previously stuck to using the names from ext3/jbd kernel files,
and used a script in contrib/jbd2-resync.sh to convert the kernel
files to use the ext3/jbd conventions so we could keep the files
e2fsck/recovery.c and e2fsck/revoke.c in sync with jbd2/recovery.c and
jbd2/revoke.c, respectively.

This has been getting harder and harder, so let's make a global sweep
through e2fsprogs to use the jbd2 names.  Fortunately none of the
ext3/jbd names had leaked out into publically exported header files,
so this is only an internal change.  Which looks scary, but it's
basically a search and replace, so if it compiles it's going to be
correct.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
17 files changed:
contrib/jbd2-resync.sh
debugfs/debugfs.c
debugfs/do_journal.c
debugfs/journal.c
debugfs/logdump.c
e2fsck/jfs_user.h
e2fsck/journal.c
e2fsck/recovery.c
e2fsck/revoke.c
lib/e2p/feature.c
lib/e2p/ljs.c
lib/ext2fs/jfs_compat.h
lib/ext2fs/kernel-jbd.h
lib/ext2fs/mkjournal.c
misc/dumpe2fs.c
misc/tune2fs.c
tests/j_corrupt_journal_block/expect

index 4133b63..600df8d 100755 (executable)
@@ -9,10 +9,7 @@ fi
 # Use the ext2fs_ endian conversion functions because they truncate oversized
 # inputs (e.g. passing a u32 to cpu_to_be16()) like the kernel versions and
 # unlike the libc6 versions.
-exec sed -e 's/JBD_/JFS_/g' \
-        -e 's/JBD2_/JFS_/g' \
-        -e 's/jbd2_journal_/journal_/g' \
-        -e 's/__be/__u/g' \
+exec sed -e 's/__be/__u/g' \
         -e 's/struct kmem_cache/lkmem_cache_t/g' \
         -e 's/cpu_to_be/ext2fs_cpu_to_be/g' \
         -e 's/be\([0-9][0-9]\)_to_cpu/ext2fs_be\1_to_cpu/g' \
index 15b0121..9b70145 100644 (file)
@@ -2279,9 +2279,9 @@ void do_supported_features(int argc, char *argv[],
        __u32   supp[3] = { EXT2_LIB_FEATURE_COMPAT_SUPP,
                            EXT2_LIB_FEATURE_INCOMPAT_SUPP,
                            EXT2_LIB_FEATURE_RO_COMPAT_SUPP };
-       __u32   jrnl_supp[3] = { JFS_KNOWN_COMPAT_FEATURES,
-                                JFS_KNOWN_INCOMPAT_FEATURES,
-                                JFS_KNOWN_ROCOMPAT_FEATURES };
+       __u32   jrnl_supp[3] = { JBD2_KNOWN_COMPAT_FEATURES,
+                                JBD2_KNOWN_INCOMPAT_FEATURES,
+                                JBD2_KNOWN_ROCOMPAT_FEATURES };
 
        if (argc > 1) {
                ret = find_supp_feature(supp, E2P_FS_FEATURE, argv[1]);
index 88b1606..ee6d16b 100644 (file)
@@ -85,10 +85,10 @@ static errcode_t journal_commit_trans(journal_transaction_t *trans)
 
        /* write the descriptor block header */
        commit = (struct commit_header *)bh->b_data;
-       commit->h_magic = ext2fs_cpu_to_be32(JFS_MAGIC_NUMBER);
-       commit->h_blocktype = ext2fs_cpu_to_be32(JFS_COMMIT_BLOCK);
+       commit->h_magic = ext2fs_cpu_to_be32(JBD2_MAGIC_NUMBER);
+       commit->h_blocktype = ext2fs_cpu_to_be32(JBD2_COMMIT_BLOCK);
        commit->h_sequence = ext2fs_cpu_to_be32(trans->tid);
-       if (jfs_has_feature_checksum(trans->journal)) {
+       if (jbd2_has_feature_checksum(trans->journal)) {
                __u32 csum_v1 = ~0;
                blk64_t cblk;
 
@@ -100,8 +100,8 @@ static errcode_t journal_commit_trans(journal_transaction_t *trans)
                }
 
                for (cblk = trans->start; cblk < trans->block; cblk++) {
-                       err = journal_bmap(trans->journal, cblk,
-                                          &cbh->b_blocknr);
+                       err = jbd2_journal_bmap(trans->journal, cblk,
+                                               &cbh->b_blocknr);
                        if (err)
                                goto error;
                        mark_buffer_uptodate(cbh, 0);
@@ -114,8 +114,8 @@ static errcode_t journal_commit_trans(journal_transaction_t *trans)
                                        cbh->b_size);
                }
 
-               commit->h_chksum_type = JFS_CRC32_CHKSUM;
-               commit->h_chksum_size = JFS_CRC32_CHKSUM_SIZE;
+               commit->h_chksum_type = JBD2_CRC32_CHKSUM;
+               commit->h_chksum_size = JBD2_CRC32_CHKSUM_SIZE;
                commit->h_chksum[0] = ext2fs_cpu_to_be32(csum_v1);
        } else {
                commit->h_chksum_type = 0;
@@ -133,7 +133,7 @@ static errcode_t journal_commit_trans(journal_transaction_t *trans)
 
        /* Write block */
        jbd2_commit_block_csum_set(trans->journal, bh);
-       err = journal_bmap(trans->journal, trans->block, &bh->b_blocknr);
+       err = jbd2_journal_bmap(trans->journal, trans->block, &bh->b_blocknr);
        if (err)
                goto error;
 
@@ -161,7 +161,7 @@ static errcode_t journal_add_revoke_to_trans(journal_transaction_t *trans,
                                             blk64_t *revoke_list,
                                             size_t revoke_len)
 {
-       journal_revoke_header_t *jrb;
+       jbd2_journal_revoke_header_t *jrb;
        void *buf;
        size_t i, offset;
        blk64_t curr_blk;
@@ -180,7 +180,7 @@ static errcode_t journal_add_revoke_to_trans(journal_transaction_t *trans,
                return 0;
 
        /* Do we need to leave space at the end for a checksum? */
-       if (journal_has_csum_v2or3(trans->journal))
+       if (jbd2_journal_has_csum_v2or3(trans->journal))
                csum_size = sizeof(struct journal_revoke_tail);
 
        curr_blk = trans->block;
@@ -190,12 +190,12 @@ static errcode_t journal_add_revoke_to_trans(journal_transaction_t *trans,
        if (bh == NULL)
                return ENOMEM;
        jrb = buf = bh->b_data;
-       jrb->r_header.h_magic = ext2fs_cpu_to_be32(JFS_MAGIC_NUMBER);
-       jrb->r_header.h_blocktype = ext2fs_cpu_to_be32(JFS_REVOKE_BLOCK);
+       jrb->r_header.h_magic = ext2fs_cpu_to_be32(JBD2_MAGIC_NUMBER);
+       jrb->r_header.h_blocktype = ext2fs_cpu_to_be32(JBD2_REVOKE_BLOCK);
        jrb->r_header.h_sequence = ext2fs_cpu_to_be32(trans->tid);
        offset = sizeof(*jrb);
 
-       if (jfs_has_feature_64bit(trans->journal))
+       if (jbd2_has_feature_64bit(trans->journal))
                sz = 8;
        else
                sz = 4;
@@ -206,8 +206,8 @@ static errcode_t journal_add_revoke_to_trans(journal_transaction_t *trans,
                        jrb->r_count = ext2fs_cpu_to_be32(offset);
                        jbd2_revoke_csum_set(trans->journal, bh);
 
-                       err = journal_bmap(trans->journal, curr_blk,
-                                          &bh->b_blocknr);
+                       err = jbd2_journal_bmap(trans->journal, curr_blk,
+                                               &bh->b_blocknr);
                        if (err)
                                goto error;
                        dbg_printf("Writing revoke block at %llu:%llu\n",
@@ -228,7 +228,7 @@ static errcode_t journal_add_revoke_to_trans(journal_transaction_t *trans,
                        goto error;
                }
 
-               if (jfs_has_feature_64bit(trans->journal))
+               if (jbd2_has_feature_64bit(trans->journal))
                        *((__u64 *)(&((char *)buf)[offset])) =
                                ext2fs_cpu_to_be64(revoke_list[i]);
                else
@@ -241,7 +241,8 @@ static errcode_t journal_add_revoke_to_trans(journal_transaction_t *trans,
                jrb->r_count = ext2fs_cpu_to_be32(offset);
                jbd2_revoke_csum_set(trans->journal, bh);
 
-               err = journal_bmap(trans->journal, curr_blk, &bh->b_blocknr);
+               err = jbd2_journal_bmap(trans->journal, curr_blk,
+                                       &bh->b_blocknr);
                if (err)
                        goto error;
                dbg_printf("Writing revoke block at %llu:%llu\n",
@@ -284,8 +285,8 @@ static errcode_t journal_add_blocks_to_trans(journal_transaction_t *trans,
                return 0;
 
        /* Do we need to leave space at the end for a checksum? */
-       if (journal_has_csum_v2or3(trans->journal))
-               csum_size = sizeof(struct journal_block_tail);
+       if (jbd2_journal_has_csum_v2or3(trans->journal))
+               csum_size = sizeof(struct jbd2_journal_block_tail);
 
        curr_blk = jdb_blk = trans->block;
 
@@ -303,8 +304,8 @@ static errcode_t journal_add_blocks_to_trans(journal_transaction_t *trans,
                goto error;
        }
        jdb = jdb_buf = bh->b_data;
-       jdb->h_magic = ext2fs_cpu_to_be32(JFS_MAGIC_NUMBER);
-       jdb->h_blocktype = ext2fs_cpu_to_be32(JFS_DESCRIPTOR_BLOCK);
+       jdb->h_magic = ext2fs_cpu_to_be32(JBD2_MAGIC_NUMBER);
+       jdb->h_blocktype = ext2fs_cpu_to_be32(JBD2_DESCRIPTOR_BLOCK);
        jdb->h_sequence = ext2fs_cpu_to_be32(trans->tid);
        jdbt = (journal_block_tag_t *)(jdb + 1);
 
@@ -322,7 +323,7 @@ static errcode_t journal_add_blocks_to_trans(journal_transaction_t *trans,
                if ((char *)jdbt + tag_bytes >
                    (char *)jdb_buf + trans->journal->j_blocksize - csum_size) {
                        jbd2_descr_block_csum_set(trans->journal, bh);
-                       err = journal_bmap(trans->journal, jdb_blk,
+                       err = jbd2_journal_bmap(trans->journal, jdb_blk,
                                           &bh->b_blocknr);
                        if (err)
                                goto error;
@@ -349,7 +350,7 @@ static errcode_t journal_add_blocks_to_trans(journal_transaction_t *trans,
                jdbt->t_blocknr = ext2fs_cpu_to_be32(block_list[i] & 0xFFFFFFFF);
                jdbt->t_flags = 0;
                if (jdbt != (journal_block_tag_t *)(jdb + 1))
-                       jdbt->t_flags |= ext2fs_cpu_to_be16(JFS_FLAG_SAME_UUID);
+                       jdbt->t_flags |= ext2fs_cpu_to_be16(JBD2_FLAG_SAME_UUID);
                else {
                        memcpy(jdbt + tag_bytes,
                               trans->journal->j_superblock->s_uuid,
@@ -357,19 +358,19 @@ static errcode_t journal_add_blocks_to_trans(journal_transaction_t *trans,
                        tag_bytes += 16;
                }
                if (i == block_len - 1)
-                       jdbt->t_flags |= ext2fs_cpu_to_be16(JFS_FLAG_LAST_TAG);
-               if (*((__u32 *)buf) == ext2fs_cpu_to_be32(JFS_MAGIC_NUMBER)) {
+                       jdbt->t_flags |= ext2fs_cpu_to_be16(JBD2_FLAG_LAST_TAG);
+               if (*((__u32 *)buf) == ext2fs_cpu_to_be32(JBD2_MAGIC_NUMBER)) {
                        *((__u32 *)buf) = 0;
-                       jdbt->t_flags |= ext2fs_cpu_to_be16(JFS_FLAG_ESCAPE);
+                       jdbt->t_flags |= ext2fs_cpu_to_be16(JBD2_FLAG_ESCAPE);
                }
-               if (jfs_has_feature_64bit(trans->journal))
+               if (jbd2_has_feature_64bit(trans->journal))
                        jdbt->t_blocknr_high = ext2fs_cpu_to_be32(block_list[i] >> 32);
                jbd2_block_tag_csum_set(trans->journal, jdbt, data_bh,
                                        trans->tid);
 
                /* Write the data block */
-               err = journal_bmap(trans->journal, curr_blk,
-                                  &data_bh->b_blocknr);
+               err = jbd2_journal_bmap(trans->journal, curr_blk,
+                                       &data_bh->b_blocknr);
                if (err)
                        goto error;
                dbg_printf("Writing data block %llu at %llu:%llu tag %d\n",
@@ -388,7 +389,8 @@ static errcode_t journal_add_blocks_to_trans(journal_transaction_t *trans,
        /* Write out the last descriptor block */
        if (jdbt != (journal_block_tag_t *)(jdb + 1)) {
                jbd2_descr_block_csum_set(trans->journal, bh);
-               err = journal_bmap(trans->journal, jdb_blk, &bh->b_blocknr);
+               err = jbd2_journal_bmap(trans->journal, jdb_blk,
+                                       &bh->b_blocknr);
                if (err)
                        goto error;
                dbg_printf("Writing descriptor block at %llu:%llu\n",
@@ -416,15 +418,15 @@ static blk64_t journal_guess_blocks(journal_t *journal, blk64_t data_blocks,
 
        /* Estimate # of revoke blocks */
        bs = journal->j_blocksize;
-       if (journal_has_csum_v2or3(journal))
+       if (jbd2_journal_has_csum_v2or3(journal))
                bs -= sizeof(struct journal_revoke_tail);
-       sz = jfs_has_feature_64bit(journal) ? sizeof(__u64) : sizeof(__u32);
+       sz = jbd2_has_feature_64bit(journal) ? sizeof(__u64) : sizeof(__u32);
        ret += revoke_blocks * sz / bs;
 
        /* Estimate # of data blocks */
        bs = journal->j_blocksize - 16;
-       if (journal_has_csum_v2or3(journal))
-               bs -= sizeof(struct journal_block_tail);
+       if (jbd2_journal_has_csum_v2or3(journal))
+               bs -= sizeof(struct jbd2_journal_block_tail);
        sz = journal_tag_bytes(journal);
        ret += data_blocks * sz / bs;
 
@@ -504,7 +506,7 @@ static errcode_t journal_write(journal_t *journal,
        errcode_t err;
 
        if (revoke_len > 0) {
-               jfs_set_feature_revoke(journal);
+               jbd2_set_feature_revoke(journal);
                mark_buffer_dirty(journal->j_sb_buffer);
        }
 
@@ -624,8 +626,8 @@ static int count_tags(journal_t *journal, char *buf)
        int                     nr = 0, size = journal->j_blocksize;
        int                     tag_bytes = journal_tag_bytes(journal);
 
-       if (journal_has_csum_v2or3(journal))
-               size -= sizeof(struct journal_block_tail);
+       if (jbd2_journal_has_csum_v2or3(journal))
+               size -= sizeof(struct jbd2_journal_block_tail);
 
        tagp = buf + sizeof(journal_header_t);
 
@@ -634,10 +636,10 @@ static int count_tags(journal_t *journal, char *buf)
 
                nr++;
                tagp += tag_bytes;
-               if (!(tag->t_flags & ext2fs_cpu_to_be16(JFS_FLAG_SAME_UUID)))
+               if (!(tag->t_flags & ext2fs_cpu_to_be16(JBD2_FLAG_SAME_UUID)))
                        tagp += 16;
 
-               if (tag->t_flags & ext2fs_cpu_to_be16(JFS_FLAG_LAST_TAG))
+               if (tag->t_flags & ext2fs_cpu_to_be16(JBD2_FLAG_LAST_TAG))
                        break;
        }
 
@@ -687,7 +689,8 @@ static errcode_t journal_find_head(journal_t *journal)
                /* Skip over each chunk of the transaction looking
                 * either the next descriptor block or the final commit
                 * record. */
-               err = journal_bmap(journal, next_log_block, &bh->b_blocknr);
+               err = jbd2_journal_bmap(journal, next_log_block,
+                                       &bh->b_blocknr);
                if (err)
                        goto err;
                mark_buffer_uptodate(bh, 0);
@@ -707,7 +710,7 @@ static errcode_t journal_find_head(journal_t *journal)
 
                tmp = (journal_header_t *)bh->b_data;
 
-               if (tmp->h_magic != ext2fs_cpu_to_be32(JFS_MAGIC_NUMBER)) {
+               if (tmp->h_magic != ext2fs_cpu_to_be32(JBD2_MAGIC_NUMBER)) {
                        dbg_printf("JBD2: wrong magic 0x%x\n", tmp->h_magic);
                        goto err;
                }
@@ -728,17 +731,17 @@ static errcode_t journal_find_head(journal_t *journal)
                 * to do with it?  That depends on the pass... */
 
                switch (blocktype) {
-               case JFS_DESCRIPTOR_BLOCK:
+               case JBD2_DESCRIPTOR_BLOCK:
                        next_log_block += count_tags(journal, bh->b_data);
                        wrap(journal, next_log_block);
                        continue;
 
-               case JFS_COMMIT_BLOCK:
+               case JBD2_COMMIT_BLOCK:
                        head_block = next_log_block;
                        next_commit_ID++;
                        continue;
 
-               case JFS_REVOKE_BLOCK:
+               case JBD2_REVOKE_BLOCK:
                        continue;
 
                default:
@@ -780,14 +783,14 @@ static void update_journal_csum(journal_t *journal, int ver)
                printf("Setting csum v%d\n", ver);
                switch (ver) {
                case 2:
-                       jfs_clear_feature_csum3(journal);
-                       jfs_set_feature_csum2(journal);
-                       jfs_clear_feature_checksum(journal);
+                       jbd2_clear_feature_csum3(journal);
+                       jbd2_set_feature_csum2(journal);
+                       jbd2_clear_feature_checksum(journal);
                        break;
                case 3:
-                       jfs_set_feature_csum3(journal);
-                       jfs_clear_feature_csum2(journal);
-                       jfs_clear_feature_checksum(journal);
+                       jbd2_set_feature_csum3(journal);
+                       jbd2_clear_feature_csum2(journal);
+                       jbd2_clear_feature_checksum(journal);
                        break;
                default:
                        printf("Unknown checksum v%d\n", ver);
@@ -797,9 +800,9 @@ static void update_journal_csum(journal_t *journal, int ver)
                journal->j_csum_seed = jbd2_chksum(journal, ~0, jsb->s_uuid,
                                                   sizeof(jsb->s_uuid));
        } else {
-               jfs_clear_feature_csum3(journal);
-               jfs_clear_feature_csum2(journal);
-               jfs_set_feature_checksum(journal);
+               jbd2_clear_feature_csum3(journal);
+               jbd2_clear_feature_csum2(journal);
+               jbd2_set_feature_checksum(journal);
        }
 }
 
@@ -821,7 +824,7 @@ static void update_uuid(journal_t *journal)
        if (!ext2fs_has_feature_64bit(fs->super))
                return;
 
-       if (jfs_has_feature_64bit(journal) &&
+       if (jbd2_has_feature_64bit(journal) &&
            ext2fs_has_feature_64bit(fs->super))
                return;
 
@@ -843,7 +846,7 @@ static void update_64bit_flag(journal_t *journal)
        if (!ext2fs_has_feature_64bit(journal->j_fs_dev->k_fs->super))
                return;
 
-       if (jfs_has_feature_64bit(journal) &&
+       if (jbd2_has_feature_64bit(journal) &&
            ext2fs_has_feature_64bit(journal->j_fs_dev->k_fs->super))
                return;
 
@@ -854,7 +857,7 @@ static void update_64bit_flag(journal_t *journal)
                return;
        }
 
-       jfs_set_feature_64bit(journal);
+       jbd2_set_feature_64bit(journal);
 }
 
 void do_journal_open(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
index 023399e..fd4ccf2 100644 (file)
@@ -49,7 +49,7 @@ static int bh_count = 0;
 static int ext2fs_journal_verify_csum_type(journal_t *j,
                                           journal_superblock_t *jsb)
 {
-       if (!journal_has_csum_v2or3(j))
+       if (!jbd2_journal_has_csum_v2or3(j))
                return 1;
 
        return jsb->s_checksum_type == JBD2_CRC32C_CHKSUM;
@@ -73,7 +73,7 @@ static int ext2fs_journal_sb_csum_verify(journal_t *j,
 {
        __u32 provided, calculated;
 
-       if (!journal_has_csum_v2or3(j))
+       if (!jbd2_journal_has_csum_v2or3(j))
                return 1;
 
        provided = ext2fs_be32_to_cpu(jsb->s_checksum);
@@ -87,7 +87,7 @@ static errcode_t ext2fs_journal_sb_csum_set(journal_t *j,
 {
        __u32 crc;
 
-       if (!journal_has_csum_v2or3(j))
+       if (!jbd2_journal_has_csum_v2or3(j))
                return 0;
 
        crc = ext2fs_journal_sb_csum(jsb);
@@ -99,7 +99,8 @@ static errcode_t ext2fs_journal_sb_csum_set(journal_t *j,
  * to use the recovery.c file virtually unchanged from the kernel, so we
  * don't have to do much to keep kernel and user recovery in sync.
  */
-int journal_bmap(journal_t *journal, blk64_t block, unsigned long long *phys)
+int jbd2_journal_bmap(journal_t *journal, blk64_t block,
+                     unsigned long long *phys)
 {
 #ifdef USE_INODE_IO
        *phys = block;
@@ -355,7 +356,7 @@ try_backup_journal:
                        goto try_backup_journal;
                }
                if (EXT2_I_SIZE(&j_inode->i_ext2) / journal->j_blocksize <
-                   JFS_MIN_JOURNAL_BLOCKS) {
+                   JBD2_MIN_JOURNAL_BLOCKS) {
                        retval = EXT2_ET_JOURNAL_TOO_SMALL;
                        goto try_backup_journal;
                }
@@ -389,7 +390,7 @@ try_backup_journal:
 #else
                journal->j_inode = j_inode;
                fs->journal_io = fs->io;
-               retval = (errcode_t)journal_bmap(journal, 0, &start);
+               retval = (errcode_t) jbd2_journal_bmap(journal, 0, &start);
                if (retval)
                        goto errout;
 #endif
@@ -559,12 +560,12 @@ static errcode_t ext2fs_journal_load(journal_t *journal)
                return jbh->b_err;
 
        jsb = journal->j_superblock;
-       /* If we don't even have JFS_MAGIC, we probably have a wrong inode */
-       if (jsb->s_header.h_magic != htonl(JFS_MAGIC_NUMBER))
+       /* If we don't even have JBD2_MAGIC, we probably have a wrong inode */
+       if (jsb->s_header.h_magic != htonl(JBD2_MAGIC_NUMBER))
                return ext2fs_journal_fix_bad_inode(fs);
 
        switch (ntohl(jsb->s_header.h_blocktype)) {
-       case JFS_SUPERBLOCK_V1:
+       case JBD2_SUPERBLOCK_V1:
                journal->j_format_version = 1;
                if (jsb->s_feature_compat ||
                    jsb->s_feature_incompat ||
@@ -573,7 +574,7 @@ static errcode_t ext2fs_journal_load(journal_t *journal)
                        clear_v2_journal_fields(journal);
                break;
 
-       case JFS_SUPERBLOCK_V2:
+       case JBD2_SUPERBLOCK_V2:
                journal->j_format_version = 2;
                if (ntohl(jsb->s_nr_users) > 1 &&
                    uuid_is_null(fs->super->s_journal_uuid))
@@ -586,9 +587,9 @@ static errcode_t ext2fs_journal_load(journal_t *journal)
         * These should never appear in a journal super block, so if
         * they do, the journal is badly corrupted.
         */
-       case JFS_DESCRIPTOR_BLOCK:
-       case JFS_COMMIT_BLOCK:
-       case JFS_REVOKE_BLOCK:
+       case JBD2_DESCRIPTOR_BLOCK:
+       case JBD2_COMMIT_BLOCK:
+       case JBD2_REVOKE_BLOCK:
                return EXT2_ET_CORRUPT_JOURNAL_SB;
 
        /* If we don't understand the superblock major type, but there
@@ -598,25 +599,25 @@ static errcode_t ext2fs_journal_load(journal_t *journal)
                return EXT2_ET_JOURNAL_UNSUPP_VERSION;
        }
 
-       if (JFS_HAS_INCOMPAT_FEATURE(journal, ~JFS_KNOWN_INCOMPAT_FEATURES))
+       if (JBD2_HAS_INCOMPAT_FEATURE(journal, ~JBD2_KNOWN_INCOMPAT_FEATURES))
                return EXT2_ET_UNSUPP_FEATURE;
 
-       if (JFS_HAS_RO_COMPAT_FEATURE(journal, ~JFS_KNOWN_ROCOMPAT_FEATURES))
+       if (JBD2_HAS_RO_COMPAT_FEATURE(journal, ~JBD2_KNOWN_ROCOMPAT_FEATURES))
                return EXT2_ET_RO_UNSUPP_FEATURE;
 
        /* Checksum v1-3 are mutually exclusive features. */
-       if (jfs_has_feature_csum2(journal) && jfs_has_feature_csum3(journal))
+       if (jbd2_has_feature_csum2(journal) && jbd2_has_feature_csum3(journal))
                return EXT2_ET_CORRUPT_JOURNAL_SB;
 
-       if (journal_has_csum_v2or3(journal) &&
-           jfs_has_feature_checksum(journal))
+       if (jbd2_journal_has_csum_v2or3(journal) &&
+           jbd2_has_feature_checksum(journal))
                return EXT2_ET_CORRUPT_JOURNAL_SB;
 
        if (!ext2fs_journal_verify_csum_type(journal, jsb) ||
            !ext2fs_journal_sb_csum_verify(journal, jsb))
                return EXT2_ET_CORRUPT_JOURNAL_SB;
 
-       if (journal_has_csum_v2or3(journal))
+       if (jbd2_journal_has_csum_v2or3(journal))
                journal->j_csum_seed = jbd2_chksum(journal, ~0, jsb->s_uuid,
                                                   sizeof(jsb->s_uuid));
 
@@ -740,7 +741,7 @@ static errcode_t recover_ext3_journal(ext2_filsys fs)
        journal_t *journal;
        errcode_t retval;
 
-       journal_init_revoke_caches();
+       jbd2_journal_init_revoke_caches();
        retval = ext2fs_get_journal(fs, &journal);
        if (retval)
                return retval;
@@ -749,11 +750,11 @@ static errcode_t recover_ext3_journal(ext2_filsys fs)
        if (retval)
                goto errout;
 
-       retval = journal_init_revoke(journal, 1024);
+       retval = jbd2_journal_init_revoke(journal, 1024);
        if (retval)
                goto errout;
 
-       retval = -journal_recover(journal);
+       retval = -jbd2_journal_recover(journal);
        if (retval)
                goto errout;
 
@@ -763,8 +764,8 @@ static errcode_t recover_ext3_journal(ext2_filsys fs)
        }
 
 errout:
-       journal_destroy_revoke(journal);
-       journal_destroy_revoke_caches();
+       jbd2_journal_destroy_revoke(journal);
+       jbd2_journal_destroy_revoke_caches();
        ext2fs_journal_release(fs, journal, 1, 0);
        return retval;
 }
@@ -830,7 +831,7 @@ errcode_t ext2fs_open_journal(ext2_filsys fs, journal_t **j)
        journal_t *journal;
        errcode_t retval;
 
-       journal_init_revoke_caches();
+       jbd2_journal_init_revoke_caches();
        retval = ext2fs_get_journal(fs, &journal);
        if (retval)
                return retval;
@@ -839,7 +840,7 @@ errcode_t ext2fs_open_journal(ext2_filsys fs, journal_t **j)
        if (retval)
                goto errout;
 
-       retval = journal_init_revoke(journal, 1024);
+       retval = jbd2_journal_init_revoke(journal, 1024);
        if (retval)
                goto errout;
 
@@ -852,8 +853,8 @@ errcode_t ext2fs_open_journal(ext2_filsys fs, journal_t **j)
        return 0;
 
 errout:
-       journal_destroy_revoke(journal);
-       journal_destroy_revoke_caches();
+       jbd2_journal_destroy_revoke(journal);
+       jbd2_journal_destroy_revoke_caches();
        ext2fs_journal_release(fs, journal, 1, 0);
        return retval;
 }
@@ -862,8 +863,8 @@ errcode_t ext2fs_close_journal(ext2_filsys fs, journal_t **j)
 {
        journal_t *journal = *j;
 
-       journal_destroy_revoke(journal);
-       journal_destroy_revoke_caches();
+       jbd2_journal_destroy_revoke(journal);
+       jbd2_journal_destroy_revoke_caches();
        ext2fs_journal_release(fs, journal, 0, 0);
        *j = NULL;
 
@@ -875,7 +876,7 @@ void jbd2_commit_block_csum_set(journal_t *j, struct buffer_head *bh)
        struct commit_header *h;
        __u32 csum;
 
-       if (!journal_has_csum_v2or3(j))
+       if (!jbd2_journal_has_csum_v2or3(j))
                return;
 
        h = (struct commit_header *)(bh->b_data);
@@ -891,7 +892,7 @@ void jbd2_revoke_csum_set(journal_t *j, struct buffer_head *bh)
        struct journal_revoke_tail *tail;
        __u32 csum;
 
-       if (!journal_has_csum_v2or3(j))
+       if (!jbd2_journal_has_csum_v2or3(j))
                return;
 
        tail = (struct journal_revoke_tail *)(bh->b_data + j->j_blocksize -
@@ -903,14 +904,14 @@ void jbd2_revoke_csum_set(journal_t *j, struct buffer_head *bh)
 
 void jbd2_descr_block_csum_set(journal_t *j, struct buffer_head *bh)
 {
-       struct journal_block_tail *tail;
+       struct jbd2_journal_block_tail *tail;
        __u32 csum;
 
-       if (!journal_has_csum_v2or3(j))
+       if (!jbd2_journal_has_csum_v2or3(j))
                return;
 
-       tail = (struct journal_block_tail *)(bh->b_data + j->j_blocksize -
-                       sizeof(struct journal_block_tail));
+       tail = (struct jbd2_journal_block_tail *)(bh->b_data + j->j_blocksize -
+                       sizeof(struct jbd2_journal_block_tail));
        tail->t_checksum = 0;
        csum = jbd2_chksum(j, j->j_csum_seed, bh->b_data, j->j_blocksize);
        tail->t_checksum = ext2fs_cpu_to_be32(csum);
@@ -923,14 +924,14 @@ void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag,
        __u32 csum32;
        __be32 seq;
 
-       if (!journal_has_csum_v2or3(j))
+       if (!jbd2_journal_has_csum_v2or3(j))
                return;
 
        seq = ext2fs_cpu_to_be32(sequence);
        csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&seq, sizeof(seq));
        csum32 = jbd2_chksum(j, csum32, bh->b_data, bh->b_size);
 
-       if (jfs_has_feature_csum3(j))
+       if (jbd2_has_feature_csum3(j))
                tag3->t_checksum = ext2fs_cpu_to_be32(csum32);
        else
                tag->t_checksum = ext2fs_cpu_to_be16(csum32);
index e286ae8..1688995 100644 (file)
@@ -325,15 +325,15 @@ static int read_journal_block(const char *cmd, struct journal_source *source,
 static const char *type_to_name(int btype)
 {
        switch (btype) {
-       case JFS_DESCRIPTOR_BLOCK:
+       case JBD2_DESCRIPTOR_BLOCK:
                return "descriptor block";
-       case JFS_COMMIT_BLOCK:
+       case JBD2_COMMIT_BLOCK:
                return "commit block";
-       case JFS_SUPERBLOCK_V1:
+       case JBD2_SUPERBLOCK_V1:
                return "V1 superblock";
-       case JFS_SUPERBLOCK_V2:
+       case JBD2_SUPERBLOCK_V2:
                return "V2 superblock";
-       case JFS_REVOKE_BLOCK:
+       case JBD2_REVOKE_BLOCK:
                return "revoke table";
        }
        return "unrecognised type";
@@ -366,7 +366,7 @@ static void dump_journal(char *cmdname, FILE *out_file,
                ext2fs_swap_super(sb);
 #endif
 
-       if ((be32_to_cpu(jsb->s_header.h_magic) != JFS_MAGIC_NUMBER) &&
+       if ((be32_to_cpu(jsb->s_header.h_magic) != JBD2_MAGIC_NUMBER) &&
            (sb->s_magic == EXT2_SUPER_MAGIC) &&
            ext2fs_has_feature_journal_dev(sb)) {
                blocksize = EXT2_BLOCK_SIZE(sb);
@@ -395,7 +395,7 @@ static void dump_journal(char *cmdname, FILE *out_file,
        }
 
        jsb = (journal_superblock_t *) jsb_buffer;
-       if (be32_to_cpu(jsb->s_header.h_magic) != JFS_MAGIC_NUMBER) {
+       if (be32_to_cpu(jsb->s_header.h_magic) != JBD2_MAGIC_NUMBER) {
                fprintf(out_file,
                        "Journal superblock magic number invalid!\n");
                return;
@@ -428,7 +428,7 @@ static void dump_journal(char *cmdname, FILE *out_file,
                sequence = be32_to_cpu(header->h_sequence);
                blocktype = be32_to_cpu(header->h_blocktype);
 
-               if (magic != JFS_MAGIC_NUMBER) {
+               if (magic != JBD2_MAGIC_NUMBER) {
                        fprintf (out_file, "No magic number at block %u: "
                                 "end of journal.\n", blocknr);
                        return;
@@ -450,19 +450,19 @@ static void dump_journal(char *cmdname, FILE *out_file,
                }
 
                switch (blocktype) {
-               case JFS_DESCRIPTOR_BLOCK:
+               case JBD2_DESCRIPTOR_BLOCK:
                        dump_descriptor_block(out_file, source, buf, jsb,
                                              &blocknr, blocksize,
                                              transaction);
                        continue;
 
-               case JFS_COMMIT_BLOCK:
+               case JBD2_COMMIT_BLOCK:
                        transaction++;
                        blocknr++;
                        WRAP(jsb, blocknr);
                        continue;
 
-               case JFS_REVOKE_BLOCK:
+               case JBD2_REVOKE_BLOCK:
                        dump_revoke_block(out_file, buf, jsb,
                                          blocknr, blocksize,
                                          transaction);
@@ -482,15 +482,15 @@ static inline size_t journal_super_tag_bytes(journal_superblock_t *jsb)
 {
        size_t sz;
 
-       if (JSB_HAS_INCOMPAT_FEATURE(jsb, JFS_FEATURE_INCOMPAT_CSUM_V3))
+       if (JSB_HAS_INCOMPAT_FEATURE(jsb, JBD2_FEATURE_INCOMPAT_CSUM_V3))
                return sizeof(journal_block_tag3_t);
 
        sz = sizeof(journal_block_tag_t);
 
-       if (JSB_HAS_INCOMPAT_FEATURE(jsb, JFS_FEATURE_INCOMPAT_CSUM_V2))
+       if (JSB_HAS_INCOMPAT_FEATURE(jsb, JBD2_FEATURE_INCOMPAT_CSUM_V2))
                sz += sizeof(__u16);
 
-       if (JSB_HAS_INCOMPAT_FEATURE(jsb, JFS_FEATURE_INCOMPAT_64BIT))
+       if (JSB_HAS_INCOMPAT_FEATURE(jsb, JBD2_FEATURE_INCOMPAT_64BIT))
                return sz;
 
        return sz - sizeof(__u32);
@@ -514,9 +514,9 @@ static void dump_descriptor_block(FILE *out_file,
        offset = sizeof(journal_header_t);
        blocknr = *blockp;
 
-       if (JSB_HAS_INCOMPAT_FEATURE(jsb, JFS_FEATURE_INCOMPAT_CSUM_V3) ||
-           JSB_HAS_INCOMPAT_FEATURE(jsb, JFS_FEATURE_INCOMPAT_CSUM_V2))
-               csum_size = sizeof(struct journal_block_tail);
+       if (JSB_HAS_INCOMPAT_FEATURE(jsb, JBD2_FEATURE_INCOMPAT_CSUM_V3) ||
+           JSB_HAS_INCOMPAT_FEATURE(jsb, JBD2_FEATURE_INCOMPAT_CSUM_V2))
+               csum_size = sizeof(struct jbd2_journal_block_tail);
 
        if (dump_all)
                fprintf(out_file, "Dumping descriptor block, sequence %u, at "
@@ -540,7 +540,7 @@ static void dump_descriptor_block(FILE *out_file,
                tag_block = be32_to_cpu(tag->t_blocknr);
                tag_flags = be16_to_cpu(tag->t_flags);
 
-               if (!(tag_flags & JFS_FLAG_SAME_UUID))
+               if (!(tag_flags & JBD2_FLAG_SAME_UUID))
                        offset += 16;
 
                dump_metadata_block(out_file, source, jsb,
@@ -550,7 +550,7 @@ static void dump_descriptor_block(FILE *out_file,
                ++blocknr;
                WRAP(jsb, blocknr);
 
-       } while (!(tag_flags & JFS_FLAG_LAST_TAG));
+       } while (!(tag_flags & JBD2_FLAG_LAST_TAG));
 
        *blockp = blocknr;
 }
@@ -563,7 +563,7 @@ static void dump_revoke_block(FILE *out_file, char *buf,
                              tid_t transaction)
 {
        int                     offset, max;
-       journal_revoke_header_t *header;
+       jbd2_journal_revoke_header_t *header;
        unsigned long long      rblock;
        int                     tag_size = sizeof(__u32);
 
@@ -571,11 +571,11 @@ static void dump_revoke_block(FILE *out_file, char *buf,
                fprintf(out_file, "Dumping revoke block, sequence %u, at "
                        "block %u:\n", transaction, blocknr);
 
-       if (be32_to_cpu(jsb->s_feature_incompat) & JFS_FEATURE_INCOMPAT_64BIT)
+       if (be32_to_cpu(jsb->s_feature_incompat) & JBD2_FEATURE_INCOMPAT_64BIT)
                tag_size = sizeof(__u64);
 
-       header = (journal_revoke_header_t *) buf;
-       offset = sizeof(journal_revoke_header_t);
+       header = (jbd2_journal_revoke_header_t *) buf;
+       offset = sizeof(jbd2_journal_revoke_header_t);
        max = be32_to_cpu(header->r_count);
 
        while (offset < max) {
index 8faf9c0..46df997 100644 (file)
@@ -180,7 +180,8 @@ _INLINE_ __u32 hash_64(__u64 val, unsigned int bits)
 /*
  * Kernel compatibility functions are defined in journal.c
  */
-int journal_bmap(journal_t *journal, blk64_t block, unsigned long long *phys);
+int jbd2_journal_bmap(journal_t *journal, blk64_t block,
+                     unsigned long long *phys);
 struct buffer_head *getblk(kdev_t ctx, blk64_t blocknr, int blocksize);
 int sync_blockdev(kdev_t kdev);
 void ll_rw_block(int rw, int op_flags, int nr, struct buffer_head *bh[]);
@@ -202,7 +203,7 @@ void wait_on_buffer(struct buffer_head *bh);
 #define J_ASSERT(x)    assert(x)
 
 #define JSB_HAS_INCOMPAT_FEATURE(jsb, mask)                            \
-       ((jsb)->s_header.h_blocktype == ext2fs_cpu_to_be32(JFS_SUPERBLOCK_V2) &&        \
+       ((jsb)->s_header.h_blocktype == ext2fs_cpu_to_be32(JBD2_SUPERBLOCK_V2) &&       \
         ((jsb)->s_feature_incompat & ext2fs_cpu_to_be32((mask))))
 #else  /* !DEBUGFS */
 
@@ -226,17 +227,17 @@ extern e2fsck_t e2fsck_global_ctx;  /* Try your very best not to use this! */
 #endif
 
 /* recovery.c */
-extern int     journal_recover    (journal_t *journal);
-extern int     journal_skip_recovery (journal_t *);
+extern int     jbd2_journal_recover    (journal_t *journal);
+extern int     jbd2_journal_skip_recovery (journal_t *);
 
 /* revoke.c */
-extern int     journal_init_revoke(journal_t *, int);
-extern void    journal_destroy_revoke(journal_t *);
-extern void    journal_destroy_revoke_caches(void);
-extern int     journal_init_revoke_caches(void);
-
-extern int     journal_set_revoke(journal_t *, unsigned long long, tid_t);
-extern int     journal_test_revoke(journal_t *, unsigned long long, tid_t);
-extern void    journal_clear_revoke(journal_t *);
+extern int     jbd2_journal_init_revoke(journal_t *, int);
+extern void    jbd2_journal_destroy_revoke(journal_t *);
+extern void    jbd2_journal_destroy_revoke_caches(void);
+extern int     jbd2_journal_init_revoke_caches(void);
+
+extern int     jbd2_journal_set_revoke(journal_t *, unsigned long long, tid_t);
+extern int     jbd2_journal_test_revoke(journal_t *, unsigned long long, tid_t);
+extern void    jbd2_journal_clear_revoke(journal_t *);
 
 #endif /* _JFS_USER_H */
index 6e3c982..3ab151b 100644 (file)
@@ -44,7 +44,7 @@ static int bh_count = 0;
 static int e2fsck_journal_verify_csum_type(journal_t *j,
                                           journal_superblock_t *jsb)
 {
-       if (!journal_has_csum_v2or3(j))
+       if (!jbd2_journal_has_csum_v2or3(j))
                return 1;
 
        return jsb->s_checksum_type == JBD2_CRC32C_CHKSUM;
@@ -68,7 +68,7 @@ static int e2fsck_journal_sb_csum_verify(journal_t *j,
 {
        __u32 provided, calculated;
 
-       if (!journal_has_csum_v2or3(j))
+       if (!jbd2_journal_has_csum_v2or3(j))
                return 1;
 
        provided = ext2fs_be32_to_cpu(jsb->s_checksum);
@@ -82,7 +82,7 @@ static errcode_t e2fsck_journal_sb_csum_set(journal_t *j,
 {
        __u32 crc;
 
-       if (!journal_has_csum_v2or3(j))
+       if (!jbd2_journal_has_csum_v2or3(j))
                return 0;
 
        crc = e2fsck_journal_sb_csum(jsb);
@@ -94,7 +94,8 @@ static errcode_t e2fsck_journal_sb_csum_set(journal_t *j,
  * to use the recovery.c file virtually unchanged from the kernel, so we
  * don't have to do much to keep kernel and user recovery in sync.
  */
-int journal_bmap(journal_t *journal, blk64_t block, unsigned long long *phys)
+int jbd2_journal_bmap(journal_t *journal, blk64_t block,
+                     unsigned long long *phys)
 {
 #ifdef USE_INODE_IO
        *phys = block;
@@ -356,7 +357,7 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)
                        goto try_backup_journal;
                }
                if (EXT2_I_SIZE(&j_inode->i_ext2) / journal->j_blocksize <
-                   JFS_MIN_JOURNAL_BLOCKS) {
+                   JBD2_MIN_JOURNAL_BLOCKS) {
                        retval = EXT2_ET_JOURNAL_TOO_SMALL;
                        goto try_backup_journal;
                }
@@ -390,7 +391,7 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)
 #else
                journal->j_inode = j_inode;
                ctx->journal_io = ctx->fs->io;
-               if ((ret = journal_bmap(journal, 0, &start)) != 0) {
+               if ((ret = jbd2_journal_bmap(journal, 0, &start)) != 0) {
                        retval = (errcode_t) (-1 * ret);
                        goto errout;
                }
@@ -599,12 +600,12 @@ static errcode_t e2fsck_journal_load(journal_t *journal)
        }
 
        jsb = journal->j_superblock;
-       /* If we don't even have JFS_MAGIC, we probably have a wrong inode */
-       if (jsb->s_header.h_magic != htonl(JFS_MAGIC_NUMBER))
+       /* If we don't even have JBD2_MAGIC, we probably have a wrong inode */
+       if (jsb->s_header.h_magic != htonl(JBD2_MAGIC_NUMBER))
                return e2fsck_journal_fix_bad_inode(ctx, &pctx);
 
        switch (ntohl(jsb->s_header.h_blocktype)) {
-       case JFS_SUPERBLOCK_V1:
+       case JBD2_SUPERBLOCK_V1:
                journal->j_format_version = 1;
                if (jsb->s_feature_compat ||
                    jsb->s_feature_incompat ||
@@ -613,7 +614,7 @@ static errcode_t e2fsck_journal_load(journal_t *journal)
                        clear_v2_journal_fields(journal);
                break;
 
-       case JFS_SUPERBLOCK_V2:
+       case JBD2_SUPERBLOCK_V2:
                journal->j_format_version = 2;
                if (ntohl(jsb->s_nr_users) > 1 &&
                    uuid_is_null(ctx->fs->super->s_journal_uuid))
@@ -628,9 +629,9 @@ static errcode_t e2fsck_journal_load(journal_t *journal)
         * These should never appear in a journal super block, so if
         * they do, the journal is badly corrupted.
         */
-       case JFS_DESCRIPTOR_BLOCK:
-       case JFS_COMMIT_BLOCK:
-       case JFS_REVOKE_BLOCK:
+       case JBD2_DESCRIPTOR_BLOCK:
+       case JBD2_COMMIT_BLOCK:
+       case JBD2_REVOKE_BLOCK:
                return EXT2_ET_CORRUPT_JOURNAL_SB;
 
        /* If we don't understand the superblock major type, but there
@@ -640,25 +641,25 @@ static errcode_t e2fsck_journal_load(journal_t *journal)
                return EXT2_ET_JOURNAL_UNSUPP_VERSION;
        }
 
-       if (JFS_HAS_INCOMPAT_FEATURE(journal, ~JFS_KNOWN_INCOMPAT_FEATURES))
+       if (JBD2_HAS_INCOMPAT_FEATURE(journal, ~JBD2_KNOWN_INCOMPAT_FEATURES))
                return EXT2_ET_UNSUPP_FEATURE;
 
-       if (JFS_HAS_RO_COMPAT_FEATURE(journal, ~JFS_KNOWN_ROCOMPAT_FEATURES))
+       if (JBD2_HAS_RO_COMPAT_FEATURE(journal, ~JBD2_KNOWN_ROCOMPAT_FEATURES))
                return EXT2_ET_RO_UNSUPP_FEATURE;
 
        /* Checksum v1-3 are mutually exclusive features. */
-       if (jfs_has_feature_csum2(journal) && jfs_has_feature_csum3(journal))
+       if (jbd2_has_feature_csum2(journal) && jbd2_has_feature_csum3(journal))
                return EXT2_ET_CORRUPT_JOURNAL_SB;
 
-       if (journal_has_csum_v2or3(journal) &&
-           jfs_has_feature_checksum(journal))
+       if (jbd2_journal_has_csum_v2or3(journal) &&
+           jbd2_has_feature_checksum(journal))
                return EXT2_ET_CORRUPT_JOURNAL_SB;
 
        if (!e2fsck_journal_verify_csum_type(journal, jsb) ||
            !e2fsck_journal_sb_csum_verify(journal, jsb))
                return EXT2_ET_CORRUPT_JOURNAL_SB;
 
-       if (journal_has_csum_v2or3(journal))
+       if (jbd2_journal_has_csum_v2or3(journal))
                journal->j_csum_seed = jbd2_chksum(journal, ~0, jsb->s_uuid,
                                                   sizeof(jsb->s_uuid));
 
@@ -705,10 +706,10 @@ static void e2fsck_journal_reset_super(e2fsck_t ctx, journal_superblock_t *jsb,
         * Anything unrecognisable we overwrite with a new V2
         * signature. */
 
-       if (jsb->s_header.h_magic != htonl(JFS_MAGIC_NUMBER) ||
-           jsb->s_header.h_blocktype != htonl(JFS_SUPERBLOCK_V1)) {
-               jsb->s_header.h_magic = htonl(JFS_MAGIC_NUMBER);
-               jsb->s_header.h_blocktype = htonl(JFS_SUPERBLOCK_V2);
+       if (jsb->s_header.h_magic != htonl(JBD2_MAGIC_NUMBER) ||
+           jsb->s_header.h_blocktype != htonl(JBD2_SUPERBLOCK_V1)) {
+               jsb->s_header.h_magic = htonl(JBD2_MAGIC_NUMBER);
+               jsb->s_header.h_blocktype = htonl(JBD2_SUPERBLOCK_V2);
        }
 
        /* Zero out everything else beyond the superblock header */
@@ -928,7 +929,7 @@ static errcode_t recover_ext3_journal(e2fsck_t ctx)
 
        clear_problem_context(&pctx);
 
-       journal_init_revoke_caches();
+       jbd2_journal_init_revoke_caches();
        retval = e2fsck_get_journal(ctx, &journal);
        if (retval)
                return retval;
@@ -937,11 +938,11 @@ static errcode_t recover_ext3_journal(e2fsck_t ctx)
        if (retval)
                goto errout;
 
-       retval = journal_init_revoke(journal, 1024);
+       retval = jbd2_journal_init_revoke(journal, 1024);
        if (retval)
                goto errout;
 
-       retval = -journal_recover(journal);
+       retval = -jbd2_journal_recover(journal);
        if (retval)
                goto errout;
 
@@ -955,8 +956,8 @@ static errcode_t recover_ext3_journal(e2fsck_t ctx)
        journal->j_tail_sequence = journal->j_transaction_sequence;
 
 errout:
-       journal_destroy_revoke(journal);
-       journal_destroy_revoke_caches();
+       jbd2_journal_destroy_revoke(journal);
+       jbd2_journal_destroy_revoke_caches();
        e2fsck_journal_release(ctx, journal, 1, 0);
        return retval;
 }
index a185f34..a0e15e8 100644 (file)
@@ -84,7 +84,7 @@ static int do_readahead(journal_t *journal, unsigned int start)
        nbufs = 0;
 
        for (next = start; next < max; next++) {
-               err = journal_bmap(journal, next, &blocknr);
+               err = jbd2_journal_bmap(journal, next, &blocknr);
 
                if (err) {
                        printk(KERN_ERR "JBD2: bad block at offset %u\n",
@@ -161,7 +161,7 @@ static int jread(struct buffer_head **bhp, journal_t *journal,
                return -EFSCORRUPTED;
        }
 
-       err = journal_bmap(journal, offset, &blocknr);
+       err = jbd2_journal_bmap(journal, offset, &blocknr);
 
        if (err) {
                printk(KERN_ERR "JBD2: bad block at offset %u\n",
@@ -195,15 +195,15 @@ static int jread(struct buffer_head **bhp, journal_t *journal,
 static int jbd2_descr_block_csum_verify(journal_t *j,
                                        void *buf)
 {
-       struct journal_block_tail *tail;
+       struct jbd2_journal_block_tail *tail;
        __u32 provided;
        __u32 calculated;
 
-       if (!journal_has_csum_v2or3(j))
+       if (!jbd2_journal_has_csum_v2or3(j))
                return 1;
 
-       tail = (struct journal_block_tail *)((char *)buf + j->j_blocksize -
-                       sizeof(struct journal_block_tail));
+       tail = (struct jbd2_journal_block_tail *)((char *)buf + j->j_blocksize -
+                       sizeof(struct jbd2_journal_block_tail));
        provided = tail->t_checksum;
        tail->t_checksum = 0;
        calculated = jbd2_chksum(j, j->j_csum_seed, buf, j->j_blocksize);
@@ -223,8 +223,8 @@ static int count_tags(journal_t *journal, struct buffer_head *bh)
        int                     nr = 0, size = journal->j_blocksize;
        int                     tag_bytes = journal_tag_bytes(journal);
 
-       if (journal_has_csum_v2or3(journal))
-               size -= sizeof(struct journal_block_tail);
+       if (jbd2_journal_has_csum_v2or3(journal))
+               size -= sizeof(struct jbd2_journal_block_tail);
 
        tagp = &bh->b_data[sizeof(journal_header_t)];
 
@@ -233,10 +233,10 @@ static int count_tags(journal_t *journal, struct buffer_head *bh)
 
                nr++;
                tagp += tag_bytes;
-               if (!(get_be16(&tag->t_flags) & JFS_FLAG_SAME_UUID))
+               if (!(get_be16(&tag->t_flags) & JBD2_FLAG_SAME_UUID))
                        tagp += 16;
 
-               if (get_be16(&tag->t_flags) & JFS_FLAG_LAST_TAG)
+               if (get_be16(&tag->t_flags) & JBD2_FLAG_LAST_TAG)
                        break;
        }
 
@@ -252,7 +252,7 @@ do {                                                                        \
 } while (0)
 
 /**
- * journal_recover - recovers a on-disk journal
+ * jbd2_journal_recover - recovers a on-disk journal
  * @journal: the journal to recover
  *
  * The primary function for recovering the log contents when mounting a
@@ -263,7 +263,7 @@ do {                                                                        \
  * blocks.  In the third and final pass, we replay any un-revoked blocks
  * in the log.
  */
-int journal_recover(journal_t *journal)
+int jbd2_journal_recover(journal_t *journal)
 {
        int                     err, err2;
        journal_superblock_t *  sb;
@@ -302,12 +302,12 @@ int journal_recover(journal_t *journal)
         * any existing commit records in the log. */
        journal->j_transaction_sequence = ++info.end_transaction;
 
-       journal_clear_revoke(journal);
+       jbd2_journal_clear_revoke(journal);
        err2 = sync_blockdev(journal->j_fs_dev);
        if (!err)
                err = err2;
        /* Make sure all replayed data is on permanent storage */
-       if (journal->j_flags & JFS_BARRIER) {
+       if (journal->j_flags & JBD2_BARRIER) {
                err2 = blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL);
                if (!err)
                        err = err2;
@@ -316,7 +316,7 @@ int journal_recover(journal_t *journal)
 }
 
 /**
- * journal_skip_recovery - Start journal and wipe exiting records
+ * jbd2_journal_skip_recovery - Start journal and wipe exiting records
  * @journal: journal to startup
  *
  * Locate any valid recovery information from the journal and set up the
@@ -328,7 +328,7 @@ int journal_recover(journal_t *journal)
  * much recovery information is being erased, and to let us initialise
  * the journal transaction sequence numbers to the next unused ID.
  */
-int journal_skip_recovery(journal_t *journal)
+int jbd2_journal_skip_recovery(journal_t *journal)
 {
        int                     err;
 
@@ -342,7 +342,7 @@ int journal_skip_recovery(journal_t *journal)
                printk(KERN_ERR "JBD2: error %d scanning journal\n", err);
                ++journal->j_transaction_sequence;
        } else {
-#ifdef CONFIG_JFS_DEBUG
+#ifdef CONFIG_JBD2_DEBUG
                int dropped = info.end_transaction -
                        ext2fs_be32_to_cpu(journal->j_superblock->s_sequence);
                jbd_debug(1,
@@ -360,7 +360,7 @@ static inline unsigned long long read_tag_block(journal_t *journal,
                                                journal_block_tag_t *tag)
 {
        unsigned long long block = get_be32(&tag->t_blocknr);
-       if (jfs_has_feature_64bit(journal))
+       if (jbd2_has_feature_64bit(journal))
                block |= (u64)get_be32(&tag->t_blocknr_high) << 32;
        return block;
 }
@@ -403,7 +403,7 @@ static int jbd2_commit_block_csum_verify(journal_t *j, void *buf)
        __u32 provided;
        __u32 calculated;
 
-       if (!journal_has_csum_v2or3(j))
+       if (!jbd2_journal_has_csum_v2or3(j))
                return 1;
 
        h = buf;
@@ -422,14 +422,14 @@ static int jbd2_block_tag_csum_verify(journal_t *j, journal_block_tag_t *tag,
        __u32 csum32;
        __u32 seq;
 
-       if (!journal_has_csum_v2or3(j))
+       if (!jbd2_journal_has_csum_v2or3(j))
                return 1;
 
        seq = ext2fs_cpu_to_be32(sequence);
        csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&seq, sizeof(seq));
        csum32 = jbd2_chksum(j, csum32, buf, j->j_blocksize);
 
-       if (jfs_has_feature_csum3(j))
+       if (jbd2_has_feature_csum3(j))
                return get_be32(&tag3->t_checksum) == csum32;
 
        return get_be16(&tag->t_checksum) == (csum32 & 0xFFFF);
@@ -514,7 +514,7 @@ static int do_one_pass(journal_t *journal,
 
                tmp = (journal_header_t *)bh->b_data;
 
-               if (tmp->h_magic != ext2fs_cpu_to_be32(JFS_MAGIC_NUMBER)) {
+               if (tmp->h_magic != ext2fs_cpu_to_be32(JBD2_MAGIC_NUMBER)) {
                        brelse(bh);
                        break;
                }
@@ -534,11 +534,11 @@ static int do_one_pass(journal_t *journal,
                 * to do with it?  That depends on the pass... */
 
                switch(blocktype) {
-               case JFS_DESCRIPTOR_BLOCK:
+               case JBD2_DESCRIPTOR_BLOCK:
                        /* Verify checksum first */
-                       if (journal_has_csum_v2or3(journal))
+                       if (jbd2_journal_has_csum_v2or3(journal))
                                descr_csum_size =
-                                       sizeof(struct journal_block_tail);
+                                       sizeof(struct jbd2_journal_block_tail);
                        if (descr_csum_size > 0 &&
                            !jbd2_descr_block_csum_verify(journal,
                                                          bh->b_data)) {
@@ -553,7 +553,7 @@ static int do_one_pass(journal_t *journal,
                         * just skip over the blocks it describes. */
                        if (pass != PASS_REPLAY) {
                                if (pass == PASS_SCAN &&
-                                   jfs_has_feature_checksum(journal) &&
+                                   jbd2_has_feature_checksum(journal) &&
                                    !info->end_transaction) {
                                        if (calc_chksums(journal, bh,
                                                        &next_log_block,
@@ -603,7 +603,7 @@ static int do_one_pass(journal_t *journal,
                                        /* If the block has been
                                         * revoked, then we're all done
                                         * here. */
-                                       if (journal_test_revoke
+                                       if (jbd2_journal_test_revoke
                                            (journal, blocknr,
                                             next_commit_ID)) {
                                                brelse(obh);
@@ -619,8 +619,8 @@ static int do_one_pass(journal_t *journal,
                                                success = -EFSBADCRC;
                                                printk(KERN_ERR "JBD2: Invalid "
                                                       "checksum recovering "
-                                                      "block %llu in log\n",
-                                                      blocknr);
+                                                      "data block %llu in "
+                                                      "log\n", blocknr);
                                                block_error = 1;
                                                goto skip_write;
                                        }
@@ -643,8 +643,8 @@ static int do_one_pass(journal_t *journal,
                                        lock_buffer(nbh);
                                        memcpy(nbh->b_data, obh->b_data,
                                                        journal->j_blocksize);
-                                       if (flags & JFS_FLAG_ESCAPE) {
-                                               __u32 magic = ext2fs_cpu_to_be32(JFS_MAGIC_NUMBER);
+                                       if (flags & JBD2_FLAG_ESCAPE) {
+                                               __u32 magic = ext2fs_cpu_to_be32(JBD2_MAGIC_NUMBER);
                                                memcpy(nbh->b_data, &magic,
                                                       sizeof(magic));
                                        }
@@ -662,17 +662,17 @@ static int do_one_pass(journal_t *journal,
 
                        skip_write:
                                tagp += tag_bytes;
-                               if (!(flags & JFS_FLAG_SAME_UUID))
+                               if (!(flags & JBD2_FLAG_SAME_UUID))
                                        tagp += 16;
 
-                               if (flags & JFS_FLAG_LAST_TAG)
+                               if (flags & JBD2_FLAG_LAST_TAG)
                                        break;
                        }
 
                        brelse(bh);
                        continue;
 
-               case JFS_COMMIT_BLOCK:
+               case JBD2_COMMIT_BLOCK:
                        /*     How to differentiate between interrupted commit
                         *               and journal corruption ?
                         *
@@ -709,7 +709,7 @@ static int do_one_pass(journal_t *journal,
                         * much to do other than move on to the next sequence
                         * number. */
                        if (pass == PASS_SCAN &&
-                           jfs_has_feature_checksum(journal)) {
+                           jbd2_has_feature_checksum(journal)) {
                                int chksum_err, chksum_seen;
                                struct commit_header *cbh =
                                        (struct commit_header *)bh->b_data;
@@ -726,9 +726,9 @@ static int do_one_pass(journal_t *journal,
                                }
 
                                if (crc32_sum == found_chksum &&
-                                   cbh->h_chksum_type == JFS_CRC32_CHKSUM &&
+                                   cbh->h_chksum_type == JBD2_CRC32_CHKSUM &&
                                    cbh->h_chksum_size ==
-                                               JFS_CRC32_CHKSUM_SIZE)
+                                               JBD2_CRC32_CHKSUM_SIZE)
                                       chksum_seen = 1;
                                else if (!(cbh->h_chksum_type == 0 &&
                                             cbh->h_chksum_size == 0 &&
@@ -749,7 +749,7 @@ static int do_one_pass(journal_t *journal,
                                if (chksum_err) {
                                        info->end_transaction = next_commit_ID;
 
-                                       if (!jfs_has_feature_async_commit(journal)){
+                                       if (!jbd2_has_feature_async_commit(journal)) {
                                                journal->j_failed_commit =
                                                        next_commit_ID;
                                                brelse(bh);
@@ -763,7 +763,7 @@ static int do_one_pass(journal_t *journal,
                                                           bh->b_data)) {
                                info->end_transaction = next_commit_ID;
 
-                               if (!jfs_has_feature_async_commit(journal)) {
+                               if (!jbd2_has_feature_async_commit(journal)) {
                                        journal->j_failed_commit =
                                                next_commit_ID;
                                        brelse(bh);
@@ -774,7 +774,7 @@ static int do_one_pass(journal_t *journal,
                        next_commit_ID++;
                        continue;
 
-               case JFS_REVOKE_BLOCK:
+               case JBD2_REVOKE_BLOCK:
                        /* If we aren't in the REVOKE pass, then we can
                         * just skip over this block. */
                        if (pass != PASS_REVOKE) {
@@ -834,7 +834,7 @@ static int jbd2_revoke_block_csum_verify(journal_t *j,
        __u32 provided;
        __u32 calculated;
 
-       if (!journal_has_csum_v2or3(j))
+       if (!jbd2_journal_has_csum_v2or3(j))
                return 1;
 
        tail = (struct journal_revoke_tail *)((char *)buf + j->j_blocksize -
@@ -852,26 +852,26 @@ static int jbd2_revoke_block_csum_verify(journal_t *j,
 static int scan_revoke_records(journal_t *journal, struct buffer_head *bh,
                               tid_t sequence, struct recovery_info *info)
 {
-       journal_revoke_header_t *header;
+       jbd2_journal_revoke_header_t *header;
        int offset, max;
        unsigned csum_size = 0;
        __u32 rcount;
        int record_len = 4;
 
-       header = (journal_revoke_header_t *) bh->b_data;
-       offset = sizeof(journal_revoke_header_t);
+       header = (jbd2_journal_revoke_header_t *) bh->b_data;
+       offset = sizeof(jbd2_journal_revoke_header_t);
        rcount = ext2fs_be32_to_cpu(header->r_count);
 
        if (!jbd2_revoke_block_csum_verify(journal, header))
                return -EFSBADCRC;
 
-       if (journal_has_csum_v2or3(journal))
+       if (jbd2_journal_has_csum_v2or3(journal))
                csum_size = sizeof(struct journal_revoke_tail);
        if (rcount > journal->j_blocksize - csum_size)
                return -EINVAL;
        max = rcount;
 
-       if (jfs_has_feature_64bit(journal))
+       if (jbd2_has_feature_64bit(journal))
                record_len = 8;
 
        while (offset + record_len <= max) {
@@ -883,7 +883,7 @@ static int scan_revoke_records(journal_t *journal, struct buffer_head *bh,
                else
                        blocknr = ext2fs_be64_to_cpu(* ((__u64 *) (bh->b_data+offset)));
                offset += record_len;
-               err = journal_set_revoke(journal, blocknr, sequence);
+               err = jbd2_journal_set_revoke(journal, blocknr, sequence);
                if (err)
                        return err;
                ++info->nr_revokes;
index d378479..44b3033 100644 (file)
@@ -183,7 +183,7 @@ static struct jbd2_revoke_record_s *find_revoke_record(journal_t *journal,
        return NULL;
 }
 
-void journal_destroy_revoke_caches(void)
+void jbd2_journal_destroy_revoke_caches(void)
 {
        if (jbd2_revoke_record_cache) {
                kmem_cache_destroy(jbd2_revoke_record_cache);
@@ -195,7 +195,7 @@ void journal_destroy_revoke_caches(void)
        }
 }
 
-int __init journal_init_revoke_caches(void)
+int __init jbd2_journal_init_revoke_caches(void)
 {
        J_ASSERT(!jbd2_revoke_record_cache);
        J_ASSERT(!jbd2_revoke_table_cache);
@@ -211,12 +211,12 @@ int __init journal_init_revoke_caches(void)
                goto table_cache_failure;
        return 0;
 table_cache_failure:
-       journal_destroy_revoke_caches();
+       jbd2_journal_destroy_revoke_caches();
 record_cache_failure:
                return -ENOMEM;
 }
 
-static struct jbd2_revoke_table_s *journal_init_revoke_table(int hash_size)
+static struct jbd2_revoke_table_s *jbd2_journal_init_revoke_table(int hash_size)
 {
        int shift = 0;
        int tmp = hash_size;
@@ -246,7 +246,7 @@ out:
        return table;
 }
 
-static void journal_destroy_revoke_table(struct jbd2_revoke_table_s *table)
+static void jbd2_journal_destroy_revoke_table(struct jbd2_revoke_table_s *table)
 {
        int i;
        struct list_head *hash_list;
@@ -261,16 +261,16 @@ static void journal_destroy_revoke_table(struct jbd2_revoke_table_s *table)
 }
 
 /* Initialise the revoke table for a given journal to a given size. */
-int journal_init_revoke(journal_t *journal, int hash_size)
+int jbd2_journal_init_revoke(journal_t *journal, int hash_size)
 {
        J_ASSERT(journal->j_revoke_table[0] == NULL);
        J_ASSERT(is_power_of_2(hash_size));
 
-       journal->j_revoke_table[0] = journal_init_revoke_table(hash_size);
+       journal->j_revoke_table[0] = jbd2_journal_init_revoke_table(hash_size);
        if (!journal->j_revoke_table[0])
                goto fail0;
 
-       journal->j_revoke_table[1] = journal_init_revoke_table(hash_size);
+       journal->j_revoke_table[1] = jbd2_journal_init_revoke_table(hash_size);
        if (!journal->j_revoke_table[1])
                goto fail1;
 
@@ -281,26 +281,26 @@ int journal_init_revoke(journal_t *journal, int hash_size)
        return 0;
 
 fail1:
-       journal_destroy_revoke_table(journal->j_revoke_table[0]);
+       jbd2_journal_destroy_revoke_table(journal->j_revoke_table[0]);
 fail0:
        return -ENOMEM;
 }
 
 /* Destroy a journal's revoke table.  The table must already be empty! */
-void journal_destroy_revoke(journal_t *journal)
+void jbd2_journal_destroy_revoke(journal_t *journal)
 {
        journal->j_revoke = NULL;
        if (journal->j_revoke_table[0])
-               journal_destroy_revoke_table(journal->j_revoke_table[0]);
+               jbd2_journal_destroy_revoke_table(journal->j_revoke_table[0]);
        if (journal->j_revoke_table[1])
-               journal_destroy_revoke_table(journal->j_revoke_table[1]);
+               jbd2_journal_destroy_revoke_table(journal->j_revoke_table[1]);
 }
 
 
 #ifdef __KERNEL__
 
 /*
- * journal_revoke: revoke a given buffer_head from the journal.  This
+ * jbd2_journal_revoke: revoke a given buffer_head from the journal.  This
  * prevents the block from being replayed during recovery if we take a
  * crash after this current transaction commits.  Any subsequent
  * metadata writes of the buffer in this transaction cancel the
@@ -312,18 +312,18 @@ void journal_destroy_revoke(journal_t *journal)
  * revoke before clearing the block bitmap when we are deleting
  * metadata.
  *
- * Revoke performs a journal_forget on any buffer_head passed in as a
+ * Revoke performs a jbd2_journal_forget on any buffer_head passed in as a
  * parameter, but does _not_ forget the buffer_head if the bh was only
  * found implicitly.
  *
  * bh_in may not be a journalled buffer - it may have come off
  * the hash tables without an attached journal_head.
  *
- * If bh_in is non-zero, journal_revoke() will decrement its b_count
+ * If bh_in is non-zero, jbd2_journal_revoke() will decrement its b_count
  * by one.
  */
 
-int journal_revoke(handle_t *handle, unsigned long long blocknr,
+int jbd2_journal_revoke(handle_t *handle, unsigned long long blocknr,
                   struct buffer_head *bh_in)
 {
        struct buffer_head *bh = NULL;
@@ -336,7 +336,7 @@ int journal_revoke(handle_t *handle, unsigned long long blocknr,
                BUFFER_TRACE(bh_in, "enter");
 
        journal = handle->h_transaction->t_journal;
-       if (!journal_set_features(journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)){
+       if (!jbd2_journal_set_features(journal, 0, 0, JBD2_FEATURE_INCOMPAT_REVOKE)){
                J_ASSERT (!"Cannot set revoke feature!");
                return -EINVAL;
        }
@@ -349,7 +349,7 @@ int journal_revoke(handle_t *handle, unsigned long long blocknr,
                if (bh)
                        BUFFER_TRACE(bh, "found on hash");
        }
-#ifdef JFS_EXPENSIVE_CHECKING
+#ifdef JBD2_EXPENSIVE_CHECKING
        else {
                struct buffer_head *bh2;
 
@@ -384,8 +384,8 @@ int journal_revoke(handle_t *handle, unsigned long long blocknr,
                set_buffer_revoked(bh);
                set_buffer_revokevalid(bh);
                if (bh_in) {
-                       BUFFER_TRACE(bh_in, "call journal_forget");
-                       journal_forget(handle, bh_in);
+                       BUFFER_TRACE(bh_in, "call jbd2_journal_forget");
+                       jbd2_journal_forget(handle, bh_in);
                } else {
                        BUFFER_TRACE(bh, "call brelse");
                        __brelse(bh);
@@ -401,7 +401,7 @@ int journal_revoke(handle_t *handle, unsigned long long blocknr,
 
 /*
  * Cancel an outstanding revoke.  For use only internally by the
- * journaling code (called from journal_get_write_access).
+ * journaling code (called from jbd2_journal_get_write_access).
  *
  * We trust buffer_revoked() on the buffer if the buffer is already
  * being journaled: if there is no revoke pending on the buffer, then we
@@ -414,7 +414,7 @@ int journal_revoke(handle_t *handle, unsigned long long blocknr,
  * do not trust the Revoked bit on buffers unless RevokeValid is also
  * set.
  */
-int journal_cancel_revoke(handle_t *handle, struct journal_head *jh)
+int jbd2_journal_cancel_revoke(handle_t *handle, struct journal_head *jh)
 {
        struct jbd2_revoke_record_s *record;
        journal_t *journal = handle->h_transaction->t_journal;
@@ -448,7 +448,7 @@ int journal_cancel_revoke(handle_t *handle, struct journal_head *jh)
                }
        }
 
-#ifdef JFS_EXPENSIVE_CHECKING
+#ifdef JBD2_EXPENSIVE_CHECKING
        /* There better not be one left behind by now! */
        record = find_revoke_record(journal, bh->b_blocknr);
        J_ASSERT_JH(jh, record == NULL);
@@ -504,7 +504,7 @@ void jbd2_clear_buffer_revoked_flags(journal_t *journal)
  * we do not want to suspend any processing until all revokes are
  * written -bzzz
  */
-void journal_switch_revoke_table(journal_t *journal)
+void jbd2_journal_switch_revoke_table(journal_t *journal)
 {
        int i;
 
@@ -521,7 +521,7 @@ void journal_switch_revoke_table(journal_t *journal)
  * Write revoke records to the journal for all entries in the current
  * revoke hash, deleting the entries as we go.
  */
-void journal_write_revoke_records(journal_t *journal,
+void jbd2_journal_write_revoke_records(journal_t *journal,
                                       transaction_t *transaction,
                                       struct list_head *log_bufs,
                                       int write_op)
@@ -579,7 +579,7 @@ static void write_one_revoke_record(journal_t *journal,
 
        /* If we are already aborting, this all becomes a noop.  We
            still need to go round the loop in
-           journal_write_revoke_records in order to free all of the
+           jbd2_journal_write_revoke_records in order to free all of the
            revoke records: only the IO to the journal is omitted. */
        if (is_journal_aborted(journal))
                return;
@@ -588,10 +588,10 @@ static void write_one_revoke_record(journal_t *journal,
        offset = *offsetp;
 
        /* Do we need to leave space at the end for a checksum? */
-       if (journal_has_csum_v2or3(journal))
+       if (jbd2_journal_has_csum_v2or3(journal))
                csum_size = sizeof(struct journal_revoke_tail);
 
-       if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT))
+       if (jbd2_has_feature_64bit(journal))
                sz = 8;
        else
                sz = 4;
@@ -605,23 +605,23 @@ static void write_one_revoke_record(journal_t *journal,
        }
 
        if (!descriptor) {
-               descriptor = journal_get_descriptor_buffer(journal);
+               descriptor = jbd2_journal_get_descriptor_buffer(journal);
                if (!descriptor)
                        return;
                header = (journal_header_t *)descriptor->b_data;
-               header->h_magic     = ext2fs_cpu_to_be32(JFS_MAGIC_NUMBER);
-               header->h_blocktype = ext2fs_cpu_to_be32(JFS_REVOKE_BLOCK);
+               header->h_magic     = ext2fs_cpu_to_be32(JBD2_MAGIC_NUMBER);
+               header->h_blocktype = ext2fs_cpu_to_be32(JBD2_REVOKE_BLOCK);
                header->h_sequence  = ext2fs_cpu_to_be32(transaction->t_tid);
 
                /* Record it so that we can wait for IO completion later */
                BUFFER_TRACE(descriptor, "file in log_bufs");
                jbd2_file_log_bh(log_bufs, descriptor);
 
-               offset = sizeof(journal_revoke_header_t);
+               offset = sizeof(jbd2_journal_revoke_header_t);
                *descriptorp = descriptor;
        }
 
-       if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) {
+       if (jbd2_has_feature_64bit(journal))
                * ((__be64 *)(&descriptor->b_data[offset])) =
                        cpu_to_be64(record->blocknr);
        else
@@ -637,7 +637,7 @@ static void jbd2_revoke_csum_set(journal_t *j, struct buffer_head *bh)
        struct journal_revoke_tail *tail;
        __u32 csum;
 
-       if (!journal_has_csum_v2or3(j))
+       if (!jbd2_journal_has_csum_v2or3(j))
                return;
 
        tail = (struct journal_revoke_tail *)(bh->b_data + j->j_blocksize -
@@ -658,14 +658,14 @@ static void flush_descriptor(journal_t *journal,
                             struct buffer_head *descriptor,
                             int offset, int write_op)
 {
-       journal_revoke_header_t *header;
+       jbd2_journal_revoke_header_t *header;
 
        if (is_journal_aborted(journal)) {
                put_bh(descriptor);
                return;
        }
 
-       header = (journal_revoke_header_t *)descriptor->b_data;
+       header = (jbd2_journal_revoke_header_t *)descriptor->b_data;
        header->r_count = ext2fs_cpu_to_be32(offset);
        jbd2_revoke_csum_set(journal, descriptor);
 
@@ -698,7 +698,7 @@ static void flush_descriptor(journal_t *journal,
  * single block.
  */
 
-int journal_set_revoke(journal_t *journal,
+int jbd2_journal_set_revoke(journal_t *journal,
                       unsigned long long blocknr,
                       tid_t sequence)
 {
@@ -722,7 +722,7 @@ int journal_set_revoke(journal_t *journal,
  * ones, but later transactions still need replayed.
  */
 
-int journal_test_revoke(journal_t *journal,
+int jbd2_journal_test_revoke(journal_t *journal,
                        unsigned long long blocknr,
                        tid_t sequence)
 {
@@ -741,7 +741,7 @@ int journal_test_revoke(journal_t *journal,
  * that it can be reused by the running filesystem.
  */
 
-void journal_clear_revoke(journal_t *journal)
+void jbd2_journal_clear_revoke(journal_t *journal)
 {
        int i;
        struct list_head *hash_list;
index ad0d7f8..965ba33 100644 (file)
@@ -121,18 +121,18 @@ static struct feature feature_list[] = {
 };
 
 static struct feature jrnl_feature_list[] = {
-       {       E2P_FEATURE_COMPAT, JFS_FEATURE_COMPAT_CHECKSUM,
+       {       E2P_FEATURE_COMPAT, JBD2_FEATURE_COMPAT_CHECKSUM,
                        "journal_checksum" },
 
-       {       E2P_FEATURE_INCOMPAT, JFS_FEATURE_INCOMPAT_REVOKE,
+       {       E2P_FEATURE_INCOMPAT, JBD2_FEATURE_INCOMPAT_REVOKE,
                        "journal_incompat_revoke" },
-       {       E2P_FEATURE_INCOMPAT, JFS_FEATURE_INCOMPAT_64BIT,
+       {       E2P_FEATURE_INCOMPAT, JBD2_FEATURE_INCOMPAT_64BIT,
                        "journal_64bit" },
-       {       E2P_FEATURE_INCOMPAT, JFS_FEATURE_INCOMPAT_ASYNC_COMMIT,
+       {       E2P_FEATURE_INCOMPAT, JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT,
                        "journal_async_commit" },
-       {       E2P_FEATURE_INCOMPAT, JFS_FEATURE_INCOMPAT_CSUM_V2,
+       {       E2P_FEATURE_INCOMPAT, JBD2_FEATURE_INCOMPAT_CSUM_V2,
                        "journal_checksum_v2" },
-       {       E2P_FEATURE_INCOMPAT, JFS_FEATURE_INCOMPAT_CSUM_V3,
+       {       E2P_FEATURE_INCOMPAT, JBD2_FEATURE_INCOMPAT_CSUM_V3,
                        "journal_checksum_v3" },
        {       0, 0, 0 },
 };
index c99126b..4ffe9b6 100644 (file)
@@ -89,19 +89,19 @@ void e2p_list_journal_super(FILE *f, char *journal_sb_buf,
                (unsigned int)ntohl(jsb->s_start));
        if (nr_users != 1)
                fprintf(f, "Journal number of users:  %u\n", nr_users);
-       if (jsb->s_feature_compat & e2p_be32(JFS_FEATURE_COMPAT_CHECKSUM))
+       if (jsb->s_feature_compat & e2p_be32(JBD2_FEATURE_COMPAT_CHECKSUM))
                fprintf(f, "%s", "Journal checksum type:    crc32\n");
        if ((jsb->s_feature_incompat &
-            e2p_be32(JFS_FEATURE_INCOMPAT_CSUM_V3)) ||
+            e2p_be32(JBD2_FEATURE_INCOMPAT_CSUM_V3)) ||
            (jsb->s_feature_incompat &
-            e2p_be32(JFS_FEATURE_INCOMPAT_CSUM_V2)))
+            e2p_be32(JBD2_FEATURE_INCOMPAT_CSUM_V2)))
                fprintf(f, "Journal checksum type:    %s\n"
                        "Journal checksum:         0x%08x\n",
                        journal_checksum_type_str(jsb->s_checksum_type),
                        e2p_be32(jsb->s_checksum));
        if ((nr_users > 1) ||
            !e2p_is_null_uuid(&jsb->s_users[0])) {
-               for (i=0; i < nr_users && i < JFS_USERS_MAX; i++) {
+               for (i=0; i < nr_users && i < JBD2_USERS_MAX; i++) {
                        printf(i ? "                          %s\n"
                               : "Journal users:            %s\n",
                               e2p_uuid2str(&jsb->s_users[i * UUID_SIZE]));
index f90f3d4..42c9e30 100644 (file)
@@ -33,11 +33,9 @@ struct buffer_head;
 struct inode;
 
 #define GFP_KERNEL     0
-#define JFS_TAG_SIZE32 JBD_TAG_SIZE32
-#define JFS_BARRIER    0
+#define JBD2_TAG_SIZE32        JBD_TAG_SIZE32
+#define JBD2_BARRIER   0
 typedef __u64 u64;
-#define JFS_CRC32_CHKSUM       JBD2_CRC32_CHKSUM
-#define JFS_CRC32_CHKSUM_SIZE  JBD2_CRC32_CHKSUM_SIZE
 #define put_bh(x)      brelse(x)
 #define be64_to_cpu(x) ext2fs_be64_to_cpu(x)
 
index a7507b5..5e535b4 100644 (file)
@@ -73,13 +73,13 @@ extern void * __jbd_kmalloc (char *where, size_t size, int flags, int retry);
 #define jbd_rep_kmalloc(size, flags) \
        __jbd_kmalloc(__FUNCTION__, (size), (flags), 1)
 
-#define JFS_MIN_JOURNAL_BLOCKS 1024
+#define JBD2_MIN_JOURNAL_BLOCKS 1024
 
 /*
  * Internal structures used by the logging mechanism:
  */
 
-#define JFS_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */
+#define JBD2_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */
 
 /*
  * On-disk structures
@@ -89,11 +89,11 @@ extern void * __jbd_kmalloc (char *where, size_t size, int flags, int retry);
  * Descriptor block types:
  */
 
-#define JFS_DESCRIPTOR_BLOCK   1
-#define JFS_COMMIT_BLOCK       2
-#define JFS_SUPERBLOCK_V1      3
-#define JFS_SUPERBLOCK_V2      4
-#define JFS_REVOKE_BLOCK       5
+#define JBD2_DESCRIPTOR_BLOCK  1
+#define JBD2_COMMIT_BLOCK      2
+#define JBD2_SUPERBLOCK_V1     3
+#define JBD2_SUPERBLOCK_V2     4
+#define JBD2_REVOKE_BLOCK      5
 
 /*
  * Standard header for all descriptor blocks:
@@ -166,7 +166,7 @@ typedef struct journal_block_tag_s
 } journal_block_tag_t;
 
 /* Tail of descriptor block, for checksumming */
-struct journal_block_tail {
+struct jbd2_journal_block_tail {
        __be32          t_checksum;
 };
 
@@ -178,7 +178,7 @@ typedef struct journal_revoke_header_s
 {
        journal_header_t r_header;
        int              r_count;       /* Count of bytes used in the block */
-} journal_revoke_header_t;
+} jbd2_journal_revoke_header_t;
 
 /* Tail of revoke block, for checksumming */
 struct journal_revoke_tail {
@@ -186,15 +186,15 @@ struct journal_revoke_tail {
 };
 
 /* Definitions for the journal tag flags word: */
-#define JFS_FLAG_ESCAPE                1       /* on-disk block is escaped */
-#define JFS_FLAG_SAME_UUID     2       /* block has same uuid as previous */
-#define JFS_FLAG_DELETED       4       /* block deleted by this transaction */
-#define JFS_FLAG_LAST_TAG      8       /* last tag in this descriptor block */
+#define JBD2_FLAG_ESCAPE               1       /* on-disk block is escaped */
+#define JBD2_FLAG_SAME_UUID    2       /* block has same uuid as previous */
+#define JBD2_FLAG_DELETED      4       /* block deleted by this transaction */
+#define JBD2_FLAG_LAST_TAG     8       /* last tag in this descriptor block */
 
 
 #define UUID_SIZE 16
-#define JFS_USERS_MAX 48
-#define JFS_USERS_SIZE (UUID_SIZE * JFS_USERS_MAX)
+#define JBD2_USERS_MAX 48
+#define JBD2_USERS_SIZE (UUID_SIZE * JBD2_USERS_MAX)
 /*
  * The journal superblock.  All fields are in big-endian byte order.
  */
@@ -242,41 +242,41 @@ typedef struct journal_superblock_s
        __u32   s_checksum;             /* crc32c(superblock) */
 
 /* 0x0100 */
-       __u8    s_users[JFS_USERS_SIZE];                /* ids of all fs'es sharing the log */
+       __u8    s_users[JBD2_USERS_SIZE];               /* ids of all fs'es sharing the log */
 
 /* 0x0400 */
 } journal_superblock_t;
 
-#define JFS_HAS_COMPAT_FEATURE(j,mask)                                 \
+#define JBD2_HAS_COMPAT_FEATURE(j,mask)                                        \
        ((j)->j_format_version >= 2 &&                                  \
         ((j)->j_superblock->s_feature_compat & ext2fs_cpu_to_be32((mask))))
-#define JFS_HAS_RO_COMPAT_FEATURE(j,mask)                              \
+#define JBD2_HAS_RO_COMPAT_FEATURE(j,mask)                             \
        ((j)->j_format_version >= 2 &&                                  \
         ((j)->j_superblock->s_feature_ro_compat & ext2fs_cpu_to_be32((mask))))
-#define JFS_HAS_INCOMPAT_FEATURE(j,mask)                               \
+#define JBD2_HAS_INCOMPAT_FEATURE(j,mask)                              \
        ((j)->j_format_version >= 2 &&                                  \
         ((j)->j_superblock->s_feature_incompat & ext2fs_cpu_to_be32((mask))))
 
-#define JFS_FEATURE_COMPAT_CHECKSUM            0x00000001
+#define JBD2_FEATURE_COMPAT_CHECKSUM           0x00000001
 
-#define JFS_FEATURE_INCOMPAT_REVOKE            0x00000001
-#define JFS_FEATURE_INCOMPAT_64BIT             0x00000002
-#define JFS_FEATURE_INCOMPAT_ASYNC_COMMIT      0x00000004
-#define JFS_FEATURE_INCOMPAT_CSUM_V2           0x00000008
-#define JFS_FEATURE_INCOMPAT_CSUM_V3           0x00000010
+#define JBD2_FEATURE_INCOMPAT_REVOKE           0x00000001
+#define JBD2_FEATURE_INCOMPAT_64BIT            0x00000002
+#define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT     0x00000004
+#define JBD2_FEATURE_INCOMPAT_CSUM_V2          0x00000008
+#define JBD2_FEATURE_INCOMPAT_CSUM_V3          0x00000010
 
 /* Features known to this kernel version: */
-#define JFS_KNOWN_COMPAT_FEATURES      0
-#define JFS_KNOWN_ROCOMPAT_FEATURES    0
-#define JFS_KNOWN_INCOMPAT_FEATURES    (JFS_FEATURE_INCOMPAT_REVOKE|\
-                                        JFS_FEATURE_INCOMPAT_ASYNC_COMMIT|\
-                                        JFS_FEATURE_INCOMPAT_64BIT|\
-                                        JFS_FEATURE_INCOMPAT_CSUM_V2|\
-                                        JFS_FEATURE_INCOMPAT_CSUM_V3)
+#define JBD2_KNOWN_COMPAT_FEATURES     0
+#define JBD2_KNOWN_ROCOMPAT_FEATURES   0
+#define JBD2_KNOWN_INCOMPAT_FEATURES   (JBD2_FEATURE_INCOMPAT_REVOKE|\
+                                        JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT| \
+                                        JBD2_FEATURE_INCOMPAT_64BIT|\
+                                        JBD2_FEATURE_INCOMPAT_CSUM_V2| \
+                                        JBD2_FEATURE_INCOMPAT_CSUM_V3)
 
 #ifdef NO_INLINE_FUNCS
 extern size_t journal_tag_bytes(journal_t *journal);
-extern int journal_has_csum_v2or3(journal_t *journal);
+extern int jbd2_journal_has_csum_v2or3(journal_t *journal);
 extern int tid_gt(tid_t x, tid_t y) EXT2FS_ATTR((unused));
 extern int tid_geq(tid_t x, tid_t y) EXT2FS_ATTR((unused));
 #endif
@@ -301,94 +301,94 @@ extern int tid_geq(tid_t x, tid_t y) EXT2FS_ATTR((unused));
 #endif /* INCLUDE_INLINE_FUNCS */
 
 /* journal feature predicate functions */
-#define JFS_FEATURE_COMPAT_FUNCS(name, flagname) \
-_INLINE_ int jfs_has_feature_##name(journal_t *j); \
-_INLINE_ int jfs_has_feature_##name(journal_t *j) \
+#define JBD2_FEATURE_COMPAT_FUNCS(name, flagname) \
+_INLINE_ int jbd2_has_feature_##name(journal_t *j); \
+_INLINE_ int jbd2_has_feature_##name(journal_t *j) \
 { \
        return ((j)->j_format_version >= 2 && \
                ((j)->j_superblock->s_feature_compat & \
-                ext2fs_cpu_to_be32(JFS_FEATURE_COMPAT_##flagname)) != 0); \
+                ext2fs_cpu_to_be32(JBD2_FEATURE_COMPAT_##flagname)) != 0); \
 } \
-_INLINE_ void jfs_set_feature_##name(journal_t *j); \
-_INLINE_ void jfs_set_feature_##name(journal_t *j) \
+_INLINE_ void jbd2_set_feature_##name(journal_t *j); \
+_INLINE_ void jbd2_set_feature_##name(journal_t *j) \
 { \
        (j)->j_superblock->s_feature_compat |= \
-               ext2fs_cpu_to_be32(JFS_FEATURE_COMPAT_##flagname); \
+               ext2fs_cpu_to_be32(JBD2_FEATURE_COMPAT_##flagname); \
 } \
-_INLINE_ void jfs_clear_feature_##name(journal_t *j); \
-_INLINE_ void jfs_clear_feature_##name(journal_t *j) \
+_INLINE_ void jbd2_clear_feature_##name(journal_t *j); \
+_INLINE_ void jbd2_clear_feature_##name(journal_t *j) \
 { \
        (j)->j_superblock->s_feature_compat &= \
-               ~ext2fs_cpu_to_be32(JFS_FEATURE_COMPAT_##flagname); \
+               ~ext2fs_cpu_to_be32(JBD2_FEATURE_COMPAT_##flagname); \
 }
 
-#define JFS_FEATURE_RO_COMPAT_FUNCS(name, flagname) \
-_INLINE_ int jfs_has_feature_##name(journal_t *j);     \
-_INLINE_ int jfs_has_feature_##name(journal_t *j) \
+#define JBD2_FEATURE_RO_COMPAT_FUNCS(name, flagname) \
+_INLINE_ int jbd2_has_feature_##name(journal_t *j);    \
+_INLINE_ int jbd2_has_feature_##name(journal_t *j) \
 { \
        return ((j)->j_format_version >= 2 && \
                ((j)->j_superblock->s_feature_ro_compat & \
-                ext2fs_cpu_to_be32(JFS_FEATURE_RO_COMPAT_##flagname)) != 0); \
+                ext2fs_cpu_to_be32(JBD2_FEATURE_RO_COMPAT_##flagname)) != 0); \
 } \
-_INLINE_ void jfs_set_feature_##name(journal_t *j); \
-_INLINE_ void jfs_set_feature_##name(journal_t *j) \
+_INLINE_ void jbd2_set_feature_##name(journal_t *j); \
+_INLINE_ void jbd2_set_feature_##name(journal_t *j) \
 { \
        (j)->j_superblock->s_feature_ro_compat |= \
-               ext2fs_cpu_to_be32(JFS_FEATURE_RO_COMPAT_##flagname); \
+               ext2fs_cpu_to_be32(JBD2_FEATURE_RO_COMPAT_##flagname); \
 } \
-_INLINE_ void jfs_clear_feature_##name(journal_t *j); \
-_INLINE_ void jfs_clear_feature_##name(journal_t *j) \
+_INLINE_ void jbd2_clear_feature_##name(journal_t *j); \
+_INLINE_ void jbd2_clear_feature_##name(journal_t *j) \
 { \
        (j)->j_superblock->s_feature_ro_compat &= \
-               ~ext2fs_cpu_to_be32(JFS_FEATURE_RO_COMPAT_##flagname); \
+               ~ext2fs_cpu_to_be32(JBD2_FEATURE_RO_COMPAT_##flagname); \
 }
 
-#define JFS_FEATURE_INCOMPAT_FUNCS(name, flagname) \
-_INLINE_ int jfs_has_feature_##name(journal_t *j); \
-_INLINE_ int jfs_has_feature_##name(journal_t *j) \
+#define JBD2_FEATURE_INCOMPAT_FUNCS(name, flagname) \
+_INLINE_ int jbd2_has_feature_##name(journal_t *j); \
+_INLINE_ int jbd2_has_feature_##name(journal_t *j) \
 { \
        return ((j)->j_format_version >= 2 && \
                ((j)->j_superblock->s_feature_incompat & \
-                ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_##flagname)) != 0); \
+                ext2fs_cpu_to_be32(JBD2_FEATURE_INCOMPAT_##flagname)) != 0); \
 } \
-_INLINE_ void jfs_set_feature_##name(journal_t *j); \
-_INLINE_ void jfs_set_feature_##name(journal_t *j) \
+_INLINE_ void jbd2_set_feature_##name(journal_t *j); \
+_INLINE_ void jbd2_set_feature_##name(journal_t *j) \
 { \
        (j)->j_superblock->s_feature_incompat |= \
-               ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_##flagname); \
+               ext2fs_cpu_to_be32(JBD2_FEATURE_INCOMPAT_##flagname); \
 } \
-_INLINE_ void jfs_clear_feature_##name(journal_t *j); \
-_INLINE_ void jfs_clear_feature_##name(journal_t *j) \
+_INLINE_ void jbd2_clear_feature_##name(journal_t *j); \
+_INLINE_ void jbd2_clear_feature_##name(journal_t *j) \
 { \
        (j)->j_superblock->s_feature_incompat &= \
-               ~ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_##flagname); \
+               ~ext2fs_cpu_to_be32(JBD2_FEATURE_INCOMPAT_##flagname); \
 }
 
 #else
-#define JFS_FEATURE_COMPAT_FUNCS(name, flagname) \
-extern int jfs_has_feature_##name(journal_t *j); \
-extern void jfs_set_feature_##name(journal_t *j); \
-extern void jfs_clear_feature_##name(journal_t *j);
+#define JBD2_FEATURE_COMPAT_FUNCS(name, flagname) \
+extern int jbd2_has_feature_##name(journal_t *j); \
+extern void jbd2_set_feature_##name(journal_t *j); \
+extern void jbd2_clear_feature_##name(journal_t *j);
 
-#define JFS_FEATURE_RO_COMPAT_FUNCS(name, flagname) \
-extern int jfs_has_feature_##name(journal_t *j); \
-extern void jfs_set_feature_##name(journal_t *j); \
-extern void jfs_clear_feature_##name(journal_t *j);
+#define JBD2_FEATURE_RO_COMPAT_FUNCS(name, flagname) \
+extern int jbd2_has_feature_##name(journal_t *j); \
+extern void jbd2_set_feature_##name(journal_t *j); \
+extern void jbd2_clear_feature_##name(journal_t *j);
 
-#define JFS_FEATURE_INCOMPAT_FUNCS(name, flagname) \
-extern int jfs_has_feature_##name(journal_t *j); \
-extern void jfs_set_feature_##name(journal_t *j); \
-extern void jfs_clear_feature_##name(journal_t *j);
+#define JBD2_FEATURE_INCOMPAT_FUNCS(name, flagname) \
+extern int jbd2_has_feature_##name(journal_t *j); \
+extern void jbd2_set_feature_##name(journal_t *j); \
+extern void jbd2_clear_feature_##name(journal_t *j);
 
 #endif /* (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) */
 
-JFS_FEATURE_COMPAT_FUNCS(checksum,             CHECKSUM)
+JBD2_FEATURE_COMPAT_FUNCS(checksum,            CHECKSUM)
 
-JFS_FEATURE_INCOMPAT_FUNCS(revoke,             REVOKE)
-JFS_FEATURE_INCOMPAT_FUNCS(64bit,              64BIT)
-JFS_FEATURE_INCOMPAT_FUNCS(async_commit,       ASYNC_COMMIT)
-JFS_FEATURE_INCOMPAT_FUNCS(csum2,              CSUM_V2)
-JFS_FEATURE_INCOMPAT_FUNCS(csum3,              CSUM_V3)
+JBD2_FEATURE_INCOMPAT_FUNCS(revoke,            REVOKE)
+JBD2_FEATURE_INCOMPAT_FUNCS(64bit,             64BIT)
+JBD2_FEATURE_INCOMPAT_FUNCS(async_commit,      ASYNC_COMMIT)
+JBD2_FEATURE_INCOMPAT_FUNCS(csum2,             CSUM_V2)
+JBD2_FEATURE_INCOMPAT_FUNCS(csum3,             CSUM_V3)
 
 #if (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
 /*
@@ -398,23 +398,23 @@ _INLINE_ size_t journal_tag_bytes(journal_t *journal)
 {
        size_t sz;
 
-       if (jfs_has_feature_csum3(journal))
+       if (jbd2_has_feature_csum3(journal))
                return sizeof(journal_block_tag3_t);
 
        sz = sizeof(journal_block_tag_t);
 
-       if (jfs_has_feature_csum2(journal))
+       if (jbd2_has_feature_csum2(journal))
                sz += sizeof(__u16);
 
-       if (jfs_has_feature_64bit(journal))
+       if (jbd2_has_feature_64bit(journal))
                return sz;
 
        return sz - sizeof(__u32);
 }
 
-_INLINE_ int journal_has_csum_v2or3(journal_t *journal)
+_INLINE_ int jbd2_journal_has_csum_v2or3(journal_t *journal)
 {
-       if (jfs_has_feature_csum2(journal) || jfs_has_feature_csum3(journal))
+       if (jbd2_has_feature_csum2(journal) || jbd2_has_feature_csum3(journal))
                return 1;
 
        return 0;
index a90e80e..f47f71e 100644 (file)
@@ -50,7 +50,7 @@ errcode_t ext2fs_create_journal_superblock(ext2_filsys fs,
        errcode_t               retval;
        journal_superblock_t    *jsb;
 
-       if (num_blocks < JFS_MIN_JOURNAL_BLOCKS)
+       if (num_blocks < JBD2_MIN_JOURNAL_BLOCKS)
                return EXT2_ET_JOURNAL_TOO_SMALL;
 
        if ((retval = ext2fs_get_mem(fs->blocksize, &jsb)))
@@ -58,11 +58,11 @@ errcode_t ext2fs_create_journal_superblock(ext2_filsys fs,
 
        memset (jsb, 0, fs->blocksize);
 
-       jsb->s_header.h_magic = htonl(JFS_MAGIC_NUMBER);
+       jsb->s_header.h_magic = htonl(JBD2_MAGIC_NUMBER);
        if (flags & EXT2_MKJOURNAL_V1_SUPER)
-               jsb->s_header.h_blocktype = htonl(JFS_SUPERBLOCK_V1);
+               jsb->s_header.h_blocktype = htonl(JBD2_SUPERBLOCK_V1);
        else
-               jsb->s_header.h_blocktype = htonl(JFS_SUPERBLOCK_V2);
+               jsb->s_header.h_blocktype = htonl(JBD2_SUPERBLOCK_V2);
        jsb->s_blocksize = htonl(fs->blocksize);
        jsb->s_maxlen = htonl(num_blocks);
        jsb->s_nr_users = htonl(1);
@@ -392,8 +392,8 @@ errcode_t ext2fs_add_journal_device(ext2_filsys fs, ext2_filsys journal_dev)
                return retval;
 
        jsb = (journal_superblock_t *) buf;
-       if ((jsb->s_header.h_magic != (unsigned) ntohl(JFS_MAGIC_NUMBER)) ||
-           (jsb->s_header.h_blocktype != (unsigned) ntohl(JFS_SUPERBLOCK_V2)))
+       if ((jsb->s_header.h_magic != (unsigned) ntohl(JBD2_MAGIC_NUMBER)) ||
+           (jsb->s_header.h_blocktype != (unsigned) ntohl(JBD2_SUPERBLOCK_V2)))
                return EXT2_ET_NO_JOURNAL_SB;
 
        if (ntohl(jsb->s_blocksize) != (unsigned long) fs->blocksize)
@@ -401,7 +401,7 @@ errcode_t ext2fs_add_journal_device(ext2_filsys fs, ext2_filsys journal_dev)
 
        /* Check and see if this filesystem has already been added */
        nr_users = ntohl(jsb->s_nr_users);
-       if (nr_users > JFS_USERS_MAX)
+       if (nr_users > JBD2_USERS_MAX)
                return EXT2_ET_CORRUPT_JOURNAL_SB;
        for (i=0; i < nr_users; i++) {
                if (memcmp(fs->super->s_uuid,
@@ -572,7 +572,7 @@ main(int argc, char **argv)
                exit(1);
        }
 
-       retval = ext2fs_add_journal_inode(fs, JFS_MIN_JOURNAL_BLOCKS, 0);
+       retval = ext2fs_add_journal_inode(fs, JBD2_MIN_JOURNAL_BLOCKS, 0);
        if (retval) {
                com_err(argv[0], retval, "while adding journal to %s",
                        device_name);
index 18148e2..9a6f586 100644 (file)
@@ -387,7 +387,7 @@ static void print_inline_journal_information(ext2_filsys fs)
        }
        ext2fs_file_close(journal_file);
        jsb = (journal_superblock_t *) buf;
-       if (be32_to_cpu(jsb->s_header.h_magic) != JFS_MAGIC_NUMBER) {
+       if (be32_to_cpu(jsb->s_header.h_magic) != JBD2_MAGIC_NUMBER) {
                fprintf(stderr, "%s",
                        _("Journal superblock magic number invalid!\n"));
                exit(1);
@@ -410,9 +410,9 @@ static void print_journal_information(ext2_filsys fs)
                exit(1);
        }
        jsb = (journal_superblock_t *) buf;
-       if ((jsb->s_header.h_magic != (unsigned) ntohl(JFS_MAGIC_NUMBER)) ||
+       if ((jsb->s_header.h_magic != (unsigned) ntohl(JBD2_MAGIC_NUMBER)) ||
            (jsb->s_header.h_blocktype !=
-            (unsigned) ntohl(JFS_SUPERBLOCK_V2))) {
+            (unsigned) ntohl(JBD2_SUPERBLOCK_V2))) {
                com_err(program_name, 0, "%s",
                        _("Couldn't find journal superblock magic numbers"));
                exit(1);
index 8368a73..9a3ddff 100644 (file)
@@ -222,8 +222,8 @@ static int get_journal_sb(ext2_filsys jfs, char buf[SUPERBLOCK_SIZE])
        }
 
        jsb = (journal_superblock_t *) buf;
-       if ((jsb->s_header.h_magic != (unsigned)ntohl(JFS_MAGIC_NUMBER)) ||
-           (jsb->s_header.h_blocktype != (unsigned)ntohl(JFS_SUPERBLOCK_V2))) {
+       if ((jsb->s_header.h_magic != (unsigned)ntohl(JBD2_MAGIC_NUMBER)) ||
+           (jsb->s_header.h_blocktype != (unsigned)ntohl(JBD2_SUPERBLOCK_V2))) {
                fputs(_("Journal superblock not found!\n"), stderr);
                return EXT2_ET_BAD_MAGIC;
        }
@@ -231,7 +231,7 @@ static int get_journal_sb(ext2_filsys jfs, char buf[SUPERBLOCK_SIZE])
        return 0;
 }
 
-static __u8 *journal_user(__u8 uuid[UUID_SIZE], __u8 s_users[JFS_USERS_SIZE],
+static __u8 *journal_user(__u8 uuid[UUID_SIZE], __u8 s_users[JBD2_USERS_SIZE],
                          int nr_users)
 {
        int i;
@@ -296,7 +296,7 @@ static int remove_journal_device(ext2_filsys fs)
        jsb = (journal_superblock_t *) buf;
        /* Find the filesystem UUID */
        nr_users = ntohl(jsb->s_nr_users);
-       if (nr_users > JFS_USERS_MAX) {
+       if (nr_users > JBD2_USERS_MAX) {
                fprintf(stderr, _("Journal superblock is corrupted, nr_users\n"
                                 "is too high (%d).\n"), nr_users);
                commit_remove_journal = 1;
@@ -2813,7 +2813,7 @@ fs_update_journal_user(struct ext2_super_block *sb, __u8 old_uuid[UUID_SIZE])
        jsb = (journal_superblock_t *) buf;
        /* Find the filesystem UUID */
        nr_users = ntohl(jsb->s_nr_users);
-       if (nr_users > JFS_USERS_MAX) {
+       if (nr_users > JBD2_USERS_MAX) {
                fprintf(stderr, _("Journal superblock is corrupted, nr_users\n"
                                 "is too high (%d).\n"), nr_users);
                return EXT2_ET_CORRUPT_JOURNAL_SB;
index 36a7699..8b6545a 100644 (file)
@@ -1,5 +1,5 @@
 test_filesys: recovering journal
-JBD2: Invalid checksum recovering block 1090 in log
+JBD2: Invalid checksum recovering data block 1090 in log
 Journal checksum error found in test_filesys
 Pass 1: Checking inodes, blocks, and sizes
 Pass 2: Checking directory structure