diff -uNr linux-2.4.18.o1/fs/reiserfs/bitmap.c linux-2.4.18.o/fs/reiserfs/bitmap.c
--- linux-2.4.18.o1/fs/reiserfs/bitmap.c Thu Feb 28 18:52:05 2002
+++ linux-2.4.18.o/fs/reiserfs/bitmap.c Thu Feb 28 18:48:51 2002
@@ -400,8 +400,8 @@
goto free_and_return ;
}
search_start = new_block ;
- if (search_start >= reiserfs_get_journal_block(s) &&
- search_start < (reiserfs_get_journal_block(s) + JOURNAL_BLOCK_COUNT)) {
+ if (search_start >= SB_JOURNAL_BLOCK (s) &&
+ search_start < (SB_JOURNAL_BLOCK (s) + SB_JOURNAL_SIZE(s))) {
reiserfs_warning("vs-4130: reiserfs_new_blocknrs: trying to allocate log block %lu\n",
search_start) ;
search_start++ ;
@@ -522,7 +522,7 @@
* no disk space returns
*/
- if ( (p_s_inode->i_size < 4 * 4096) ||
+ if ( (p_s_inode->i_size < 4 * th->t_super->s_blocksize) ||
!(S_ISREG(p_s_inode->i_mode)) )
{
if ( search_start < border
diff -uNr linux-2.4.18.o1/fs/reiserfs/journal.c linux-2.4.18.o/fs/reiserfs/journal.c
--- linux-2.4.18.o1/fs/reiserfs/journal.c Thu Feb 28 18:52:05 2002
+++ linux-2.4.18.o/fs/reiserfs/journal.c Thu Feb 28 18:51:27 2002
@@ -672,7 +672,7 @@
atomic_set(&(jl->j_commit_flushing), 1) ;
- if (jl->j_len > JOURNAL_TRANS_MAX) {
+ if (jl->j_len > SB_JOURNAL_TRANS_MAX(s)) {
reiserfs_panic(s, "journal-512: flush_commit_list: length is %lu, list number %d\n", jl->j_len, jl - SB_JOURNAL_LIST(s)) ;
return 0 ;
}
@@ -686,7 +686,7 @@
retry:
count = 0 ;
for (i = 0 ; atomic_read(&(jl->j_commit_left)) > 1 && i < (jl->j_len + 1) ; i++) { /* everything but commit_bh */
- bn = reiserfs_get_journal_block(s) + (jl->j_start+i) % JOURNAL_BLOCK_COUNT;
+ bn = SB_JOURNAL_BLOCK(s) + (jl->j_start+i) % SB_JOURNAL_SIZE(s) ;
tbh = sb_get_hash_table(s, bn) ;
/* kill this sanity check */
@@ -715,7 +715,7 @@
if (count > 0) {
for (i = 0 ; atomic_read(&(jl->j_commit_left)) > 1 &&
i < (jl->j_len + 1) ; i++) { /* everything but commit_bh */
- bn = reiserfs_get_journal_block(s) + (jl->j_start + i) % JOURNAL_BLOCK_COUNT ;
+ bn = SB_JOURNAL_BLOCK(s) + (jl->j_start + i) % SB_JOURNAL_SIZE(s) ;
tbh = sb_get_hash_table(s, bn) ;
wait_on_buffer(tbh) ;
@@ -931,7 +931,7 @@
atomic_set(&(jl->j_flushing), 1) ;
count = 0 ;
- if (j_len_saved > JOURNAL_TRANS_MAX) {
+ if (j_len_saved > SB_JOURNAL_TRANS_MAX(s)) {
reiserfs_panic(s, "journal-715: flush_journal_list, length is %lu, list number %d\n", j_len_saved, jl - SB_JOURNAL_LIST(s)) ;
atomic_dec(&(jl->j_flushing)) ;
return 0 ;
@@ -1088,7 +1088,7 @@
** being flushed
*/
if (flushall) {
- update_journal_header_block(s, (jl->j_start + jl->j_len + 2) % JOURNAL_BLOCK_COUNT, jl->j_trans_id) ;
+ update_journal_header_block(s, (jl->j_start + jl->j_len + 2) % SB_JOURNAL_SIZE(s), jl->j_trans_id) ;
}
remove_all_from_journal_list(s, jl, 0) ;
jl->j_len = 0 ;
@@ -1366,10 +1366,10 @@
/* compares description block with commit block. returns 1 if they differ, 0 if they are the same */
static int journal_compare_desc_commit(struct super_block *p_s_sb, struct reiserfs_journal_desc *desc,
struct reiserfs_journal_commit *commit) {
- if (le32_to_cpu(commit->j_trans_id) != le32_to_cpu(desc->j_trans_id) ||
- le32_to_cpu(commit->j_len) != le32_to_cpu(desc->j_len) ||
- le32_to_cpu(commit->j_len) > JOURNAL_TRANS_MAX ||
- le32_to_cpu(commit->j_len) <= 0
+ if (get_commit_trans_id (commit) != get_desc_trans_id (desc) ||
+ get_commit_trans_len (commit) != get_desc_trans_len (desc) ||
+ get_commit_trans_len (commit) > SB_JOURNAL_TRANS_MAX(p_s_sb) ||
+ get_commit_trans_len (commit) == 0
) {
return 1 ;
}
@@ -1389,25 +1389,25 @@
return 0 ;
desc = (struct reiserfs_journal_desc *)d_bh->b_data ;
- if (le32_to_cpu(desc->j_len) > 0 && !memcmp(desc->j_magic, JOURNAL_DESC_MAGIC, 8)) {
- if (oldest_invalid_trans_id && *oldest_invalid_trans_id && le32_to_cpu(desc->j_trans_id) > *oldest_invalid_trans_id) {
+ if (get_desc_trans_len(desc) > 0 && !memcmp(get_journal_desc_magic (d_bh), JOURNAL_DESC_MAGIC, 8)) {
+ if (oldest_invalid_trans_id && *oldest_invalid_trans_id && get_desc_trans_id(desc) > *oldest_invalid_trans_id) {
reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-986: transaction "
"is valid returning because trans_id %d is greater than "
- "oldest_invalid %lu\n", le32_to_cpu(desc->j_trans_id),
+ "oldest_invalid %lu\n", get_desc_trans_id(desc),
*oldest_invalid_trans_id);
return 0 ;
}
- if (newest_mount_id && *newest_mount_id > le32_to_cpu(desc->j_mount_id)) {
+ if (newest_mount_id && *newest_mount_id > get_desc_mount_id (desc)) {
reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1087: transaction "
"is valid returning because mount_id %d is less than "
- "newest_mount_id %lu\n", desc->j_mount_id,
+ "newest_mount_id %lu\n", get_desc_mount_id (desc),
*newest_mount_id) ;
return -1 ;
}
- offset = d_bh->b_blocknr - reiserfs_get_journal_block(p_s_sb) ;
+ offset = d_bh->b_blocknr - SB_JOURNAL_BLOCK(p_s_sb) ;
/* ok, we have a journal description block, lets see if the transaction was valid */
- c_bh = sb_bread(p_s_sb, reiserfs_get_journal_block(p_s_sb) + ((offset + le32_to_cpu(desc->j_len) + 1) % JOURNAL_BLOCK_COUNT)) ;
+ c_bh = sb_bread(p_s_sb, SB_JOURNAL_BLOCK(p_s_sb) + ((offset + get_desc_trans_len(desc) + 1) % SB_JOURNAL_SIZE(p_s_sb))) ;
if (!c_bh)
return 0 ;
commit = (struct reiserfs_journal_commit *)c_bh->b_data ;
@@ -1415,22 +1415,22 @@
reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE,
"journal_transaction_is_valid, commit offset %ld had bad "
"time %d or length %d\n",
- c_bh->b_blocknr - reiserfs_get_journal_block(p_s_sb),
- le32_to_cpu(commit->j_trans_id),
- le32_to_cpu(commit->j_len));
+ c_bh->b_blocknr - SB_JOURNAL_BLOCK(p_s_sb),
+ get_commit_trans_id (commit),
+ get_commit_trans_len(commit));
brelse(c_bh) ;
if (oldest_invalid_trans_id)
- *oldest_invalid_trans_id = le32_to_cpu(desc->j_trans_id) ;
+ *oldest_invalid_trans_id = get_desc_trans_id(desc) ;
reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1004: "
"transaction_is_valid setting oldest invalid trans_id "
- "to %d\n", le32_to_cpu(desc->j_trans_id)) ;
+ "to %d\n", get_desc_trans_id(desc)) ;
return -1;
}
brelse(c_bh) ;
reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1006: found valid "
"transaction start offset %lu, len %d id %d\n",
- d_bh->b_blocknr - reiserfs_get_journal_block(p_s_sb),
- le32_to_cpu(desc->j_len), le32_to_cpu(desc->j_trans_id)) ;
+ d_bh->b_blocknr - SB_JOURNAL_BLOCK(p_s_sb),
+ get_desc_trans_len(desc), get_desc_trans_id(desc)) ;
return 1 ;
} else {
return 0 ;
@@ -1460,32 +1460,33 @@
struct buffer_head **real_blocks = NULL ;
unsigned long trans_offset ;
int i;
+ int trans_half;
d_bh = sb_bread(p_s_sb, cur_dblock) ;
if (!d_bh)
return 1 ;
desc = (struct reiserfs_journal_desc *)d_bh->b_data ;
- trans_offset = d_bh->b_blocknr - reiserfs_get_journal_block(p_s_sb) ;
+ trans_offset = d_bh->b_blocknr - SB_JOURNAL_BLOCK(p_s_sb) ;
reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1037: "
"journal_read_transaction, offset %lu, len %d mount_id %d\n",
- d_bh->b_blocknr - reiserfs_get_journal_block(p_s_sb),
- le32_to_cpu(desc->j_len), le32_to_cpu(desc->j_mount_id)) ;
- if (le32_to_cpu(desc->j_trans_id) < oldest_trans_id) {
+ d_bh->b_blocknr - SB_JOURNAL_BLOCK(p_s_sb),
+ get_desc_trans_len(desc), get_desc_mount_id(desc)) ;
+ if (get_desc_trans_id(desc) < oldest_trans_id) {
reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1039: "
"journal_read_trans skipping because %lu is too old\n",
- cur_dblock - reiserfs_get_journal_block(p_s_sb)) ;
+ cur_dblock - SB_JOURNAL_BLOCK(p_s_sb)) ;
brelse(d_bh) ;
return 1 ;
}
- if (le32_to_cpu(desc->j_mount_id) != newest_mount_id) {
+ if (get_desc_mount_id(desc) != newest_mount_id) {
reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1146: "
"journal_read_trans skipping because %d is != "
- "newest_mount_id %lu\n", le32_to_cpu(desc->j_mount_id),
+ "newest_mount_id %lu\n", get_desc_mount_id(desc),
newest_mount_id) ;
brelse(d_bh) ;
return 1 ;
}
- c_bh = sb_bread(p_s_sb, reiserfs_get_journal_block(p_s_sb) + ((trans_offset + le32_to_cpu(desc->j_len) + 1) % JOURNAL_BLOCK_COUNT)) ;
+ c_bh = sb_bread(p_s_sb, SB_JOURNAL_BLOCK(p_s_sb) + ((trans_offset + get_desc_trans_len(desc) + 1) % SB_JOURNAL_SIZE(p_s_sb))) ;
if (!c_bh) {
brelse(d_bh) ;
return 1 ;
@@ -1502,48 +1503,49 @@
}
trans_id = le32_to_cpu(desc->j_trans_id) ;
/* now we know we've got a good transaction, and it was inside the valid time ranges */
- log_blocks = reiserfs_kmalloc(le32_to_cpu(desc->j_len) * sizeof(struct buffer_head *), GFP_NOFS, p_s_sb) ;
- real_blocks = reiserfs_kmalloc(le32_to_cpu(desc->j_len) * sizeof(struct buffer_head *), GFP_NOFS, p_s_sb) ;
+ log_blocks = reiserfs_kmalloc(get_desc_trans_len(desc) * sizeof(struct buffer_head *), GFP_NOFS, p_s_sb) ;
+ real_blocks = reiserfs_kmalloc(get_desc_trans_len(desc) * sizeof(struct buffer_head *), GFP_NOFS, p_s_sb) ;
if (!log_blocks || !real_blocks) {
brelse(c_bh) ;
brelse(d_bh) ;
- reiserfs_kfree(log_blocks, le32_to_cpu(desc->j_len) * sizeof(struct buffer_head *), p_s_sb) ;
- reiserfs_kfree(real_blocks, le32_to_cpu(desc->j_len) * sizeof(struct buffer_head *), p_s_sb) ;
+ reiserfs_kfree(log_blocks, get_desc_trans_len(desc) * sizeof(struct buffer_head *), p_s_sb) ;
+ reiserfs_kfree(real_blocks, get_desc_trans_len(desc) * sizeof(struct buffer_head *), p_s_sb) ;
reiserfs_warning("journal-1169: kmalloc failed, unable to mount FS\n") ;
return -1 ;
}
/* get all the buffer heads */
- for(i = 0 ; i < le32_to_cpu(desc->j_len) ; i++) {
- log_blocks[i] = sb_getblk(p_s_sb, reiserfs_get_journal_block(p_s_sb) + (trans_offset + 1 + i) % JOURNAL_BLOCK_COUNT);
- if (i < JOURNAL_TRANS_HALF) {
+ trans_half = journal_trans_half (p_s_sb->s_blocksize) ;
+ for(i = 0 ; i < get_desc_trans_len(desc) ; i++) {
+ log_blocks[i] = sb_getblk(p_s_sb, SB_JOURNAL_BLOCK(p_s_sb) + (trans_offset + 1 + i) % SB_JOURNAL_SIZE(p_s_sb));
+ if (i < trans_half) {
real_blocks[i] = sb_getblk(p_s_sb, le32_to_cpu(desc->j_realblock[i])) ;
} else {
- real_blocks[i] = sb_getblk(p_s_sb, le32_to_cpu(commit->j_realblock[i - JOURNAL_TRANS_HALF])) ;
+ real_blocks[i] = sb_getblk(p_s_sb, le32_to_cpu(commit->j_realblock[i - trans_half])) ;
}
- if (real_blocks[i]->b_blocknr >= reiserfs_get_journal_block(p_s_sb) &&
- real_blocks[i]->b_blocknr < (reiserfs_get_journal_block(p_s_sb)+JOURNAL_BLOCK_COUNT)) {
+ if (real_blocks[i]->b_blocknr >= SB_JOURNAL_BLOCK(p_s_sb) &&
+ real_blocks[i]->b_blocknr < (SB_JOURNAL_BLOCK(p_s_sb)+SB_JOURNAL_SIZE(p_s_sb))) {
reiserfs_warning("journal-1204: REPLAY FAILURE fsck required! Trying to replay onto a log block\n") ;
brelse_array(log_blocks, i) ;
brelse_array(real_blocks, i) ;
brelse(c_bh) ;
brelse(d_bh) ;
- reiserfs_kfree(log_blocks, le32_to_cpu(desc->j_len) * sizeof(struct buffer_head *), p_s_sb) ;
- reiserfs_kfree(real_blocks, le32_to_cpu(desc->j_len) * sizeof(struct buffer_head *), p_s_sb) ;
+ reiserfs_kfree(log_blocks, get_desc_trans_len(desc) * sizeof(struct buffer_head *), p_s_sb) ;
+ reiserfs_kfree(real_blocks, get_desc_trans_len(desc) * sizeof(struct buffer_head *), p_s_sb) ;
return -1 ;
}
}
/* read in the log blocks, memcpy to the corresponding real block */
- ll_rw_block(READ, le32_to_cpu(desc->j_len), log_blocks) ;
- for (i = 0 ; i < le32_to_cpu(desc->j_len) ; i++) {
+ ll_rw_block(READ, get_desc_trans_len(desc), log_blocks) ;
+ for (i = 0 ; i < get_desc_trans_len(desc) ; i++) {
wait_on_buffer(log_blocks[i]) ;
if (!buffer_uptodate(log_blocks[i])) {
reiserfs_warning("journal-1212: REPLAY FAILURE fsck required! buffer write failed\n") ;
- brelse_array(log_blocks + i, le32_to_cpu(desc->j_len) - i) ;
- brelse_array(real_blocks, le32_to_cpu(desc->j_len)) ;
+ brelse_array(log_blocks + i, get_desc_trans_len(desc) - i) ;
+ brelse_array(real_blocks, get_desc_trans_len(desc)) ;
brelse(c_bh) ;
brelse(d_bh) ;
- reiserfs_kfree(log_blocks, le32_to_cpu(desc->j_len) * sizeof(struct buffer_head *), p_s_sb) ;
- reiserfs_kfree(real_blocks, le32_to_cpu(desc->j_len) * sizeof(struct buffer_head *), p_s_sb) ;
+ reiserfs_kfree(log_blocks, get_desc_trans_len(desc) * sizeof(struct buffer_head *), p_s_sb) ;
+ reiserfs_kfree(real_blocks, get_desc_trans_len(desc) * sizeof(struct buffer_head *), p_s_sb) ;
return -1 ;
}
memcpy(real_blocks[i]->b_data, log_blocks[i]->b_data, real_blocks[i]->b_size) ;
@@ -1551,36 +1553,36 @@
brelse(log_blocks[i]) ;
}
/* flush out the real blocks */
- for (i = 0 ; i < le32_to_cpu(desc->j_len) ; i++) {
+ for (i = 0 ; i < get_desc_trans_len(desc) ; i++) {
set_bit(BH_Dirty, &(real_blocks[i]->b_state)) ;
ll_rw_block(WRITE, 1, real_blocks + i) ;
}
- for (i = 0 ; i < le32_to_cpu(desc->j_len) ; i++) {
+ for (i = 0 ; i < get_desc_trans_len(desc) ; i++) {
wait_on_buffer(real_blocks[i]) ;
if (!buffer_uptodate(real_blocks[i])) {
reiserfs_warning("journal-1226: REPLAY FAILURE, fsck required! buffer write failed\n") ;
- brelse_array(real_blocks + i, le32_to_cpu(desc->j_len) - i) ;
+ brelse_array(real_blocks + i, get_desc_trans_len(desc) - i) ;
brelse(c_bh) ;
brelse(d_bh) ;
- reiserfs_kfree(log_blocks, le32_to_cpu(desc->j_len) * sizeof(struct buffer_head *), p_s_sb) ;
- reiserfs_kfree(real_blocks, le32_to_cpu(desc->j_len) * sizeof(struct buffer_head *), p_s_sb) ;
+ reiserfs_kfree(log_blocks, get_desc_trans_len(desc) * sizeof(struct buffer_head *), p_s_sb) ;
+ reiserfs_kfree(real_blocks, get_desc_trans_len(desc) * sizeof(struct buffer_head *), p_s_sb) ;
return -1 ;
}
brelse(real_blocks[i]) ;
}
- cur_dblock = reiserfs_get_journal_block(p_s_sb) + ((trans_offset + le32_to_cpu(desc->j_len) + 2) % JOURNAL_BLOCK_COUNT) ;
+ cur_dblock = SB_JOURNAL_BLOCK(p_s_sb) + ((trans_offset + get_desc_trans_len(desc) + 2) % SB_JOURNAL_SIZE(p_s_sb)) ;
reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1095: setting journal "
"start to offset %ld\n",
- cur_dblock - reiserfs_get_journal_block(p_s_sb)) ;
+ cur_dblock - SB_JOURNAL_BLOCK(p_s_sb)) ;
/* init starting values for the first transaction, in case this is the last transaction to be replayed. */
- SB_JOURNAL(p_s_sb)->j_start = cur_dblock - reiserfs_get_journal_block(p_s_sb) ;
+ SB_JOURNAL(p_s_sb)->j_start = cur_dblock - SB_JOURNAL_BLOCK(p_s_sb) ;
SB_JOURNAL(p_s_sb)->j_last_flush_trans_id = trans_id ;
SB_JOURNAL(p_s_sb)->j_trans_id = trans_id + 1;
brelse(c_bh) ;
brelse(d_bh) ;
- reiserfs_kfree(log_blocks, le32_to_cpu(desc->j_len) * sizeof(struct buffer_head *), p_s_sb) ;
- reiserfs_kfree(real_blocks, le32_to_cpu(desc->j_len) * sizeof(struct buffer_head *), p_s_sb) ;
+ reiserfs_kfree(log_blocks, get_desc_trans_len(desc) * sizeof(struct buffer_head *), p_s_sb) ;
+ reiserfs_kfree(real_blocks, get_desc_trans_len(desc) * sizeof(struct buffer_head *), p_s_sb) ;
return 0 ;
}
@@ -1645,7 +1647,7 @@
int continue_replay = 1 ;
int ret ;
- cur_dblock = reiserfs_get_journal_block(p_s_sb) ;
+ cur_dblock = SB_JOURNAL_BLOCK(p_s_sb) ;
printk("reiserfs: checking transaction log (device %s) ...\n",
kdevname(p_s_sb->s_dev)) ;
start = CURRENT_TIME ;
@@ -1655,16 +1657,16 @@
** replay is done
*/
SB_JOURNAL(p_s_sb)->j_header_bh = sb_bread(p_s_sb,
- reiserfs_get_journal_block(p_s_sb) +
- JOURNAL_BLOCK_COUNT) ;
+ SB_JOURNAL_BLOCK(p_s_sb) +
+ SB_JOURNAL_SIZE(p_s_sb)) ;
if (!SB_JOURNAL(p_s_sb)->j_header_bh) {
return 1 ;
}
jh = (struct reiserfs_journal_header *)(SB_JOURNAL(p_s_sb)->j_header_bh->b_data) ;
if (le32_to_cpu(jh->j_first_unflushed_offset) >= 0 &&
- le32_to_cpu(jh->j_first_unflushed_offset) < JOURNAL_BLOCK_COUNT &&
+ le32_to_cpu(jh->j_first_unflushed_offset) < SB_JOURNAL_SIZE(p_s_sb) &&
le32_to_cpu(jh->j_last_flush_trans_id) > 0) {
- last_flush_start = reiserfs_get_journal_block(p_s_sb) +
+ last_flush_start = SB_JOURNAL_BLOCK(p_s_sb) +
le32_to_cpu(jh->j_first_unflushed_offset) ;
last_flush_trans_id = le32_to_cpu(jh->j_last_flush_trans_id) ;
reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1153: found in "
@@ -1677,7 +1679,7 @@
** there is nothing more we can do, and it makes no sense to read
** through the whole log.
*/
- d_bh = sb_bread(p_s_sb, reiserfs_get_journal_block(p_s_sb) + le32_to_cpu(jh->j_first_unflushed_offset)) ;
+ d_bh = sb_bread(p_s_sb, SB_JOURNAL_BLOCK(p_s_sb) + le32_to_cpu(jh->j_first_unflushed_offset)) ;
ret = journal_transaction_is_valid(p_s_sb, d_bh, NULL, NULL) ;
if (!ret) {
continue_replay = 0 ;
@@ -1696,35 +1698,35 @@
/* ok, there are transactions that need to be replayed. start with the first log block, find
** all the valid transactions, and pick out the oldest.
*/
- while(continue_replay && cur_dblock < (reiserfs_get_journal_block(p_s_sb) + JOURNAL_BLOCK_COUNT)) {
+ while(continue_replay && cur_dblock < (SB_JOURNAL_BLOCK(p_s_sb) + SB_JOURNAL_SIZE(p_s_sb))) {
d_bh = reiserfs_breada(p_s_sb->s_dev, cur_dblock, p_s_sb->s_blocksize,
- reiserfs_get_journal_block(p_s_sb) + JOURNAL_BLOCK_COUNT) ;
+ SB_JOURNAL_BLOCK(p_s_sb) + SB_JOURNAL_SIZE(p_s_sb)) ;
ret = journal_transaction_is_valid(p_s_sb, d_bh, &oldest_invalid_trans_id, &newest_mount_id) ;
if (ret == 1) {
desc = (struct reiserfs_journal_desc *)d_bh->b_data ;
if (oldest_start == 0) { /* init all oldest_ values */
- oldest_trans_id = le32_to_cpu(desc->j_trans_id) ;
+ oldest_trans_id = get_desc_trans_id(desc) ;
oldest_start = d_bh->b_blocknr ;
- newest_mount_id = le32_to_cpu(desc->j_mount_id) ;
+ newest_mount_id = get_desc_mount_id(desc) ;
reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1179: Setting "
"oldest_start to offset %lu, trans_id %lu\n",
- oldest_start - reiserfs_get_journal_block(p_s_sb),
+ oldest_start - SB_JOURNAL_BLOCK(p_s_sb),
oldest_trans_id) ;
- } else if (oldest_trans_id > le32_to_cpu(desc->j_trans_id)) {
+ } else if (oldest_trans_id > get_desc_trans_id(desc)) {
/* one we just read was older */
- oldest_trans_id = le32_to_cpu(desc->j_trans_id) ;
+ oldest_trans_id = get_desc_trans_id(desc) ;
oldest_start = d_bh->b_blocknr ;
reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1180: Resetting "
"oldest_start to offset %lu, trans_id %lu\n",
- oldest_start - reiserfs_get_journal_block(p_s_sb),
+ oldest_start - SB_JOURNAL_BLOCK(p_s_sb),
oldest_trans_id) ;
}
- if (newest_mount_id < le32_to_cpu(desc->j_mount_id)) {
- newest_mount_id = le32_to_cpu(desc->j_mount_id) ;
+ if (newest_mount_id < get_desc_mount_id(desc)) {
+ newest_mount_id = get_desc_mount_id(desc) ;
reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1299: Setting "
- "newest_mount_id to %d\n", le32_to_cpu(desc->j_mount_id));
+ "newest_mount_id to %d\n", get_desc_mount_id(desc));
}
- cur_dblock += le32_to_cpu(desc->j_len) + 2 ;
+ cur_dblock += get_desc_trans_len(desc) + 2 ;
}
else {
cur_dblock++ ;
@@ -1740,7 +1742,7 @@
if (oldest_trans_id) {
reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1206: Starting replay "
"from offset %lu, trans_id %lu\n",
- cur_dblock - reiserfs_get_journal_block(p_s_sb),
+ cur_dblock - SB_JOURNAL_BLOCK(p_s_sb),
oldest_trans_id) ;
}
@@ -1752,7 +1754,7 @@
} else if (ret != 0) {
break ;
}
- cur_dblock = reiserfs_get_journal_block(p_s_sb) + SB_JOURNAL(p_s_sb)->j_start ;
+ cur_dblock = SB_JOURNAL_BLOCK(p_s_sb) + SB_JOURNAL(p_s_sb)->j_start ;
replay_count++ ;
if (cur_dblock == oldest_start)
break;
@@ -1901,23 +1903,34 @@
}
}
+
+/* for blocksize >= 4096 - max transaction size is 1024. For block size < 4096
+ - trans max size is decreased proportionally */
+static void set_trans_params (struct super_block * s)
+{
+ SB_JOURNAL_TRANS_MAX(s) = JOURNAL_TRANS_MAX_DEFAULT ;
+ SB_JOURNAL_MAX_BATCH(s) = JOURNAL_MAX_BATCH_DEFAULT ;
+
+ if (s->s_blocksize < 4096) {
+ SB_JOURNAL_TRANS_MAX(s) /= (4096 / s->s_blocksize) ;
+ SB_JOURNAL_MAX_BATCH(s) = (SB_JOURNAL_TRANS_MAX(s)) * 9 / 10 ;
+ }
+}
+
+
/*
** must be called once on fs mount. calls journal_read for you
*/
int journal_init(struct super_block *p_s_sb) {
- int num_cnodes = JOURNAL_BLOCK_COUNT * 2 ;
+ int num_cnodes ;
+
+ num_cnodes = SB_JOURNAL_SIZE(p_s_sb) * 2 ;
- if (sizeof(struct reiserfs_journal_commit) != 4096 ||
- sizeof(struct reiserfs_journal_desc) != 4096
- ) {
- printk("journal-1249: commit or desc struct not 4096 %Zd %Zd\n", sizeof(struct reiserfs_journal_commit),
- sizeof(struct reiserfs_journal_desc)) ;
- return 1 ;
- }
/* sanity check to make sure they don't overflow the journal */
- if (JOURNAL_BLOCK_COUNT > reiserfs_get_journal_orig_size(p_s_sb)) {
- printk("journal-1393: current JOURNAL_BLOCK_COUNT (%d) is too big. This FS was created with a journal size of %lu blocks\n",
- JOURNAL_BLOCK_COUNT, reiserfs_get_journal_orig_size(p_s_sb)) ;
+ if (SB_JOURNAL_BLOCK(p_s_sb) + SB_JOURNAL_SIZE(p_s_sb) > p_s_sb->s_blocksize * 8) {
+ printk("journal-1393: journal does not fit for area addressed by first of bitmap blocks. "
+ "It starts at %u and its size is %u. Block size %ld\n",
+ SB_JOURNAL_BLOCK(p_s_sb), SB_JOURNAL_SIZE(p_s_sb), p_s_sb->s_blocksize) ;
return 1 ;
}
SB_JOURNAL(p_s_sb) = vmalloc(sizeof (struct reiserfs_journal)) ;
@@ -1965,6 +1978,10 @@
SB_JOURNAL(p_s_sb)->j_cnode_free = SB_JOURNAL(p_s_sb)->j_cnode_free_list ? num_cnodes : 0 ;
SB_JOURNAL(p_s_sb)->j_cnode_used = 0 ;
SB_JOURNAL(p_s_sb)->j_must_wait = 0 ;
+
+ /* adjust max trans size and max trans batch */
+ set_trans_params (p_s_sb);
+
init_journal_hash(p_s_sb) ;
SB_JOURNAL_LIST(p_s_sb)[0].j_list_bitmap = get_list_bitmap(p_s_sb, SB_JOURNAL_LIST(p_s_sb)) ;
if (!(SB_JOURNAL_LIST(p_s_sb)[0].j_list_bitmap)) {
@@ -2002,10 +2019,10 @@
if (reiserfs_dont_log(th->t_super))
return 0 ;
if ( SB_JOURNAL(th->t_super)->j_must_wait > 0 ||
- (SB_JOURNAL(th->t_super)->j_len_alloc + new_alloc) >= JOURNAL_MAX_BATCH ||
+ (SB_JOURNAL(th->t_super)->j_len_alloc + new_alloc) >= SB_JOURNAL_MAX_BATCH(th->t_super) ||
atomic_read(&(SB_JOURNAL(th->t_super)->j_jlock)) ||
(now - SB_JOURNAL(th->t_super)->j_trans_start_time) > JOURNAL_MAX_TRANS_AGE ||
- SB_JOURNAL(th->t_super)->j_cnode_free < (JOURNAL_TRANS_MAX * 3)) {
+ SB_JOURNAL(th->t_super)->j_cnode_free < (SB_JOURNAL_TRANS_MAX(th->t_super) * 3)) {
return 1 ;
}
return 0 ;
@@ -2074,11 +2091,11 @@
if ( (!join && SB_JOURNAL(p_s_sb)->j_must_wait > 0) ||
- ( !join && (SB_JOURNAL(p_s_sb)->j_len_alloc + nblocks + 2) >= JOURNAL_MAX_BATCH) ||
+ ( !join && (SB_JOURNAL(p_s_sb)->j_len_alloc + nblocks + 2) >= SB_JOURNAL_MAX_BATCH(p_s_sb)) ||
(!join && atomic_read(&(SB_JOURNAL(p_s_sb)->j_wcount)) > 0 && SB_JOURNAL(p_s_sb)->j_trans_start_time > 0 &&
(now - SB_JOURNAL(p_s_sb)->j_trans_start_time) > JOURNAL_MAX_TRANS_AGE) ||
(!join && atomic_read(&(SB_JOURNAL(p_s_sb)->j_jlock)) ) ||
- (!join && SB_JOURNAL(p_s_sb)->j_cnode_free < (JOURNAL_TRANS_MAX * 3))) {
+ (!join && SB_JOURNAL(p_s_sb)->j_cnode_free < (SB_JOURNAL_TRANS_MAX(p_s_sb) * 3))) {
unlock_journal(p_s_sb) ; /* allow others to finish this transaction */
@@ -2188,7 +2205,7 @@
/* this error means I've screwed up, and we've overflowed the transaction.
** Nothing can be done here, except make the FS readonly or panic.
*/
- if (SB_JOURNAL(p_s_sb)->j_len >= JOURNAL_TRANS_MAX) {
+ if (SB_JOURNAL(p_s_sb)->j_len >= SB_JOURNAL_TRANS_MAX(p_s_sb)) {
reiserfs_panic(th->t_super, "journal-1413: journal_mark_dirty: j_len (%lu) is too big\n", SB_JOURNAL(p_s_sb)->j_len) ;
}
@@ -2544,14 +2561,14 @@
/* don't batch when someone is waiting on j_join_wait */
/* don't batch when syncing the commit or flushing the whole trans */
if (!(SB_JOURNAL(p_s_sb)->j_must_wait > 0) && !(atomic_read(&(SB_JOURNAL(p_s_sb)->j_jlock))) && !flush && !commit_now &&
- (SB_JOURNAL(p_s_sb)->j_len < JOURNAL_MAX_BATCH) &&
- SB_JOURNAL(p_s_sb)->j_len_alloc < JOURNAL_MAX_BATCH && SB_JOURNAL(p_s_sb)->j_cnode_free > (JOURNAL_TRANS_MAX * 3)) {
+ (SB_JOURNAL(p_s_sb)->j_len < SB_JOURNAL_MAX_BATCH(p_s_sb)) &&
+ SB_JOURNAL(p_s_sb)->j_len_alloc < SB_JOURNAL_MAX_BATCH(p_s_sb) && SB_JOURNAL(p_s_sb)->j_cnode_free > (SB_JOURNAL_TRANS_MAX(p_s_sb) * 3)) {
SB_JOURNAL(p_s_sb)->j_bcount++ ;
unlock_journal(p_s_sb) ;
return 0 ;
}
- if (SB_JOURNAL(p_s_sb)->j_start > JOURNAL_BLOCK_COUNT) {
+ if (SB_JOURNAL(p_s_sb)->j_start > SB_JOURNAL_SIZE(p_s_sb)) {
reiserfs_panic(p_s_sb, "journal-003: journal_end: j_start (%ld) is too high\n", SB_JOURNAL(p_s_sb)->j_start) ;
}
return 1 ;
@@ -2749,6 +2766,7 @@
int commit_now = flags & COMMIT_NOW ;
int wait_on_commit = flags & WAIT ;
struct reiserfs_super_block *rs ;
+ int trans_half ;
if (reiserfs_dont_log(th->t_super)) {
return 0 ;
@@ -2793,19 +2811,20 @@
rs = SB_DISK_SUPER_BLOCK(p_s_sb) ;
/* setup description block */
- d_bh = sb_getblk(p_s_sb, reiserfs_get_journal_block(p_s_sb) + SB_JOURNAL(p_s_sb)->j_start) ;
+ d_bh = sb_getblk(p_s_sb, SB_JOURNAL_BLOCK(p_s_sb) + SB_JOURNAL(p_s_sb)->j_start) ;
mark_buffer_uptodate(d_bh, 1) ;
desc = (struct reiserfs_journal_desc *)(d_bh)->b_data ;
- memset(desc, 0, sizeof(struct reiserfs_journal_desc)) ;
- memcpy(desc->j_magic, JOURNAL_DESC_MAGIC, 8) ;
- desc->j_trans_id = cpu_to_le32(SB_JOURNAL(p_s_sb)->j_trans_id) ;
+ memset(d_bh->b_data, 0, d_bh->b_size) ;
+ memcpy(get_journal_desc_magic (d_bh), JOURNAL_DESC_MAGIC, 8) ;
+ set_desc_trans_id(desc, SB_JOURNAL(p_s_sb)->j_trans_id) ;
+ mark_buffer_uptodate(d_bh, 1) ;
/* setup commit block. Don't write (keep it clean too) this one until after everyone else is written */
- c_bh = sb_getblk(p_s_sb, reiserfs_get_journal_block(p_s_sb) +
- ((SB_JOURNAL(p_s_sb)->j_start + SB_JOURNAL(p_s_sb)->j_len + 1) % JOURNAL_BLOCK_COUNT)) ;
+ c_bh = sb_getblk(p_s_sb, SB_JOURNAL_BLOCK(p_s_sb) +
+ ((SB_JOURNAL(p_s_sb)->j_start + SB_JOURNAL(p_s_sb)->j_len + 1) % SB_JOURNAL_SIZE(p_s_sb))) ;
commit = (struct reiserfs_journal_commit *)c_bh->b_data ;
- memset(commit, 0, sizeof(struct reiserfs_journal_commit)) ;
- commit->j_trans_id = cpu_to_le32(SB_JOURNAL(p_s_sb)->j_trans_id) ;
+ memset(c_bh->b_data, 0, c_bh->b_size) ;
+ set_commit_trans_id(commit, SB_JOURNAL(p_s_sb)->j_trans_id) ;
mark_buffer_uptodate(c_bh, 1) ;
/* init this journal list */
@@ -2830,6 +2849,7 @@
/* for each real block, add it to the journal list hash,
** copy into real block index array in the commit or desc block
*/
+ trans_half = journal_trans_half(p_s_sb->s_blocksize) ;
for (i = 0, cn = SB_JOURNAL(p_s_sb)->j_first ; cn ; cn = cn->next, i++) {
if (test_bit(BH_JDirty, &cn->bh->b_state) ) {
jl_cn = get_cnode(p_s_sb) ;
@@ -2845,8 +2865,8 @@
last_cn->next = jl_cn ;
}
last_cn = jl_cn ;
- if (cn->bh->b_blocknr >= reiserfs_get_journal_block(p_s_sb) &&
- cn->bh->b_blocknr < (reiserfs_get_journal_block(p_s_sb) + JOURNAL_BLOCK_COUNT)) {
+ if (cn->bh->b_blocknr >= SB_JOURNAL_BLOCK(p_s_sb) &&
+ cn->bh->b_blocknr < (SB_JOURNAL_BLOCK(p_s_sb) + SB_JOURNAL_SIZE(p_s_sb))) {
reiserfs_panic(p_s_sb, "journal-2332: Trying to log block %lu, which is a log block\n", cn->bh->b_blocknr) ;
}
jl_cn->blocknr = cn->bh->b_blocknr ;
@@ -2855,27 +2875,27 @@
jl_cn->bh = cn->bh ;
jl_cn->jlist = SB_JOURNAL_LIST(p_s_sb) + SB_JOURNAL_LIST_INDEX(p_s_sb) ;
insert_journal_hash(SB_JOURNAL(p_s_sb)->j_list_hash_table, jl_cn) ;
- if (i < JOURNAL_TRANS_HALF) {
+ if (i < trans_half) {
desc->j_realblock[i] = cpu_to_le32(cn->bh->b_blocknr) ;
} else {
- commit->j_realblock[i - JOURNAL_TRANS_HALF] = cpu_to_le32(cn->bh->b_blocknr) ;
+ commit->j_realblock[i - trans_half] = cpu_to_le32(cn->bh->b_blocknr) ;
}
} else {
i-- ;
}
}
-
- desc->j_len = cpu_to_le32(SB_JOURNAL(p_s_sb)->j_len) ;
- desc->j_mount_id = cpu_to_le32(SB_JOURNAL(p_s_sb)->j_mount_id) ;
- desc->j_trans_id = cpu_to_le32(SB_JOURNAL(p_s_sb)->j_trans_id) ;
- commit->j_len = cpu_to_le32(SB_JOURNAL(p_s_sb)->j_len) ;
+
+ set_desc_trans_len(desc, SB_JOURNAL(p_s_sb)->j_len) ;
+ set_desc_mount_id(desc, SB_JOURNAL(p_s_sb)->j_mount_id) ;
+ set_desc_trans_id(desc, SB_JOURNAL(p_s_sb)->j_trans_id) ;
+ set_commit_trans_len(commit, SB_JOURNAL(p_s_sb)->j_len);
/* special check in case all buffers in the journal were marked for not logging */
if (SB_JOURNAL(p_s_sb)->j_len == 0) {
brelse(d_bh) ;
brelse(c_bh) ;
unlock_journal(p_s_sb) ;
-printk("journal-2020: do_journal_end: BAD desc->j_len is ZERO\n") ;
+ printk("journal-2020: do_journal_end: BAD desc->j_len is ZERO\n") ;
atomic_set(&(SB_JOURNAL(p_s_sb)->j_jlock), 0) ;
wake_up(&(SB_JOURNAL(p_s_sb)->j_join_wait)) ;
return 0 ;
@@ -2890,8 +2910,8 @@
/* copy all the real blocks into log area. dirty log blocks */
if (test_bit(BH_JDirty, &cn->bh->b_state)) {
struct buffer_head *tmp_bh ;
- tmp_bh = sb_getblk(p_s_sb, reiserfs_get_journal_block(p_s_sb) +
- ((cur_write_start + jindex) % JOURNAL_BLOCK_COUNT)) ;
+ tmp_bh = sb_getblk(p_s_sb, SB_JOURNAL_BLOCK(p_s_sb) +
+ ((cur_write_start + jindex) % SB_JOURNAL_SIZE(p_s_sb))) ;
mark_buffer_uptodate(tmp_bh, 1) ;
memcpy(tmp_bh->b_data, cn->bh->b_data, cn->bh->b_size) ;
jindex++ ;
@@ -2952,7 +2972,7 @@
/* reset journal values for the next transaction */
old_start = SB_JOURNAL(p_s_sb)->j_start ;
- SB_JOURNAL(p_s_sb)->j_start = (SB_JOURNAL(p_s_sb)->j_start + SB_JOURNAL(p_s_sb)->j_len + 2) % JOURNAL_BLOCK_COUNT;
+ SB_JOURNAL(p_s_sb)->j_start = (SB_JOURNAL(p_s_sb)->j_start + SB_JOURNAL(p_s_sb)->j_len + 2) % SB_JOURNAL_SIZE(p_s_sb);
atomic_set(&(SB_JOURNAL(p_s_sb)->j_wcount), 0) ;
SB_JOURNAL(p_s_sb)->j_bcount = 0 ;
SB_JOURNAL(p_s_sb)->j_last = NULL ;
@@ -2973,12 +2993,12 @@
for (i = 0 ; i < JOURNAL_LIST_COUNT ; i++) {
jindex = i ;
if (SB_JOURNAL_LIST(p_s_sb)[jindex].j_len > 0 && SB_JOURNAL(p_s_sb)->j_start <= SB_JOURNAL_LIST(p_s_sb)[jindex].j_start) {
- if ((SB_JOURNAL(p_s_sb)->j_start + JOURNAL_TRANS_MAX + 1) >= SB_JOURNAL_LIST(p_s_sb)[jindex].j_start) {
+ if ((SB_JOURNAL(p_s_sb)->j_start + SB_JOURNAL_TRANS_MAX(p_s_sb) + 1) >= SB_JOURNAL_LIST(p_s_sb)[jindex].j_start) {
flush_journal_list(p_s_sb, SB_JOURNAL_LIST(p_s_sb) + jindex, 1) ;
}
} else if (SB_JOURNAL_LIST(p_s_sb)[jindex].j_len > 0 &&
- (SB_JOURNAL(p_s_sb)->j_start + JOURNAL_TRANS_MAX + 1) > JOURNAL_BLOCK_COUNT) {
- if (((SB_JOURNAL(p_s_sb)->j_start + JOURNAL_TRANS_MAX + 1) % JOURNAL_BLOCK_COUNT) >=
+ (SB_JOURNAL(p_s_sb)->j_start + SB_JOURNAL_TRANS_MAX(p_s_sb) + 1) > SB_JOURNAL_SIZE(p_s_sb)) {
+ if (((SB_JOURNAL(p_s_sb)->j_start + SB_JOURNAL_TRANS_MAX(p_s_sb) + 1) % SB_JOURNAL_SIZE(p_s_sb)) >=
SB_JOURNAL_LIST(p_s_sb)[jindex].j_start) {
flush_journal_list(p_s_sb, SB_JOURNAL_LIST(p_s_sb) + jindex, 1 ) ;
}
diff -uNr linux-2.4.18.o1/fs/reiserfs/prints.c linux-2.4.18.o/fs/reiserfs/prints.c
--- linux-2.4.18.o1/fs/reiserfs/prints.c Thu Feb 28 18:52:05 2002
+++ linux-2.4.18.o/fs/reiserfs/prints.c Thu Feb 28 18:48:51 2002
@@ -541,12 +541,13 @@
{
struct reiserfs_journal_desc * desc;
- desc = (struct reiserfs_journal_desc *)(bh->b_data);
- if (memcmp(desc->j_magic, JOURNAL_DESC_MAGIC, 8))
+ if (memcmp(get_journal_desc_magic (bh), JOURNAL_DESC_MAGIC, 8))
return 1;
+ desc = (struct reiserfs_journal_desc *)(bh->b_data);
printk ("Desc block %lu (j_trans_id %d, j_mount_id %d, j_len %d)",
- bh->b_blocknr, desc->j_trans_id, desc->j_mount_id, desc->j_len);
+ bh->b_blocknr, get_desc_trans_id (desc), get_desc_mount_id (desc),
+ get_desc_trans_len (desc));
return 0;
}
diff -uNr linux-2.4.18.o1/fs/reiserfs/super.c linux-2.4.18.o/fs/reiserfs/super.c
--- linux-2.4.18.o1/fs/reiserfs/super.c Thu Feb 28 18:52:05 2002
+++ linux-2.4.18.o/fs/reiserfs/super.c Thu Feb 28 18:48:51 2002
@@ -20,9 +20,6 @@
#include <linux/locks.h>
#include <linux/init.h>
-#define REISERFS_OLD_BLOCKSIZE 4096
-#define REISERFS_SUPER_MAGIC_STRING_OFFSET_NJ 20
-
char reiserfs_super_magic_string[] = REISERFS_SUPER_MAGIC_STRING;
char reiser2fs_super_magic_string[] = REISER2FS_SUPER_MAGIC_STRING;
@@ -422,7 +419,7 @@
};
-/* this was (ext2)parse_options */
+
static int parse_options (char * options, unsigned long * mount_options, unsigned long * blocks)
{
char * this_char;
@@ -703,6 +700,14 @@
//
// ok, reiserfs signature (old or new) found in at the given offset
//
+ if ( sb_blocksize(rs) > PAGE_SIZE ) {
+ printk("reiserfs: Filesystem on device %s has a blocksize of %d bytes "
+ "which is bigger than page size. Currently you cannot mount "
+ "such filesystems in Linux\n",
+ kdevname(s->s_dev), sb_blocksize(rs));
+ brelse (bh);
+ return 1;
+ }
s->s_blocksize = sb_blocksize(rs);
s->s_blocksize_bits = 0;
while ((1 << s->s_blocksize_bits) != s->s_blocksize)
@@ -737,7 +742,7 @@
** journal for that super, it can't be valid.
*/
if (bh->b_blocknr >= sb_journal_block(rs) &&
- bh->b_blocknr < (sb_journal_block(rs) + JOURNAL_BLOCK_COUNT)) {
+ bh->b_blocknr < (sb_journal_block(rs) + SB_JOURNAL_SIZE(s))) {
brelse(bh) ;
printk("super-459: read_super_block: "
"super found at block %lu is within its own log. "
diff -uNr linux-2.4.18.o1/include/linux/reiserfs_fs.h linux-2.4.18.o/include/linux/reiserfs_fs.h
--- linux-2.4.18.o1/include/linux/reiserfs_fs.h Thu Feb 28 18:52:05 2002
+++ linux-2.4.18.o/include/linux/reiserfs_fs.h Thu Feb 28 18:48:51 2002
@@ -1465,29 +1465,43 @@
/***************************************************************************/
/*#ifdef __KERNEL__*/
+#define get_journal_desc_magic(bh) (bh->b_data + bh->b_size - 12)
-/* journal.c see journal.c for all the comments here */
-
-#define JOURNAL_TRANS_HALF 1018 /* must be correct to keep the desc and commit structs at 4k */
+#define journal_trans_half(blocksize) \
+ ((blocksize - sizeof (struct reiserfs_journal_desc) + sizeof (__u32) - 12) / sizeof (__u32))
+/* journal.c see journal.c for all the comments here */
/* first block written in a commit. */
struct reiserfs_journal_desc {
__u32 j_trans_id ; /* id of commit */
__u32 j_len ; /* length of commit. len +1 is the commit block */
__u32 j_mount_id ; /* mount id of this trans*/
- __u32 j_realblock[JOURNAL_TRANS_HALF] ; /* real locations for each block */
- char j_magic[12] ;
+ __u32 j_realblock[1] ; /* real locations for each block */
} ;
+#define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id)
+#define get_desc_trans_len(d) le32_to_cpu((d)->j_len)
+#define get_desc_mount_id(d) le32_to_cpu((d)->j_mount_id)
+
+#define set_desc_trans_id(d,val) do { (d)->j_trans_id = cpu_to_le32 (val); } while (0)
+#define set_desc_trans_len(d,val) do { (d)->j_len = cpu_to_le32 (val); } while (0)
+#define set_desc_mount_id(d,val) do { (d)->j_mount_id = cpu_to_le32 (val); } while (0)
+
/* last block written in a commit */
struct reiserfs_journal_commit {
__u32 j_trans_id ; /* must match j_trans_id from the desc block */
__u32 j_len ; /* ditto */
- __u32 j_realblock[JOURNAL_TRANS_HALF] ; /* real locations for each block */
- char j_digest[16] ; /* md5 sum of all the blocks involved, including desc and commit. not used, kill it */
+ __u32 j_realblock[1] ; /* real locations for each block */
} ;
+#define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id)
+#define get_commit_trans_len(c) le32_to_cpu((c)->j_len)
+#define get_commit_mount_id(c) le32_to_cpu((c)->j_mount_id)
+
+#define set_commit_trans_id(c,val) do { (c)->j_trans_id = cpu_to_le32 (val); } while (0)
+#define set_commit_trans_len(c,val) do { (c)->j_len = cpu_to_le32 (val); } while (0)
+
/* this header block gets written whenever a transaction is considered fully flushed, and is more recent than the
** last fully flushed transaction. fully flushed means all the log blocks and all the real blocks are on disk,
** and this transaction does not need to be replayed.
@@ -1502,8 +1516,8 @@
extern wait_queue_head_t reiserfs_commit_thread_wait ;
/* biggest tunable defines are right here */
-#define JOURNAL_BLOCK_COUNT 8192 /* number of blocks in the journal */
-#define JOURNAL_MAX_BATCH 900 /* max blocks to batch into one transaction, don't make this any bigger than 900 */
+#define JOURNAL_TRANS_MAX_DEFAULT 1024 /* biggest possible single transaction, don't change for now (8/3/99) */
+#define JOURNAL_MAX_BATCH_DEFAULT 900 /* max blocks to batch into one transaction, don't make this any bigger than 900 */
#define JOURNAL_MAX_COMMIT_AGE 30
#define JOURNAL_MAX_TRANS_AGE 30
#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9)
diff -uNr linux-2.4.18.o1/include/linux/reiserfs_fs_sb.h linux-2.4.18.o/include/linux/reiserfs_fs_sb.h
--- linux-2.4.18.o1/include/linux/reiserfs_fs_sb.h Thu Feb 28 18:52:05 2002
+++ linux-2.4.18.o/include/linux/reiserfs_fs_sb.h Thu Feb 28 18:48:51 2002
@@ -180,7 +180,6 @@
/* we have a node size define somewhere in reiserfs_fs.h. -Hans */
#define JOURNAL_BLOCK_SIZE 4096 /* BUG gotta get rid of this */
#define JOURNAL_MAX_CNODE 1500 /* max cnodes to allocate. */
-#define JOURNAL_TRANS_MAX 1024 /* biggest possible single transaction, don't change for now (8/3/99) */
#define JOURNAL_HASH_SIZE 8192
#define JOURNAL_NUM_BITMAPS 5 /* number of copies of the bitmaps to have floating. Must be >= 2 */
#define JOURNAL_LIST_COUNT 64
@@ -317,6 +316,8 @@
struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE] ; /* hash table for all the real buffer heads in all
the transactions */
struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */
+ unsigned long j_max_trans_size ;
+ unsigned long j_max_batch_size ;
};
#define JOURNAL_DESC_MAGIC "ReIsErLB" /* ick. magic string to find desc blocks in the journal */
@@ -523,6 +524,8 @@
#define SB_JOURNAL_LIST(s) (SB_JOURNAL(s)->j_journal_list)
#define SB_JOURNAL_LIST_INDEX(s) (SB_JOURNAL(s)->j_journal_list_index)
#define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free)
+#define SB_JOURNAL_TRANS_MAX(s) (SB_JOURNAL(s)->j_max_trans_size)
+#define SB_JOURNAL_MAX_BATCH(s) (SB_JOURNAL(s)->j_max_batch_size)
#define SB_AP_BITMAP(s) ((s)->u.reiserfs_sb.s_ap_bitmap)
@@ -536,6 +539,8 @@
#define SB_REISERFS_STATE(s) sb_state (SB_DISK_SUPER_BLOCK(s))
#define SB_VERSION(s) sb_version (SB_DISK_SUPER_BLOCK(s))
#define SB_BMAP_NR(s) sb_bmap_nr(SB_DISK_SUPER_BLOCK(s))
+#define SB_JOURNAL_SIZE(s) le16_to_cpu ((SB_DISK_SUPER_BLOCK(s)->s_orig_journal_size))
+#define SB_JOURNAL_BLOCK(s) le16_to_cpu ((SB_DISK_SUPER_BLOCK(s)->s_journal_block))
#define PUT_SB_BLOCK_COUNT(s, val) do { set_sb_block_count( SB_DISK_SUPER_BLOCK(s), val); } while (0)
#define PUT_SB_FREE_BLOCKS(s, val) do { set_sb_free_blocks( SB_DISK_SUPER_BLOCK(s), val); } while (0)