diff options
author | Joel Becker <joel.becker@oracle.com> | 2008-10-09 20:20:31 -0400 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2008-10-14 14:51:57 -0400 |
commit | 0fcaa56a2a020dd6f90c202b7084e6f4cbedb6c2 (patch) | |
tree | 057204016523ce0274d4a23ec02944075f084e8c /fs/ocfs2/alloc.c | |
parent | 31d33073ca38603dea705dae45e094a64ca062d6 (diff) |
ocfs2: Simplify ocfs2_read_block()
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>
Diffstat (limited to 'fs/ocfs2/alloc.c')
-rw-r--r-- | fs/ocfs2/alloc.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index a164e09491f8..0cc2deb9394c 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -706,7 +706,7 @@ int ocfs2_num_free_extents(struct ocfs2_super *osb, | |||
706 | 706 | ||
707 | if (last_eb_blk) { | 707 | if (last_eb_blk) { |
708 | retval = ocfs2_read_block(inode, last_eb_blk, | 708 | retval = ocfs2_read_block(inode, last_eb_blk, |
709 | &eb_bh, OCFS2_BH_CACHED); | 709 | &eb_bh); |
710 | if (retval < 0) { | 710 | if (retval < 0) { |
711 | mlog_errno(retval); | 711 | mlog_errno(retval); |
712 | goto bail; | 712 | goto bail; |
@@ -1176,7 +1176,7 @@ static int ocfs2_find_branch_target(struct ocfs2_super *osb, | |||
1176 | brelse(bh); | 1176 | brelse(bh); |
1177 | bh = NULL; | 1177 | bh = NULL; |
1178 | 1178 | ||
1179 | status = ocfs2_read_block(inode, blkno, &bh, OCFS2_BH_CACHED); | 1179 | status = ocfs2_read_block(inode, blkno, &bh); |
1180 | if (status < 0) { | 1180 | if (status < 0) { |
1181 | mlog_errno(status); | 1181 | mlog_errno(status); |
1182 | goto bail; | 1182 | goto bail; |
@@ -1540,7 +1540,7 @@ static int __ocfs2_find_path(struct inode *inode, | |||
1540 | 1540 | ||
1541 | brelse(bh); | 1541 | brelse(bh); |
1542 | bh = NULL; | 1542 | bh = NULL; |
1543 | ret = ocfs2_read_block(inode, blkno, &bh, OCFS2_BH_CACHED); | 1543 | ret = ocfs2_read_block(inode, blkno, &bh); |
1544 | if (ret) { | 1544 | if (ret) { |
1545 | mlog_errno(ret); | 1545 | mlog_errno(ret); |
1546 | goto out; | 1546 | goto out; |
@@ -4294,9 +4294,7 @@ static int ocfs2_figure_insert_type(struct inode *inode, | |||
4294 | * ocfs2_figure_insert_type() and ocfs2_add_branch() | 4294 | * ocfs2_figure_insert_type() and ocfs2_add_branch() |
4295 | * may want it later. | 4295 | * may want it later. |
4296 | */ | 4296 | */ |
4297 | ret = ocfs2_read_block(inode, | 4297 | ret = ocfs2_read_block(inode, ocfs2_et_get_last_eb_blk(et), &bh); |
4298 | ocfs2_et_get_last_eb_blk(et), &bh, | ||
4299 | OCFS2_BH_CACHED); | ||
4300 | if (ret) { | 4298 | if (ret) { |
4301 | mlog_exit(ret); | 4299 | mlog_exit(ret); |
4302 | goto out; | 4300 | goto out; |
@@ -4762,9 +4760,8 @@ static int __ocfs2_mark_extent_written(struct inode *inode, | |||
4762 | if (path->p_tree_depth) { | 4760 | if (path->p_tree_depth) { |
4763 | struct ocfs2_extent_block *eb; | 4761 | struct ocfs2_extent_block *eb; |
4764 | 4762 | ||
4765 | ret = ocfs2_read_block(inode, | 4763 | ret = ocfs2_read_block(inode, ocfs2_et_get_last_eb_blk(et), |
4766 | ocfs2_et_get_last_eb_blk(et), | 4764 | &last_eb_bh); |
4767 | &last_eb_bh, OCFS2_BH_CACHED); | ||
4768 | if (ret) { | 4765 | if (ret) { |
4769 | mlog_exit(ret); | 4766 | mlog_exit(ret); |
4770 | goto out; | 4767 | goto out; |
@@ -4921,9 +4918,8 @@ static int ocfs2_split_tree(struct inode *inode, struct ocfs2_extent_tree *et, | |||
4921 | 4918 | ||
4922 | depth = path->p_tree_depth; | 4919 | depth = path->p_tree_depth; |
4923 | if (depth > 0) { | 4920 | if (depth > 0) { |
4924 | ret = ocfs2_read_block(inode, | 4921 | ret = ocfs2_read_block(inode, ocfs2_et_get_last_eb_blk(et), |
4925 | ocfs2_et_get_last_eb_blk(et), | 4922 | &last_eb_bh); |
4926 | &last_eb_bh, OCFS2_BH_CACHED); | ||
4927 | if (ret < 0) { | 4923 | if (ret < 0) { |
4928 | mlog_errno(ret); | 4924 | mlog_errno(ret); |
4929 | goto out; | 4925 | goto out; |
@@ -5590,8 +5586,7 @@ static int ocfs2_get_truncate_log_info(struct ocfs2_super *osb, | |||
5590 | goto bail; | 5586 | goto bail; |
5591 | } | 5587 | } |
5592 | 5588 | ||
5593 | status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &bh, | 5589 | status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &bh); |
5594 | OCFS2_BH_CACHED); | ||
5595 | if (status < 0) { | 5590 | if (status < 0) { |
5596 | iput(inode); | 5591 | iput(inode); |
5597 | mlog_errno(status); | 5592 | mlog_errno(status); |
@@ -6990,7 +6985,7 @@ int ocfs2_prepare_truncate(struct ocfs2_super *osb, | |||
6990 | 6985 | ||
6991 | if (fe->id2.i_list.l_tree_depth) { | 6986 | if (fe->id2.i_list.l_tree_depth) { |
6992 | status = ocfs2_read_block(inode, le64_to_cpu(fe->i_last_eb_blk), | 6987 | status = ocfs2_read_block(inode, le64_to_cpu(fe->i_last_eb_blk), |
6993 | &last_eb_bh, OCFS2_BH_CACHED); | 6988 | &last_eb_bh); |
6994 | if (status < 0) { | 6989 | if (status < 0) { |
6995 | mlog_errno(status); | 6990 | mlog_errno(status); |
6996 | goto bail; | 6991 | goto bail; |