/* 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))
- csum_size = sizeof(struct journal_revoke_tail);
+ if (jbd2_journal_has_csum_v2or3(trans->journal))
+ csum_size = sizeof(struct jbd2_journal_block_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))
- bs -= sizeof(struct journal_revoke_tail);
- sz = jfs_has_feature_64bit(journal) ? sizeof(__u64) : sizeof(__u32);
+ if (jbd2_journal_has_csum_v2or3(journal))
+ bs -= sizeof(struct jbd2_journal_block_tail);
+ 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)),