# 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' \
__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]);
/* 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;
}
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);
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;
/* 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;
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;
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;
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;
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",
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
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",
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;
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);
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;
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,
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",
/* 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",
/* 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;
errcode_t err;
if (revoke_len > 0) {
- jfs_set_feature_revoke(journal);
+ jbd2_set_feature_revoke(journal);
mark_buffer_dirty(journal->j_sb_buffer);
}
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);
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;
}
/* 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);
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;
}
* 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:
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);
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);
}
}
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;
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;
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)),
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;
{
__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);
{
__u32 crc;
- if (!journal_has_csum_v2or3(j))
+ if (!jbd2_journal_has_csum_v2or3(j))
return 0;
crc = ext2fs_journal_sb_csum(jsb);
* 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;
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;
}
#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
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 ||
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))
* 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
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));
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;
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;
}
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;
}
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;
if (retval)
goto errout;
- retval = journal_init_revoke(journal, 1024);
+ retval = jbd2_journal_init_revoke(journal, 1024);
if (retval)
goto errout;
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;
}
{
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;
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);
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 -
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);
__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);
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";
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);
}
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;
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;
}
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);
{
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);
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 "
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,
++blocknr;
WRAP(jsb, blocknr);
- } while (!(tag_flags & JFS_FLAG_LAST_TAG));
+ } while (!(tag_flags & JBD2_FLAG_LAST_TAG));
*blockp = blocknr;
}
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);
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) {
/*
* 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[]);
#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 */
#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 */
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;
{
__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);
{
__u32 crc;
- if (!journal_has_csum_v2or3(j))
+ if (!jbd2_journal_has_csum_v2or3(j))
return 0;
crc = e2fsck_journal_sb_csum(jsb);
* 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;
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;
}
#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;
}
}
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 ||
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))
* 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
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));
* 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 */
clear_problem_context(&pctx);
- journal_init_revoke_caches();
+ jbd2_journal_init_revoke_caches();
retval = e2fsck_get_journal(ctx, &journal);
if (retval)
return retval;
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;
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;
}
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",
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",
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);
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)];
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;
}
} 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
* 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;
* 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;
}
/**
- * 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
* 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;
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,
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;
}
__u32 provided;
__u32 calculated;
- if (!journal_has_csum_v2or3(j))
+ if (!jbd2_journal_has_csum_v2or3(j))
return 1;
h = buf;
__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);
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;
}
* 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)) {
* 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,
/* 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);
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;
}
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));
}
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 ?
*
* 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;
}
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 &&
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);
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);
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) {
__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 -
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) {
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;
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);
}
}
-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);
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;
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;
}
/* 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;
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
* 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;
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;
}
if (bh)
BUFFER_TRACE(bh, "found on hash");
}
-#ifdef JFS_EXPENSIVE_CHECKING
+#ifdef JBD2_EXPENSIVE_CHECKING
else {
struct buffer_head *bh2;
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);
/*
* 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
* 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;
}
}
-#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);
* 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;
* 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)
/* 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;
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;
}
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
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 -
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);
* single block.
*/
-int journal_set_revoke(journal_t *journal,
+int jbd2_journal_set_revoke(journal_t *journal,
unsigned long long blocknr,
tid_t sequence)
{
* 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)
{
* 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;
};
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 },
};
(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]));
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)
#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
* 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:
} journal_block_tag_t;
/* Tail of descriptor block, for checksumming */
-struct journal_block_tail {
+struct jbd2_journal_block_tail {
__be32 t_checksum;
};
{
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 {
};
/* 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.
*/
__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
#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))
/*
{
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;
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)))
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);
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)
/* 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,
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);
}
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);
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);
}
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;
}
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;
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;
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;
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