aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2008-10-09 20:20:31 -0400
committerMark Fasheh <mfasheh@suse.com>2008-10-14 14:51:57 -0400
commit0fcaa56a2a020dd6f90c202b7084e6f4cbedb6c2 (patch)
tree057204016523ce0274d4a23ec02944075f084e8c
parent31d33073ca38603dea705dae45e094a64ca062d6 (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>
-rw-r--r--fs/ocfs2/alloc.c25
-rw-r--r--fs/ocfs2/aops.c6
-rw-r--r--fs/ocfs2/buffer_head_io.h7
-rw-r--r--fs/ocfs2/dir.c9
-rw-r--r--fs/ocfs2/dlmglue.c8
-rw-r--r--fs/ocfs2/extent_map.c8
-rw-r--r--fs/ocfs2/file.c7
-rw-r--r--fs/ocfs2/inode.c4
-rw-r--r--fs/ocfs2/journal.c2
-rw-r--r--fs/ocfs2/localalloc.c8
-rw-r--r--fs/ocfs2/namei.c2
-rw-r--r--fs/ocfs2/resize.c3
-rw-r--r--fs/ocfs2/slot_map.c2
-rw-r--r--fs/ocfs2/suballoc.c11
-rw-r--r--fs/ocfs2/symlink.c5
-rw-r--r--fs/ocfs2/xattr.c42
16 files changed, 55 insertions, 94 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;
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index f232a0e3c30f..c22543b33420 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -68,8 +68,7 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock,
68 goto bail; 68 goto bail;
69 } 69 }
70 70
71 status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, 71 status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &bh);
72 &bh, OCFS2_BH_CACHED);
73 if (status < 0) { 72 if (status < 0) {
74 mlog_errno(status); 73 mlog_errno(status);
75 goto bail; 74 goto bail;
@@ -263,8 +262,7 @@ static int ocfs2_readpage_inline(struct inode *inode, struct page *page)
263 BUG_ON(!PageLocked(page)); 262 BUG_ON(!PageLocked(page));
264 BUG_ON(!(OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL)); 263 BUG_ON(!(OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL));
265 264
266 ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &di_bh, 265 ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &di_bh);
267 OCFS2_BH_CACHED);
268 if (ret) { 266 if (ret) {
269 mlog_errno(ret); 267 mlog_errno(ret);
270 goto out; 268 goto out;
diff --git a/fs/ocfs2/buffer_head_io.h b/fs/ocfs2/buffer_head_io.h
index fd0d774ac356..a2ef9e5f8bfe 100644
--- a/fs/ocfs2/buffer_head_io.h
+++ b/fs/ocfs2/buffer_head_io.h
@@ -33,8 +33,7 @@ void ocfs2_end_buffer_io_sync(struct buffer_head *bh,
33 33
34static inline int ocfs2_read_block(struct inode *inode, 34static inline int ocfs2_read_block(struct inode *inode,
35 u64 off, 35 u64 off,
36 struct buffer_head **bh, 36 struct buffer_head **bh);
37 int flags);
38 37
39int ocfs2_write_block(struct ocfs2_super *osb, 38int ocfs2_write_block(struct ocfs2_super *osb,
40 struct buffer_head *bh, 39 struct buffer_head *bh,
@@ -54,7 +53,7 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
54#define OCFS2_BH_READAHEAD 8 53#define OCFS2_BH_READAHEAD 8
55 54
56static inline int ocfs2_read_block(struct inode *inode, u64 off, 55static inline int ocfs2_read_block(struct inode *inode, u64 off,
57 struct buffer_head **bh, int flags) 56 struct buffer_head **bh)
58{ 57{
59 int status = 0; 58 int status = 0;
60 59
@@ -64,7 +63,7 @@ static inline int ocfs2_read_block(struct inode *inode, u64 off,
64 goto bail; 63 goto bail;
65 } 64 }
66 65
67 status = ocfs2_read_blocks(inode, off, 1, bh, flags); 66 status = ocfs2_read_blocks(inode, off, 1, bh, OCFS2_BH_CACHED);
68 67
69bail: 68bail:
70 return status; 69 return status;
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index 828437ca91ba..459e6b8467dc 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -188,8 +188,7 @@ static struct buffer_head *ocfs2_find_entry_id(const char *name,
188 struct ocfs2_dinode *di; 188 struct ocfs2_dinode *di;
189 struct ocfs2_inline_data *data; 189 struct ocfs2_inline_data *data;
190 190
191 ret = ocfs2_read_block(dir, OCFS2_I(dir)->ip_blkno, &di_bh, 191 ret = ocfs2_read_block(dir, OCFS2_I(dir)->ip_blkno, &di_bh);
192 OCFS2_BH_CACHED);
193 if (ret) { 192 if (ret) {
194 mlog_errno(ret); 193 mlog_errno(ret);
195 goto out; 194 goto out;
@@ -417,8 +416,7 @@ static inline int ocfs2_delete_entry_id(handle_t *handle,
417 struct ocfs2_dinode *di; 416 struct ocfs2_dinode *di;
418 struct ocfs2_inline_data *data; 417 struct ocfs2_inline_data *data;
419 418
420 ret = ocfs2_read_block(dir, OCFS2_I(dir)->ip_blkno, 419 ret = ocfs2_read_block(dir, OCFS2_I(dir)->ip_blkno, &di_bh);
421 &di_bh, OCFS2_BH_CACHED);
422 if (ret) { 420 if (ret) {
423 mlog_errno(ret); 421 mlog_errno(ret);
424 goto out; 422 goto out;
@@ -596,8 +594,7 @@ static int ocfs2_dir_foreach_blk_id(struct inode *inode,
596 struct ocfs2_inline_data *data; 594 struct ocfs2_inline_data *data;
597 struct ocfs2_dir_entry *de; 595 struct ocfs2_dir_entry *de;
598 596
599 ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, 597 ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &di_bh);
600 &di_bh, OCFS2_BH_CACHED);
601 if (ret) { 598 if (ret) {
602 mlog(ML_ERROR, "Unable to read inode block for dir %llu\n", 599 mlog(ML_ERROR, "Unable to read inode block for dir %llu\n",
603 (unsigned long long)OCFS2_I(inode)->ip_blkno); 600 (unsigned long long)OCFS2_I(inode)->ip_blkno);
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 3b2cd0f87210..ec684426034b 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -2024,8 +2024,7 @@ static int ocfs2_inode_lock_update(struct inode *inode,
2024 } else { 2024 } else {
2025 /* Boo, we have to go to disk. */ 2025 /* Boo, we have to go to disk. */
2026 /* read bh, cast, ocfs2_refresh_inode */ 2026 /* read bh, cast, ocfs2_refresh_inode */
2027 status = ocfs2_read_block(inode, oi->ip_blkno, 2027 status = ocfs2_read_block(inode, oi->ip_blkno, bh);
2028 bh, OCFS2_BH_CACHED);
2029 if (status < 0) { 2028 if (status < 0) {
2030 mlog_errno(status); 2029 mlog_errno(status);
2031 goto bail_refresh; 2030 goto bail_refresh;
@@ -2086,10 +2085,7 @@ static int ocfs2_assign_bh(struct inode *inode,
2086 return 0; 2085 return 0;
2087 } 2086 }
2088 2087
2089 status = ocfs2_read_block(inode, 2088 status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, ret_bh);
2090 OCFS2_I(inode)->ip_blkno,
2091 ret_bh,
2092 OCFS2_BH_CACHED);
2093 if (status < 0) 2089 if (status < 0)
2094 mlog_errno(status); 2090 mlog_errno(status);
2095 2091
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c
index 5b482214bb75..2baedac58234 100644
--- a/fs/ocfs2/extent_map.c
+++ b/fs/ocfs2/extent_map.c
@@ -293,8 +293,7 @@ static int ocfs2_last_eb_is_empty(struct inode *inode,
293 struct ocfs2_extent_block *eb; 293 struct ocfs2_extent_block *eb;
294 struct ocfs2_extent_list *el; 294 struct ocfs2_extent_list *el;
295 295
296 ret = ocfs2_read_block(inode, last_eb_blk, 296 ret = ocfs2_read_block(inode, last_eb_blk, &eb_bh);
297 &eb_bh, OCFS2_BH_CACHED);
298 if (ret) { 297 if (ret) {
299 mlog_errno(ret); 298 mlog_errno(ret);
300 goto out; 299 goto out;
@@ -384,7 +383,7 @@ static int ocfs2_figure_hole_clusters(struct inode *inode,
384 383
385 ret = ocfs2_read_block(inode, 384 ret = ocfs2_read_block(inode,
386 le64_to_cpu(eb->h_next_leaf_blk), 385 le64_to_cpu(eb->h_next_leaf_blk),
387 &next_eb_bh, OCFS2_BH_CACHED); 386 &next_eb_bh);
388 if (ret) { 387 if (ret) {
389 mlog_errno(ret); 388 mlog_errno(ret);
390 goto out; 389 goto out;
@@ -631,8 +630,7 @@ int ocfs2_get_clusters(struct inode *inode, u32 v_cluster,
631 if (ret == 0) 630 if (ret == 0)
632 goto out; 631 goto out;
633 632
634 ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, 633 ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &di_bh);
635 &di_bh, OCFS2_BH_CACHED);
636 if (ret) { 634 if (ret) {
637 mlog_errno(ret); 635 mlog_errno(ret);
638 goto out; 636 goto out;
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 7a809be54e84..8d3225a78073 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -545,8 +545,7 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
545 */ 545 */
546 BUG_ON(mark_unwritten && !ocfs2_sparse_alloc(osb)); 546 BUG_ON(mark_unwritten && !ocfs2_sparse_alloc(osb));
547 547
548 status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &bh, 548 status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &bh);
549 OCFS2_BH_CACHED);
550 if (status < 0) { 549 if (status < 0) {
551 mlog_errno(status); 550 mlog_errno(status);
552 goto leave; 551 goto leave;
@@ -1132,7 +1131,7 @@ static int ocfs2_write_remove_suid(struct inode *inode)
1132 struct buffer_head *bh = NULL; 1131 struct buffer_head *bh = NULL;
1133 struct ocfs2_inode_info *oi = OCFS2_I(inode); 1132 struct ocfs2_inode_info *oi = OCFS2_I(inode);
1134 1133
1135 ret = ocfs2_read_block(inode, oi->ip_blkno, &bh, OCFS2_BH_CACHED); 1134 ret = ocfs2_read_block(inode, oi->ip_blkno, &bh);
1136 if (ret < 0) { 1135 if (ret < 0) {
1137 mlog_errno(ret); 1136 mlog_errno(ret);
1138 goto out; 1137 goto out;
@@ -1159,7 +1158,7 @@ static int ocfs2_allocate_unwritten_extents(struct inode *inode,
1159 1158
1160 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { 1159 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
1161 ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, 1160 ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno,
1162 &di_bh, OCFS2_BH_CACHED); 1161 &di_bh);
1163 if (ret) { 1162 if (ret) {
1164 mlog_errno(ret); 1163 mlog_errno(ret);
1165 goto out; 1164 goto out;
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 6ec31b92a47f..c5ee9e3cf80b 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -461,7 +461,7 @@ static int ocfs2_read_locked_inode(struct inode *inode,
461 } 461 }
462 462
463 if (can_lock) 463 if (can_lock)
464 status = ocfs2_read_block(inode, args->fi_blkno, &bh, 0); 464 status = ocfs2_read_blocks(inode, args->fi_blkno, 1, &bh, 0);
465 else 465 else
466 status = ocfs2_read_blocks_sync(osb, args->fi_blkno, 1, &bh); 466 status = ocfs2_read_blocks_sync(osb, args->fi_blkno, 1, &bh);
467 if (status < 0) { 467 if (status < 0) {
@@ -1165,7 +1165,7 @@ struct buffer_head *ocfs2_bread(struct inode *inode,
1165 goto fail; 1165 goto fail;
1166 } 1166 }
1167 1167
1168 tmperr = ocfs2_read_block(inode, p_blkno, &bh, readflags); 1168 tmperr = ocfs2_read_blocks(inode, p_blkno, 1, &bh, readflags);
1169 if (tmperr < 0) 1169 if (tmperr < 0)
1170 goto fail; 1170 goto fail;
1171 1171
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 9854fb7315b6..d161fe5e3bde 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -1134,7 +1134,7 @@ static int ocfs2_read_journal_inode(struct ocfs2_super *osb,
1134 } 1134 }
1135 SET_INODE_JOURNAL(inode); 1135 SET_INODE_JOURNAL(inode);
1136 1136
1137 status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, bh, 0); 1137 status = ocfs2_read_blocks(inode, OCFS2_I(inode)->ip_blkno, 1, bh, 0);
1138 if (status < 0) { 1138 if (status < 0) {
1139 mlog_errno(status); 1139 mlog_errno(status);
1140 goto bail; 1140 goto bail;
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index b77b67bb2776..3ea740d15feb 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -248,8 +248,8 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
248 goto bail; 248 goto bail;
249 } 249 }
250 250
251 status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, 251 status = ocfs2_read_blocks(inode, OCFS2_I(inode)->ip_blkno, 1,
252 &alloc_bh, 0); 252 &alloc_bh, 0);
253 if (status < 0) { 253 if (status < 0) {
254 mlog_errno(status); 254 mlog_errno(status);
255 goto bail; 255 goto bail;
@@ -459,8 +459,8 @@ int ocfs2_begin_local_alloc_recovery(struct ocfs2_super *osb,
459 459
460 mutex_lock(&inode->i_mutex); 460 mutex_lock(&inode->i_mutex);
461 461
462 status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, 462 status = ocfs2_read_blocks(inode, OCFS2_I(inode)->ip_blkno, 1,
463 &alloc_bh, 0); 463 &alloc_bh, 0);
464 if (status < 0) { 464 if (status < 0) {
465 mlog_errno(status); 465 mlog_errno(status);
466 goto bail; 466 goto bail;
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index e5fc9345dd36..485a6aa0ad39 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -1754,7 +1754,7 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb,
1754 1754
1755 status = ocfs2_read_block(orphan_dir_inode, 1755 status = ocfs2_read_block(orphan_dir_inode,
1756 OCFS2_I(orphan_dir_inode)->ip_blkno, 1756 OCFS2_I(orphan_dir_inode)->ip_blkno,
1757 &orphan_dir_bh, OCFS2_BH_CACHED); 1757 &orphan_dir_bh);
1758 if (status < 0) { 1758 if (status < 0) {
1759 mlog_errno(status); 1759 mlog_errno(status);
1760 goto leave; 1760 goto leave;
diff --git a/fs/ocfs2/resize.c b/fs/ocfs2/resize.c
index 92dcd9350560..ffd48db229a7 100644
--- a/fs/ocfs2/resize.c
+++ b/fs/ocfs2/resize.c
@@ -332,8 +332,7 @@ int ocfs2_group_extend(struct inode * inode, int new_clusters)
332 lgd_blkno = ocfs2_which_cluster_group(main_bm_inode, 332 lgd_blkno = ocfs2_which_cluster_group(main_bm_inode,
333 first_new_cluster - 1); 333 first_new_cluster - 1);
334 334
335 ret = ocfs2_read_block(main_bm_inode, lgd_blkno, &group_bh, 335 ret = ocfs2_read_block(main_bm_inode, lgd_blkno, &group_bh);
336 OCFS2_BH_CACHED);
337 if (ret < 0) { 336 if (ret < 0) {
338 mlog_errno(ret); 337 mlog_errno(ret);
339 goto out_unlock; 338 goto out_unlock;
diff --git a/fs/ocfs2/slot_map.c b/fs/ocfs2/slot_map.c
index 82d986bff7fe..357d3fe18c3f 100644
--- a/fs/ocfs2/slot_map.c
+++ b/fs/ocfs2/slot_map.c
@@ -403,7 +403,7 @@ static int ocfs2_map_slot_buffers(struct ocfs2_super *osb,
403 (unsigned long long)blkno); 403 (unsigned long long)blkno);
404 404
405 bh = NULL; /* Acquire a fresh bh */ 405 bh = NULL; /* Acquire a fresh bh */
406 status = ocfs2_read_block(si->si_inode, blkno, &bh, 0); 406 status = ocfs2_read_blocks(si->si_inode, blkno, 1, &bh, 0);
407 if (status < 0) { 407 if (status < 0) {
408 mlog_errno(status); 408 mlog_errno(status);
409 goto bail; 409 goto bail;
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index f0056b7d4353..c5ff18b46b57 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -1172,8 +1172,7 @@ static int ocfs2_search_one_group(struct ocfs2_alloc_context *ac,
1172 struct ocfs2_group_desc *gd; 1172 struct ocfs2_group_desc *gd;
1173 struct inode *alloc_inode = ac->ac_inode; 1173 struct inode *alloc_inode = ac->ac_inode;
1174 1174
1175 ret = ocfs2_read_block(alloc_inode, gd_blkno, 1175 ret = ocfs2_read_block(alloc_inode, gd_blkno, &group_bh);
1176 &group_bh, OCFS2_BH_CACHED);
1177 if (ret < 0) { 1176 if (ret < 0) {
1178 mlog_errno(ret); 1177 mlog_errno(ret);
1179 return ret; 1178 return ret;
@@ -1244,7 +1243,7 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac,
1244 1243
1245 status = ocfs2_read_block(alloc_inode, 1244 status = ocfs2_read_block(alloc_inode,
1246 le64_to_cpu(cl->cl_recs[chain].c_blkno), 1245 le64_to_cpu(cl->cl_recs[chain].c_blkno),
1247 &group_bh, OCFS2_BH_CACHED); 1246 &group_bh);
1248 if (status < 0) { 1247 if (status < 0) {
1249 mlog_errno(status); 1248 mlog_errno(status);
1250 goto bail; 1249 goto bail;
@@ -1273,8 +1272,7 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac,
1273 prev_group_bh = group_bh; 1272 prev_group_bh = group_bh;
1274 group_bh = NULL; 1273 group_bh = NULL;
1275 status = ocfs2_read_block(alloc_inode, 1274 status = ocfs2_read_block(alloc_inode,
1276 next_group, &group_bh, 1275 next_group, &group_bh);
1277 OCFS2_BH_CACHED);
1278 if (status < 0) { 1276 if (status < 0) {
1279 mlog_errno(status); 1277 mlog_errno(status);
1280 goto bail; 1278 goto bail;
@@ -1795,8 +1793,7 @@ int ocfs2_free_suballoc_bits(handle_t *handle,
1795 (unsigned long long)OCFS2_I(alloc_inode)->ip_blkno, count, 1793 (unsigned long long)OCFS2_I(alloc_inode)->ip_blkno, count,
1796 (unsigned long long)bg_blkno, start_bit); 1794 (unsigned long long)bg_blkno, start_bit);
1797 1795
1798 status = ocfs2_read_block(alloc_inode, bg_blkno, &group_bh, 1796 status = ocfs2_read_block(alloc_inode, bg_blkno, &group_bh);
1799 OCFS2_BH_CACHED);
1800 if (status < 0) { 1797 if (status < 0) {
1801 mlog_errno(status); 1798 mlog_errno(status);
1802 goto bail; 1799 goto bail;
diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c
index 8788dc26316d..cbd03dfdc7b9 100644
--- a/fs/ocfs2/symlink.c
+++ b/fs/ocfs2/symlink.c
@@ -84,10 +84,7 @@ static char *ocfs2_fast_symlink_getlink(struct inode *inode,
84 84
85 mlog_entry_void(); 85 mlog_entry_void();
86 86
87 status = ocfs2_read_block(inode, 87 status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, bh);
88 OCFS2_I(inode)->ip_blkno,
89 bh,
90 OCFS2_BH_CACHED);
91 if (status < 0) { 88 if (status < 0) {
92 mlog_errno(status); 89 mlog_errno(status);
93 link = ERR_PTR(status); 90 link = ERR_PTR(status);
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 63037bd7892f..c25780a70dfd 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -537,9 +537,7 @@ static int ocfs2_xattr_block_list(struct inode *inode,
537 if (!di->i_xattr_loc) 537 if (!di->i_xattr_loc)
538 return ret; 538 return ret;
539 539
540 ret = ocfs2_read_block(inode, 540 ret = ocfs2_read_block(inode, le64_to_cpu(di->i_xattr_loc), &blk_bh);
541 le64_to_cpu(di->i_xattr_loc),
542 &blk_bh, OCFS2_BH_CACHED);
543 if (ret < 0) { 541 if (ret < 0) {
544 mlog_errno(ret); 542 mlog_errno(ret);
545 return ret; 543 return ret;
@@ -672,8 +670,7 @@ static int ocfs2_xattr_get_value_outside(struct inode *inode,
672 blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster); 670 blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster);
673 /* Copy ocfs2_xattr_value */ 671 /* Copy ocfs2_xattr_value */
674 for (i = 0; i < num_clusters * bpc; i++, blkno++) { 672 for (i = 0; i < num_clusters * bpc; i++, blkno++) {
675 ret = ocfs2_read_block(inode, blkno, 673 ret = ocfs2_read_block(inode, blkno, &bh);
676 &bh, OCFS2_BH_CACHED);
677 if (ret) { 674 if (ret) {
678 mlog_errno(ret); 675 mlog_errno(ret);
679 goto out; 676 goto out;
@@ -764,9 +761,7 @@ static int ocfs2_xattr_block_get(struct inode *inode,
764 761
765 memset(&xs->bucket, 0, sizeof(xs->bucket)); 762 memset(&xs->bucket, 0, sizeof(xs->bucket));
766 763
767 ret = ocfs2_read_block(inode, 764 ret = ocfs2_read_block(inode, le64_to_cpu(di->i_xattr_loc), &blk_bh);
768 le64_to_cpu(di->i_xattr_loc),
769 &blk_bh, OCFS2_BH_CACHED);
770 if (ret < 0) { 765 if (ret < 0) {
771 mlog_errno(ret); 766 mlog_errno(ret);
772 return ret; 767 return ret;
@@ -922,8 +917,7 @@ static int __ocfs2_xattr_set_value_outside(struct inode *inode,
922 blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster); 917 blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster);
923 918
924 for (i = 0; i < num_clusters * bpc; i++, blkno++) { 919 for (i = 0; i < num_clusters * bpc; i++, blkno++) {
925 ret = ocfs2_read_block(inode, blkno, 920 ret = ocfs2_read_block(inode, blkno, &bh);
926 &bh, OCFS2_BH_CACHED);
927 if (ret) { 921 if (ret) {
928 mlog_errno(ret); 922 mlog_errno(ret);
929 goto out_commit; 923 goto out_commit;
@@ -1514,8 +1508,7 @@ static int ocfs2_xattr_free_block(struct inode *inode,
1514 u64 blk, bg_blkno; 1508 u64 blk, bg_blkno;
1515 u16 bit; 1509 u16 bit;
1516 1510
1517 ret = ocfs2_read_block(inode, block, &blk_bh, 1511 ret = ocfs2_read_block(inode, block, &blk_bh);
1518 OCFS2_BH_CACHED);
1519 if (ret < 0) { 1512 if (ret < 0) {
1520 mlog_errno(ret); 1513 mlog_errno(ret);
1521 goto out; 1514 goto out;
@@ -1773,9 +1766,7 @@ static int ocfs2_xattr_block_find(struct inode *inode,
1773 if (!di->i_xattr_loc) 1766 if (!di->i_xattr_loc)
1774 return ret; 1767 return ret;
1775 1768
1776 ret = ocfs2_read_block(inode, 1769 ret = ocfs2_read_block(inode, le64_to_cpu(di->i_xattr_loc), &blk_bh);
1777 le64_to_cpu(di->i_xattr_loc),
1778 &blk_bh, OCFS2_BH_CACHED);
1779 if (ret < 0) { 1770 if (ret < 0) {
1780 mlog_errno(ret); 1771 mlog_errno(ret);
1781 return ret; 1772 return ret;
@@ -2216,9 +2207,8 @@ static int ocfs2_find_xe_in_bucket(struct inode *inode,
2216 break; 2207 break;
2217 } 2208 }
2218 2209
2219 ret = ocfs2_read_block(inode, 2210 ret = ocfs2_read_block(inode, header_bh->b_blocknr + block_off,
2220 header_bh->b_blocknr + block_off, 2211 &name_bh);
2221 &name_bh, OCFS2_BH_CACHED);
2222 if (ret) { 2212 if (ret) {
2223 mlog_errno(ret); 2213 mlog_errno(ret);
2224 break; 2214 break;
@@ -2269,7 +2259,7 @@ static int ocfs2_xattr_bucket_find(struct inode *inode,
2269 u32 last_hash; 2259 u32 last_hash;
2270 u64 blkno; 2260 u64 blkno;
2271 2261
2272 ret = ocfs2_read_block(inode, p_blkno, &bh, OCFS2_BH_CACHED); 2262 ret = ocfs2_read_block(inode, p_blkno, &bh);
2273 if (ret) { 2263 if (ret) {
2274 mlog_errno(ret); 2264 mlog_errno(ret);
2275 goto out; 2265 goto out;
@@ -2285,7 +2275,7 @@ static int ocfs2_xattr_bucket_find(struct inode *inode,
2285 2275
2286 blkno = p_blkno + bucket * blk_per_bucket; 2276 blkno = p_blkno + bucket * blk_per_bucket;
2287 2277
2288 ret = ocfs2_read_block(inode, blkno, &bh, OCFS2_BH_CACHED); 2278 ret = ocfs2_read_block(inode, blkno, &bh);
2289 if (ret) { 2279 if (ret) {
2290 mlog_errno(ret); 2280 mlog_errno(ret);
2291 goto out; 2281 goto out;
@@ -2898,7 +2888,6 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
2898 u64 blkno = bucket->bhs[0]->b_blocknr; 2888 u64 blkno = bucket->bhs[0]->b_blocknr;
2899 u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb); 2889 u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
2900 u16 xh_free_start; 2890 u16 xh_free_start;
2901 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
2902 size_t blocksize = inode->i_sb->s_blocksize; 2891 size_t blocksize = inode->i_sb->s_blocksize;
2903 handle_t *handle; 2892 handle_t *handle;
2904 struct buffer_head **bhs; 2893 struct buffer_head **bhs;
@@ -3110,8 +3099,7 @@ static int ocfs2_mv_xattr_bucket_cross_cluster(struct inode *inode,
3110 goto out; 3099 goto out;
3111 } 3100 }
3112 3101
3113 ret = ocfs2_read_block(inode, prev_blkno, 3102 ret = ocfs2_read_block(inode, prev_blkno, &old_bh);
3114 &old_bh, OCFS2_BH_CACHED);
3115 if (ret < 0) { 3103 if (ret < 0) {
3116 mlog_errno(ret); 3104 mlog_errno(ret);
3117 brelse(new_bh); 3105 brelse(new_bh);
@@ -3481,7 +3469,7 @@ static int ocfs2_cp_xattr_cluster(struct inode *inode,
3481 ocfs2_journal_dirty(handle, first_bh); 3469 ocfs2_journal_dirty(handle, first_bh);
3482 3470
3483 /* update the new bucket header. */ 3471 /* update the new bucket header. */
3484 ret = ocfs2_read_block(inode, to_blk_start, &bh, OCFS2_BH_CACHED); 3472 ret = ocfs2_read_block(inode, to_blk_start, &bh);
3485 if (ret < 0) { 3473 if (ret < 0) {
3486 mlog_errno(ret); 3474 mlog_errno(ret);
3487 goto out; 3475 goto out;
@@ -3868,8 +3856,7 @@ static int ocfs2_add_new_xattr_bucket(struct inode *inode,
3868 goto out; 3856 goto out;
3869 } 3857 }
3870 3858
3871 ret = ocfs2_read_block(inode, p_blkno, 3859 ret = ocfs2_read_block(inode, p_blkno, &first_bh);
3872 &first_bh, OCFS2_BH_CACHED);
3873 if (ret) { 3860 if (ret) {
3874 mlog_errno(ret); 3861 mlog_errno(ret);
3875 goto out; 3862 goto out;
@@ -4220,8 +4207,7 @@ static int ocfs2_xattr_bucket_value_truncate(struct inode *inode,
4220 BUG_ON(value_blk != (offset + OCFS2_XATTR_ROOT_SIZE - 1) / blocksize); 4207 BUG_ON(value_blk != (offset + OCFS2_XATTR_ROOT_SIZE - 1) / blocksize);
4221 value_blk += header_bh->b_blocknr; 4208 value_blk += header_bh->b_blocknr;
4222 4209
4223 ret = ocfs2_read_block(inode, value_blk, 4210 ret = ocfs2_read_block(inode, value_blk, &value_bh);
4224 &value_bh, OCFS2_BH_CACHED);
4225 if (ret) { 4211 if (ret) {
4226 mlog_errno(ret); 4212 mlog_errno(ret);
4227 goto out; 4213 goto out;