More than 30 callers of ocfs2_read_block() pass exactly OCFS2_BH_CACHED.
Only six pass a different flag set. Rather than have every caller care,
let's make ocfs2_read_block() take no flags and always do a cached read.
The remaining six places can call ocfs2_read_blocks() directly.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
if (last_eb_blk) {
retval = ocfs2_read_block(inode, last_eb_blk,
- &eb_bh, OCFS2_BH_CACHED);
+ &eb_bh);
if (retval < 0) {
mlog_errno(retval);
goto bail;
brelse(bh);
bh = NULL;
- status = ocfs2_read_block(inode, blkno, &bh, OCFS2_BH_CACHED);
+ status = ocfs2_read_block(inode, blkno, &bh);
if (status < 0) {
mlog_errno(status);
goto bail;
brelse(bh);
bh = NULL;
- ret = ocfs2_read_block(inode, blkno, &bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, blkno, &bh);
if (ret) {
mlog_errno(ret);
goto out;
* ocfs2_figure_insert_type() and ocfs2_add_branch()
* may want it later.
*/
- ret = ocfs2_read_block(inode,
- ocfs2_et_get_last_eb_blk(et), &bh,
- OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, ocfs2_et_get_last_eb_blk(et), &bh);
if (ret) {
mlog_exit(ret);
goto out;
if (path->p_tree_depth) {
struct ocfs2_extent_block *eb;
- ret = ocfs2_read_block(inode,
- ocfs2_et_get_last_eb_blk(et),
- &last_eb_bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, ocfs2_et_get_last_eb_blk(et),
+ &last_eb_bh);
if (ret) {
mlog_exit(ret);
goto out;
depth = path->p_tree_depth;
if (depth > 0) {
- ret = ocfs2_read_block(inode,
- ocfs2_et_get_last_eb_blk(et),
- &last_eb_bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, ocfs2_et_get_last_eb_blk(et),
+ &last_eb_bh);
if (ret < 0) {
mlog_errno(ret);
goto out;
goto bail;
}
- status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &bh,
- OCFS2_BH_CACHED);
+ status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &bh);
if (status < 0) {
iput(inode);
mlog_errno(status);
if (fe->id2.i_list.l_tree_depth) {
status = ocfs2_read_block(inode, le64_to_cpu(fe->i_last_eb_blk),
- &last_eb_bh, OCFS2_BH_CACHED);
+ &last_eb_bh);
if (status < 0) {
mlog_errno(status);
goto bail;
goto bail;
}
- status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno,
- &bh, OCFS2_BH_CACHED);
+ status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &bh);
if (status < 0) {
mlog_errno(status);
goto bail;
BUG_ON(!PageLocked(page));
BUG_ON(!(OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL));
- ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &di_bh,
- OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &di_bh);
if (ret) {
mlog_errno(ret);
goto out;
static inline int ocfs2_read_block(struct inode *inode,
u64 off,
- struct buffer_head **bh,
- int flags);
+ struct buffer_head **bh);
int ocfs2_write_block(struct ocfs2_super *osb,
struct buffer_head *bh,
#define OCFS2_BH_READAHEAD 8
static inline int ocfs2_read_block(struct inode *inode, u64 off,
- struct buffer_head **bh, int flags)
+ struct buffer_head **bh)
{
int status = 0;
goto bail;
}
- status = ocfs2_read_blocks(inode, off, 1, bh, flags);
+ status = ocfs2_read_blocks(inode, off, 1, bh, OCFS2_BH_CACHED);
bail:
return status;
struct ocfs2_dinode *di;
struct ocfs2_inline_data *data;
- ret = ocfs2_read_block(dir, OCFS2_I(dir)->ip_blkno, &di_bh,
- OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(dir, OCFS2_I(dir)->ip_blkno, &di_bh);
if (ret) {
mlog_errno(ret);
goto out;
struct ocfs2_dinode *di;
struct ocfs2_inline_data *data;
- ret = ocfs2_read_block(dir, OCFS2_I(dir)->ip_blkno,
- &di_bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(dir, OCFS2_I(dir)->ip_blkno, &di_bh);
if (ret) {
mlog_errno(ret);
goto out;
struct ocfs2_inline_data *data;
struct ocfs2_dir_entry *de;
- ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno,
- &di_bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &di_bh);
if (ret) {
mlog(ML_ERROR, "Unable to read inode block for dir %llu\n",
(unsigned long long)OCFS2_I(inode)->ip_blkno);
} else {
/* Boo, we have to go to disk. */
/* read bh, cast, ocfs2_refresh_inode */
- status = ocfs2_read_block(inode, oi->ip_blkno,
- bh, OCFS2_BH_CACHED);
+ status = ocfs2_read_block(inode, oi->ip_blkno, bh);
if (status < 0) {
mlog_errno(status);
goto bail_refresh;
return 0;
}
- status = ocfs2_read_block(inode,
- OCFS2_I(inode)->ip_blkno,
- ret_bh,
- OCFS2_BH_CACHED);
+ status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, ret_bh);
if (status < 0)
mlog_errno(status);
struct ocfs2_extent_block *eb;
struct ocfs2_extent_list *el;
- ret = ocfs2_read_block(inode, last_eb_blk,
- &eb_bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, last_eb_blk, &eb_bh);
if (ret) {
mlog_errno(ret);
goto out;
ret = ocfs2_read_block(inode,
le64_to_cpu(eb->h_next_leaf_blk),
- &next_eb_bh, OCFS2_BH_CACHED);
+ &next_eb_bh);
if (ret) {
mlog_errno(ret);
goto out;
if (ret == 0)
goto out;
- ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno,
- &di_bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &di_bh);
if (ret) {
mlog_errno(ret);
goto out;
*/
BUG_ON(mark_unwritten && !ocfs2_sparse_alloc(osb));
- status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &bh,
- OCFS2_BH_CACHED);
+ status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &bh);
if (status < 0) {
mlog_errno(status);
goto leave;
struct buffer_head *bh = NULL;
struct ocfs2_inode_info *oi = OCFS2_I(inode);
- ret = ocfs2_read_block(inode, oi->ip_blkno, &bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, oi->ip_blkno, &bh);
if (ret < 0) {
mlog_errno(ret);
goto out;
if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno,
- &di_bh, OCFS2_BH_CACHED);
+ &di_bh);
if (ret) {
mlog_errno(ret);
goto out;
}
if (can_lock)
- status = ocfs2_read_block(inode, args->fi_blkno, &bh, 0);
+ status = ocfs2_read_blocks(inode, args->fi_blkno, 1, &bh, 0);
else
status = ocfs2_read_blocks_sync(osb, args->fi_blkno, 1, &bh);
if (status < 0) {
goto fail;
}
- tmperr = ocfs2_read_block(inode, p_blkno, &bh, readflags);
+ tmperr = ocfs2_read_blocks(inode, p_blkno, 1, &bh, readflags);
if (tmperr < 0)
goto fail;
}
SET_INODE_JOURNAL(inode);
- status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, bh, 0);
+ status = ocfs2_read_blocks(inode, OCFS2_I(inode)->ip_blkno, 1, bh, 0);
if (status < 0) {
mlog_errno(status);
goto bail;
goto bail;
}
- status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno,
- &alloc_bh, 0);
+ status = ocfs2_read_blocks(inode, OCFS2_I(inode)->ip_blkno, 1,
+ &alloc_bh, 0);
if (status < 0) {
mlog_errno(status);
goto bail;
mutex_lock(&inode->i_mutex);
- status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno,
- &alloc_bh, 0);
+ status = ocfs2_read_blocks(inode, OCFS2_I(inode)->ip_blkno, 1,
+ &alloc_bh, 0);
if (status < 0) {
mlog_errno(status);
goto bail;
status = ocfs2_read_block(orphan_dir_inode,
OCFS2_I(orphan_dir_inode)->ip_blkno,
- &orphan_dir_bh, OCFS2_BH_CACHED);
+ &orphan_dir_bh);
if (status < 0) {
mlog_errno(status);
goto leave;
lgd_blkno = ocfs2_which_cluster_group(main_bm_inode,
first_new_cluster - 1);
- ret = ocfs2_read_block(main_bm_inode, lgd_blkno, &group_bh,
- OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(main_bm_inode, lgd_blkno, &group_bh);
if (ret < 0) {
mlog_errno(ret);
goto out_unlock;
(unsigned long long)blkno);
bh = NULL; /* Acquire a fresh bh */
- status = ocfs2_read_block(si->si_inode, blkno, &bh, 0);
+ status = ocfs2_read_blocks(si->si_inode, blkno, 1, &bh, 0);
if (status < 0) {
mlog_errno(status);
goto bail;
struct ocfs2_group_desc *gd;
struct inode *alloc_inode = ac->ac_inode;
- ret = ocfs2_read_block(alloc_inode, gd_blkno,
- &group_bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(alloc_inode, gd_blkno, &group_bh);
if (ret < 0) {
mlog_errno(ret);
return ret;
status = ocfs2_read_block(alloc_inode,
le64_to_cpu(cl->cl_recs[chain].c_blkno),
- &group_bh, OCFS2_BH_CACHED);
+ &group_bh);
if (status < 0) {
mlog_errno(status);
goto bail;
prev_group_bh = group_bh;
group_bh = NULL;
status = ocfs2_read_block(alloc_inode,
- next_group, &group_bh,
- OCFS2_BH_CACHED);
+ next_group, &group_bh);
if (status < 0) {
mlog_errno(status);
goto bail;
(unsigned long long)OCFS2_I(alloc_inode)->ip_blkno, count,
(unsigned long long)bg_blkno, start_bit);
- status = ocfs2_read_block(alloc_inode, bg_blkno, &group_bh,
- OCFS2_BH_CACHED);
+ status = ocfs2_read_block(alloc_inode, bg_blkno, &group_bh);
if (status < 0) {
mlog_errno(status);
goto bail;
mlog_entry_void();
- status = ocfs2_read_block(inode,
- OCFS2_I(inode)->ip_blkno,
- bh,
- OCFS2_BH_CACHED);
+ status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, bh);
if (status < 0) {
mlog_errno(status);
link = ERR_PTR(status);
if (!di->i_xattr_loc)
return ret;
- ret = ocfs2_read_block(inode,
- le64_to_cpu(di->i_xattr_loc),
- &blk_bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, le64_to_cpu(di->i_xattr_loc), &blk_bh);
if (ret < 0) {
mlog_errno(ret);
return ret;
blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster);
/* Copy ocfs2_xattr_value */
for (i = 0; i < num_clusters * bpc; i++, blkno++) {
- ret = ocfs2_read_block(inode, blkno,
- &bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, blkno, &bh);
if (ret) {
mlog_errno(ret);
goto out;
memset(&xs->bucket, 0, sizeof(xs->bucket));
- ret = ocfs2_read_block(inode,
- le64_to_cpu(di->i_xattr_loc),
- &blk_bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, le64_to_cpu(di->i_xattr_loc), &blk_bh);
if (ret < 0) {
mlog_errno(ret);
return ret;
blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster);
for (i = 0; i < num_clusters * bpc; i++, blkno++) {
- ret = ocfs2_read_block(inode, blkno,
- &bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, blkno, &bh);
if (ret) {
mlog_errno(ret);
goto out_commit;
u64 blk, bg_blkno;
u16 bit;
- ret = ocfs2_read_block(inode, block, &blk_bh,
- OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, block, &blk_bh);
if (ret < 0) {
mlog_errno(ret);
goto out;
if (!di->i_xattr_loc)
return ret;
- ret = ocfs2_read_block(inode,
- le64_to_cpu(di->i_xattr_loc),
- &blk_bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, le64_to_cpu(di->i_xattr_loc), &blk_bh);
if (ret < 0) {
mlog_errno(ret);
return ret;
break;
}
- ret = ocfs2_read_block(inode,
- header_bh->b_blocknr + block_off,
- &name_bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, header_bh->b_blocknr + block_off,
+ &name_bh);
if (ret) {
mlog_errno(ret);
break;
u32 last_hash;
u64 blkno;
- ret = ocfs2_read_block(inode, p_blkno, &bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, p_blkno, &bh);
if (ret) {
mlog_errno(ret);
goto out;
blkno = p_blkno + bucket * blk_per_bucket;
- ret = ocfs2_read_block(inode, blkno, &bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, blkno, &bh);
if (ret) {
mlog_errno(ret);
goto out;
u64 blkno = bucket->bhs[0]->b_blocknr;
u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
u16 xh_free_start;
- struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
size_t blocksize = inode->i_sb->s_blocksize;
handle_t *handle;
struct buffer_head **bhs;
goto out;
}
- ret = ocfs2_read_block(inode, prev_blkno,
- &old_bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, prev_blkno, &old_bh);
if (ret < 0) {
mlog_errno(ret);
brelse(new_bh);
ocfs2_journal_dirty(handle, first_bh);
/* update the new bucket header. */
- ret = ocfs2_read_block(inode, to_blk_start, &bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, to_blk_start, &bh);
if (ret < 0) {
mlog_errno(ret);
goto out;
goto out;
}
- ret = ocfs2_read_block(inode, p_blkno,
- &first_bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, p_blkno, &first_bh);
if (ret) {
mlog_errno(ret);
goto out;
BUG_ON(value_blk != (offset + OCFS2_XATTR_ROOT_SIZE - 1) / blocksize);
value_blk += header_bh->b_blocknr;
- ret = ocfs2_read_block(inode, value_blk,
- &value_bh, OCFS2_BH_CACHED);
+ ret = ocfs2_read_block(inode, value_blk, &value_bh);
if (ret) {
mlog_errno(ret);
goto out;