ll_rw_block(WRITE, 1, real_blocks + i); 
ll_rw_block(SWRITE, 1, real_blocks + i); 
static int journal_read_transaction(struct super_block *p_s_sb,				    unsigned long cur_dblock,				    unsigned long oldest_start,				    unsigned long oldest_trans_id,				    unsigned long newest_mount_id){	struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb);	struct reiserfs_journal_desc *desc;	struct reiserfs_journal_commit *commit;	unsigned long trans_id = 0;	struct buffer_head *c_bh;	struct buffer_head *d_bh;	struct buffer_head **log_blocks = NULL;	struct buffer_head **real_blocks = NULL;	unsigned long trans_offset;	int i;	int trans_half;	d_bh = journal_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 - SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb);	reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1037: "		       "journal_read_transaction, offset %llu, len %d mount_id %d",		       d_bh->b_blocknr - SB_ONDISK_JOURNAL_1st_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",			       cur_dblock -			       SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb));		brelse(d_bh);		return 1;	}	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", get_desc_mount_id(desc),			       newest_mount_id);		brelse(d_bh);		return 1;	}	c_bh = journal_bread(p_s_sb, SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb) +			     ((trans_offset + get_desc_trans_len(desc) + 1) %			      SB_ONDISK_JOURNAL_SIZE(p_s_sb)));	if (!c_bh) {		brelse(d_bh);		return 1;	}	commit = (struct reiserfs_journal_commit *)c_bh->b_data;	if (journal_compare_desc_commit(p_s_sb, desc, commit)) {		reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE,			       "journal_read_transaction, "			       "commit offset %llu had bad time %d or length %d",			       c_bh->b_blocknr -			       SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb),			       get_commit_trans_id(commit),			       get_commit_trans_len(commit));		brelse(c_bh);		brelse(d_bh);		return 1;	}	trans_id = get_desc_trans_id(desc);	/* now we know we've got a good transaction, and it was inside the valid time ranges */	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,			       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(p_s_sb,				 "journal-1169: kmalloc failed, unable to mount FS");		return -1;	}	/* get all the buffer heads */	trans_half = journal_trans_half(p_s_sb->s_blocksize);	for (i = 0; i < get_desc_trans_len(desc); i++) {		log_blocks[i] =		    journal_getblk(p_s_sb,				   SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb) +				   (trans_offset + 1 +				    i) % SB_ONDISK_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 - trans_half]));		}		if (real_blocks[i]->b_blocknr > SB_BLOCK_COUNT(p_s_sb)) {			reiserfs_warning(p_s_sb,					 "journal-1207: REPLAY FAILURE fsck required! Block to replay is outside of filesystem");			goto abort_replay;		}		/* make sure we don't try to replay onto log or reserved area */		if (is_block_in_log_or_reserved_area		    (p_s_sb, real_blocks[i]->b_blocknr)) {			reiserfs_warning(p_s_sb,					 "journal-1204: REPLAY FAILURE fsck required! Trying to replay onto a log block");		      abort_replay:			brelse_array(log_blocks, i);			brelse_array(real_blocks, i);			brelse(c_bh);			brelse(d_bh);			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, 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(p_s_sb,					 "journal-1212: REPLAY FAILURE fsck required! buffer write failed");			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,				       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);		set_buffer_uptodate(real_blocks[i]);		brelse(log_blocks[i]);	}	/* flush out the real blocks */	for (i = 0; i < get_desc_trans_len(desc); i++) {		set_buffer_dirty(real_blocks[i]);		ll_rw_block(WRITE, 1, real_blocks + 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(p_s_sb,					 "journal-1226: REPLAY FAILURE, fsck required! buffer write failed");			brelse_array(real_blocks + i,				     get_desc_trans_len(desc) - i);			brelse(c_bh);			brelse(d_bh);			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 =	    SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb) +	    ((trans_offset + get_desc_trans_len(desc) +	      2) % SB_ONDISK_JOURNAL_SIZE(p_s_sb));	reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE,		       "journal-1095: setting journal " "start to offset %ld",		       cur_dblock - SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb));	/* init starting values for the first transaction, in case this is the last transaction to be replayed. */	journal->j_start = cur_dblock - SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb);	journal->j_last_flush_trans_id = trans_id;	journal->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);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/53778ffde601c962ad9250c4998df7de6f428246/journal.c/clean/fs/reiserfs/journal.c