aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2009-02-12 19:41:25 -0500
committerJoel Becker <joel.becker@oracle.com>2009-09-04 19:07:50 -0400
commit0cf2f7632b1789b811ab20b611c4156e6de2b055 (patch)
tree34f7cf3584e4fa2bc187d4b75ce052cb98739b0e /fs/ocfs2
parent292dd27ec76b96cebcef576f330ab121f59ccf05 (diff)
ocfs2: Pass struct ocfs2_caching_info to the journal functions.
The next step in divorcing metadata I/O management from struct inode is to pass struct ocfs2_caching_info to the journal functions. Thus the journal locks a metadata cache with the cache io_lock function. It also can compare ci_last_trans and ci_created_trans directly. This is a large patch because of all the places we change ocfs2_journal_access..(handle, inode, ...) to ocfs2_journal_access..(handle, INODE_CACHE(inode), ...). Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/alloc.c103
-rw-r--r--fs/ocfs2/aops.c4
-rw-r--r--fs/ocfs2/dir.c52
-rw-r--r--fs/ocfs2/dlmglue.c2
-rw-r--r--fs/ocfs2/file.c8
-rw-r--r--fs/ocfs2/inode.c7
-rw-r--r--fs/ocfs2/journal.c65
-rw-r--r--fs/ocfs2/journal.h75
-rw-r--r--fs/ocfs2/localalloc.c10
-rw-r--r--fs/ocfs2/namei.c36
-rw-r--r--fs/ocfs2/ocfs2.h8
-rw-r--r--fs/ocfs2/quota_global.c3
-rw-r--r--fs/ocfs2/quota_local.c20
-rw-r--r--fs/ocfs2/resize.c14
-rw-r--r--fs/ocfs2/suballoc.c29
-rw-r--r--fs/ocfs2/uptodate.h1
-rw-r--r--fs/ocfs2/xattr.c33
17 files changed, 254 insertions, 216 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index d5dffcfa192a..616afa9f7bd1 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -415,11 +415,11 @@ static inline void ocfs2_et_update_clusters(struct inode *inode,
415} 415}
416 416
417static inline int ocfs2_et_root_journal_access(handle_t *handle, 417static inline int ocfs2_et_root_journal_access(handle_t *handle,
418 struct inode *inode, 418 struct ocfs2_caching_info *ci,
419 struct ocfs2_extent_tree *et, 419 struct ocfs2_extent_tree *et,
420 int type) 420 int type)
421{ 421{
422 return et->et_root_journal_access(handle, inode, et->et_root_bh, 422 return et->et_root_journal_access(handle, ci, et->et_root_bh,
423 type); 423 type);
424} 424}
425 425
@@ -633,7 +633,7 @@ static struct ocfs2_path *ocfs2_new_path_from_et(struct ocfs2_extent_tree *et)
633 * ocfs2_journal_access_path(), but I don't have a better one. 633 * ocfs2_journal_access_path(), but I don't have a better one.
634 */ 634 */
635static int ocfs2_path_bh_journal_access(handle_t *handle, 635static int ocfs2_path_bh_journal_access(handle_t *handle,
636 struct inode *inode, 636 struct ocfs2_caching_info *ci,
637 struct ocfs2_path *path, 637 struct ocfs2_path *path,
638 int idx) 638 int idx)
639{ 639{
@@ -645,14 +645,15 @@ static int ocfs2_path_bh_journal_access(handle_t *handle,
645 if (idx) 645 if (idx)
646 access = ocfs2_journal_access_eb; 646 access = ocfs2_journal_access_eb;
647 647
648 return access(handle, inode, path->p_node[idx].bh, 648 return access(handle, ci, path->p_node[idx].bh,
649 OCFS2_JOURNAL_ACCESS_WRITE); 649 OCFS2_JOURNAL_ACCESS_WRITE);
650} 650}
651 651
652/* 652/*
653 * Convenience function to journal all components in a path. 653 * Convenience function to journal all components in a path.
654 */ 654 */
655static int ocfs2_journal_access_path(struct inode *inode, handle_t *handle, 655static int ocfs2_journal_access_path(struct ocfs2_caching_info *ci,
656 handle_t *handle,
656 struct ocfs2_path *path) 657 struct ocfs2_path *path)
657{ 658{
658 int i, ret = 0; 659 int i, ret = 0;
@@ -661,7 +662,7 @@ static int ocfs2_journal_access_path(struct inode *inode, handle_t *handle,
661 goto out; 662 goto out;
662 663
663 for(i = 0; i < path_num_items(path); i++) { 664 for(i = 0; i < path_num_items(path); i++) {
664 ret = ocfs2_path_bh_journal_access(handle, inode, path, i); 665 ret = ocfs2_path_bh_journal_access(handle, ci, path, i);
665 if (ret < 0) { 666 if (ret < 0) {
666 mlog_errno(ret); 667 mlog_errno(ret);
667 goto out; 668 goto out;
@@ -952,7 +953,7 @@ static int ocfs2_create_new_meta_bhs(struct ocfs2_super *osb,
952 ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), 953 ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode),
953 bhs[i]); 954 bhs[i]);
954 955
955 status = ocfs2_journal_access_eb(handle, inode, bhs[i], 956 status = ocfs2_journal_access_eb(handle, INODE_CACHE(inode), bhs[i],
956 OCFS2_JOURNAL_ACCESS_CREATE); 957 OCFS2_JOURNAL_ACCESS_CREATE);
957 if (status < 0) { 958 if (status < 0) {
958 mlog_errno(status); 959 mlog_errno(status);
@@ -1051,7 +1052,7 @@ static int ocfs2_adjust_rightmost_branch(handle_t *handle,
1051 goto out; 1052 goto out;
1052 } 1053 }
1053 1054
1054 status = ocfs2_journal_access_path(inode, handle, path); 1055 status = ocfs2_journal_access_path(INODE_CACHE(inode), handle, path);
1055 if (status < 0) { 1056 if (status < 0) {
1056 mlog_errno(status); 1057 mlog_errno(status);
1057 goto out; 1058 goto out;
@@ -1162,7 +1163,7 @@ static int ocfs2_add_branch(struct ocfs2_super *osb,
1162 BUG_ON(!OCFS2_IS_VALID_EXTENT_BLOCK(eb)); 1163 BUG_ON(!OCFS2_IS_VALID_EXTENT_BLOCK(eb));
1163 eb_el = &eb->h_list; 1164 eb_el = &eb->h_list;
1164 1165
1165 status = ocfs2_journal_access_eb(handle, inode, bh, 1166 status = ocfs2_journal_access_eb(handle, INODE_CACHE(inode), bh,
1166 OCFS2_JOURNAL_ACCESS_CREATE); 1167 OCFS2_JOURNAL_ACCESS_CREATE);
1167 if (status < 0) { 1168 if (status < 0) {
1168 mlog_errno(status); 1169 mlog_errno(status);
@@ -1202,20 +1203,20 @@ static int ocfs2_add_branch(struct ocfs2_super *osb,
1202 * journal_dirty erroring as it won't unless we've aborted the 1203 * journal_dirty erroring as it won't unless we've aborted the
1203 * handle (in which case we would never be here) so reserving 1204 * handle (in which case we would never be here) so reserving
1204 * the write with journal_access is all we need to do. */ 1205 * the write with journal_access is all we need to do. */
1205 status = ocfs2_journal_access_eb(handle, inode, *last_eb_bh, 1206 status = ocfs2_journal_access_eb(handle, INODE_CACHE(inode), *last_eb_bh,
1206 OCFS2_JOURNAL_ACCESS_WRITE); 1207 OCFS2_JOURNAL_ACCESS_WRITE);
1207 if (status < 0) { 1208 if (status < 0) {
1208 mlog_errno(status); 1209 mlog_errno(status);
1209 goto bail; 1210 goto bail;
1210 } 1211 }
1211 status = ocfs2_et_root_journal_access(handle, inode, et, 1212 status = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et,
1212 OCFS2_JOURNAL_ACCESS_WRITE); 1213 OCFS2_JOURNAL_ACCESS_WRITE);
1213 if (status < 0) { 1214 if (status < 0) {
1214 mlog_errno(status); 1215 mlog_errno(status);
1215 goto bail; 1216 goto bail;
1216 } 1217 }
1217 if (eb_bh) { 1218 if (eb_bh) {
1218 status = ocfs2_journal_access_eb(handle, inode, eb_bh, 1219 status = ocfs2_journal_access_eb(handle, INODE_CACHE(inode), eb_bh,
1219 OCFS2_JOURNAL_ACCESS_WRITE); 1220 OCFS2_JOURNAL_ACCESS_WRITE);
1220 if (status < 0) { 1221 if (status < 0) {
1221 mlog_errno(status); 1222 mlog_errno(status);
@@ -1305,7 +1306,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb,
1305 eb_el = &eb->h_list; 1306 eb_el = &eb->h_list;
1306 root_el = et->et_root_el; 1307 root_el = et->et_root_el;
1307 1308
1308 status = ocfs2_journal_access_eb(handle, inode, new_eb_bh, 1309 status = ocfs2_journal_access_eb(handle, INODE_CACHE(inode), new_eb_bh,
1309 OCFS2_JOURNAL_ACCESS_CREATE); 1310 OCFS2_JOURNAL_ACCESS_CREATE);
1310 if (status < 0) { 1311 if (status < 0) {
1311 mlog_errno(status); 1312 mlog_errno(status);
@@ -1324,7 +1325,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb,
1324 goto bail; 1325 goto bail;
1325 } 1326 }
1326 1327
1327 status = ocfs2_et_root_journal_access(handle, inode, et, 1328 status = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et,
1328 OCFS2_JOURNAL_ACCESS_WRITE); 1329 OCFS2_JOURNAL_ACCESS_WRITE);
1329 if (status < 0) { 1330 if (status < 0) {
1330 mlog_errno(status); 1331 mlog_errno(status);
@@ -2095,7 +2096,7 @@ static int ocfs2_rotate_subtree_right(struct inode *inode,
2095 root_bh = left_path->p_node[subtree_index].bh; 2096 root_bh = left_path->p_node[subtree_index].bh;
2096 BUG_ON(root_bh != right_path->p_node[subtree_index].bh); 2097 BUG_ON(root_bh != right_path->p_node[subtree_index].bh);
2097 2098
2098 ret = ocfs2_path_bh_journal_access(handle, inode, right_path, 2099 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), right_path,
2099 subtree_index); 2100 subtree_index);
2100 if (ret) { 2101 if (ret) {
2101 mlog_errno(ret); 2102 mlog_errno(ret);
@@ -2103,14 +2104,14 @@ static int ocfs2_rotate_subtree_right(struct inode *inode,
2103 } 2104 }
2104 2105
2105 for(i = subtree_index + 1; i < path_num_items(right_path); i++) { 2106 for(i = subtree_index + 1; i < path_num_items(right_path); i++) {
2106 ret = ocfs2_path_bh_journal_access(handle, inode, 2107 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
2107 right_path, i); 2108 right_path, i);
2108 if (ret) { 2109 if (ret) {
2109 mlog_errno(ret); 2110 mlog_errno(ret);
2110 goto out; 2111 goto out;
2111 } 2112 }
2112 2113
2113 ret = ocfs2_path_bh_journal_access(handle, inode, 2114 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
2114 left_path, i); 2115 left_path, i);
2115 if (ret) { 2116 if (ret) {
2116 mlog_errno(ret); 2117 mlog_errno(ret);
@@ -2503,7 +2504,7 @@ static int ocfs2_update_edge_lengths(struct inode *inode, handle_t *handle,
2503 goto out; 2504 goto out;
2504 } 2505 }
2505 2506
2506 ret = ocfs2_journal_access_path(inode, handle, path); 2507 ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, path);
2507 if (ret) { 2508 if (ret) {
2508 mlog_errno(ret); 2509 mlog_errno(ret);
2509 goto out; 2510 goto out;
@@ -2654,7 +2655,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,
2654 return -EAGAIN; 2655 return -EAGAIN;
2655 2656
2656 if (le16_to_cpu(right_leaf_el->l_next_free_rec) > 1) { 2657 if (le16_to_cpu(right_leaf_el->l_next_free_rec) > 1) {
2657 ret = ocfs2_journal_access_eb(handle, inode, 2658 ret = ocfs2_journal_access_eb(handle, INODE_CACHE(inode),
2658 path_leaf_bh(right_path), 2659 path_leaf_bh(right_path),
2659 OCFS2_JOURNAL_ACCESS_WRITE); 2660 OCFS2_JOURNAL_ACCESS_WRITE);
2660 if (ret) { 2661 if (ret) {
@@ -2673,7 +2674,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,
2673 * We have to update i_last_eb_blk during the meta 2674 * We have to update i_last_eb_blk during the meta
2674 * data delete. 2675 * data delete.
2675 */ 2676 */
2676 ret = ocfs2_et_root_journal_access(handle, inode, et, 2677 ret = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et,
2677 OCFS2_JOURNAL_ACCESS_WRITE); 2678 OCFS2_JOURNAL_ACCESS_WRITE);
2678 if (ret) { 2679 if (ret) {
2679 mlog_errno(ret); 2680 mlog_errno(ret);
@@ -2689,7 +2690,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,
2689 */ 2690 */
2690 BUG_ON(right_has_empty && !del_right_subtree); 2691 BUG_ON(right_has_empty && !del_right_subtree);
2691 2692
2692 ret = ocfs2_path_bh_journal_access(handle, inode, right_path, 2693 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), right_path,
2693 subtree_index); 2694 subtree_index);
2694 if (ret) { 2695 if (ret) {
2695 mlog_errno(ret); 2696 mlog_errno(ret);
@@ -2697,14 +2698,14 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,
2697 } 2698 }
2698 2699
2699 for(i = subtree_index + 1; i < path_num_items(right_path); i++) { 2700 for(i = subtree_index + 1; i < path_num_items(right_path); i++) {
2700 ret = ocfs2_path_bh_journal_access(handle, inode, 2701 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
2701 right_path, i); 2702 right_path, i);
2702 if (ret) { 2703 if (ret) {
2703 mlog_errno(ret); 2704 mlog_errno(ret);
2704 goto out; 2705 goto out;
2705 } 2706 }
2706 2707
2707 ret = ocfs2_path_bh_journal_access(handle, inode, 2708 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
2708 left_path, i); 2709 left_path, i);
2709 if (ret) { 2710 if (ret) {
2710 mlog_errno(ret); 2711 mlog_errno(ret);
@@ -2864,7 +2865,7 @@ static int ocfs2_rotate_rightmost_leaf_left(struct inode *inode,
2864 if (!ocfs2_is_empty_extent(&el->l_recs[0])) 2865 if (!ocfs2_is_empty_extent(&el->l_recs[0]))
2865 return 0; 2866 return 0;
2866 2867
2867 ret = ocfs2_path_bh_journal_access(handle, inode, path, 2868 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), path,
2868 path_num_items(path) - 1); 2869 path_num_items(path) - 1);
2869 if (ret) { 2870 if (ret) {
2870 mlog_errno(ret); 2871 mlog_errno(ret);
@@ -2947,7 +2948,7 @@ static int __ocfs2_rotate_tree_left(struct inode *inode,
2947 * Caller might still want to make changes to the 2948 * Caller might still want to make changes to the
2948 * tree root, so re-add it to the journal here. 2949 * tree root, so re-add it to the journal here.
2949 */ 2950 */
2950 ret = ocfs2_path_bh_journal_access(handle, inode, 2951 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
2951 left_path, 0); 2952 left_path, 0);
2952 if (ret) { 2953 if (ret) {
2953 mlog_errno(ret); 2954 mlog_errno(ret);
@@ -3025,7 +3026,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,
3025 goto out; 3026 goto out;
3026 } 3027 }
3027 3028
3028 ret = ocfs2_journal_access_path(inode, handle, path); 3029 ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, path);
3029 if (ret) { 3030 if (ret) {
3030 mlog_errno(ret); 3031 mlog_errno(ret);
3031 goto out; 3032 goto out;
@@ -3055,7 +3056,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,
3055 goto out; 3056 goto out;
3056 } 3057 }
3057 3058
3058 ret = ocfs2_journal_access_path(inode, handle, left_path); 3059 ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, left_path);
3059 if (ret) { 3060 if (ret) {
3060 mlog_errno(ret); 3061 mlog_errno(ret);
3061 goto out; 3062 goto out;
@@ -3370,7 +3371,7 @@ static int ocfs2_merge_rec_right(struct inode *inode,
3370 root_bh = left_path->p_node[subtree_index].bh; 3371 root_bh = left_path->p_node[subtree_index].bh;
3371 BUG_ON(root_bh != right_path->p_node[subtree_index].bh); 3372 BUG_ON(root_bh != right_path->p_node[subtree_index].bh);
3372 3373
3373 ret = ocfs2_path_bh_journal_access(handle, inode, right_path, 3374 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), right_path,
3374 subtree_index); 3375 subtree_index);
3375 if (ret) { 3376 if (ret) {
3376 mlog_errno(ret); 3377 mlog_errno(ret);
@@ -3379,14 +3380,14 @@ static int ocfs2_merge_rec_right(struct inode *inode,
3379 3380
3380 for (i = subtree_index + 1; 3381 for (i = subtree_index + 1;
3381 i < path_num_items(right_path); i++) { 3382 i < path_num_items(right_path); i++) {
3382 ret = ocfs2_path_bh_journal_access(handle, inode, 3383 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
3383 right_path, i); 3384 right_path, i);
3384 if (ret) { 3385 if (ret) {
3385 mlog_errno(ret); 3386 mlog_errno(ret);
3386 goto out; 3387 goto out;
3387 } 3388 }
3388 3389
3389 ret = ocfs2_path_bh_journal_access(handle, inode, 3390 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
3390 left_path, i); 3391 left_path, i);
3391 if (ret) { 3392 if (ret) {
3392 mlog_errno(ret); 3393 mlog_errno(ret);
@@ -3399,7 +3400,7 @@ static int ocfs2_merge_rec_right(struct inode *inode,
3399 right_rec = &el->l_recs[index + 1]; 3400 right_rec = &el->l_recs[index + 1];
3400 } 3401 }
3401 3402
3402 ret = ocfs2_path_bh_journal_access(handle, inode, left_path, 3403 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), left_path,
3403 path_num_items(left_path) - 1); 3404 path_num_items(left_path) - 1);
3404 if (ret) { 3405 if (ret) {
3405 mlog_errno(ret); 3406 mlog_errno(ret);
@@ -3539,7 +3540,7 @@ static int ocfs2_merge_rec_left(struct inode *inode,
3539 root_bh = left_path->p_node[subtree_index].bh; 3540 root_bh = left_path->p_node[subtree_index].bh;
3540 BUG_ON(root_bh != right_path->p_node[subtree_index].bh); 3541 BUG_ON(root_bh != right_path->p_node[subtree_index].bh);
3541 3542
3542 ret = ocfs2_path_bh_journal_access(handle, inode, right_path, 3543 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), right_path,
3543 subtree_index); 3544 subtree_index);
3544 if (ret) { 3545 if (ret) {
3545 mlog_errno(ret); 3546 mlog_errno(ret);
@@ -3548,14 +3549,14 @@ static int ocfs2_merge_rec_left(struct inode *inode,
3548 3549
3549 for (i = subtree_index + 1; 3550 for (i = subtree_index + 1;
3550 i < path_num_items(right_path); i++) { 3551 i < path_num_items(right_path); i++) {
3551 ret = ocfs2_path_bh_journal_access(handle, inode, 3552 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
3552 right_path, i); 3553 right_path, i);
3553 if (ret) { 3554 if (ret) {
3554 mlog_errno(ret); 3555 mlog_errno(ret);
3555 goto out; 3556 goto out;
3556 } 3557 }
3557 3558
3558 ret = ocfs2_path_bh_journal_access(handle, inode, 3559 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
3559 left_path, i); 3560 left_path, i);
3560 if (ret) { 3561 if (ret) {
3561 mlog_errno(ret); 3562 mlog_errno(ret);
@@ -3568,7 +3569,7 @@ static int ocfs2_merge_rec_left(struct inode *inode,
3568 has_empty_extent = 1; 3569 has_empty_extent = 1;
3569 } 3570 }
3570 3571
3571 ret = ocfs2_path_bh_journal_access(handle, inode, right_path, 3572 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), right_path,
3572 path_num_items(right_path) - 1); 3573 path_num_items(right_path) - 1);
3573 if (ret) { 3574 if (ret) {
3574 mlog_errno(ret); 3575 mlog_errno(ret);
@@ -4006,7 +4007,7 @@ static int ocfs2_append_rec_to_path(struct inode *inode, handle_t *handle,
4006 } 4007 }
4007 } 4008 }
4008 4009
4009 ret = ocfs2_journal_access_path(inode, handle, right_path); 4010 ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, right_path);
4010 if (ret) { 4011 if (ret) {
4011 mlog_errno(ret); 4012 mlog_errno(ret);
4012 goto out; 4013 goto out;
@@ -4135,7 +4136,7 @@ static int ocfs2_insert_path(struct inode *inode,
4135 goto out; 4136 goto out;
4136 } 4137 }
4137 4138
4138 ret = ocfs2_journal_access_path(inode, handle, left_path); 4139 ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, left_path);
4139 if (ret < 0) { 4140 if (ret < 0) {
4140 mlog_errno(ret); 4141 mlog_errno(ret);
4141 goto out; 4142 goto out;
@@ -4146,7 +4147,7 @@ static int ocfs2_insert_path(struct inode *inode,
4146 * Pass both paths to the journal. The majority of inserts 4147 * Pass both paths to the journal. The majority of inserts
4147 * will be touching all components anyway. 4148 * will be touching all components anyway.
4148 */ 4149 */
4149 ret = ocfs2_journal_access_path(inode, handle, right_path); 4150 ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, right_path);
4150 if (ret < 0) { 4151 if (ret < 0) {
4151 mlog_errno(ret); 4152 mlog_errno(ret);
4152 goto out; 4153 goto out;
@@ -4211,7 +4212,7 @@ static int ocfs2_do_insert_extent(struct inode *inode,
4211 4212
4212 el = et->et_root_el; 4213 el = et->et_root_el;
4213 4214
4214 ret = ocfs2_et_root_journal_access(handle, inode, et, 4215 ret = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et,
4215 OCFS2_JOURNAL_ACCESS_WRITE); 4216 OCFS2_JOURNAL_ACCESS_WRITE);
4216 if (ret) { 4217 if (ret) {
4217 mlog_errno(ret); 4218 mlog_errno(ret);
@@ -4273,7 +4274,7 @@ static int ocfs2_do_insert_extent(struct inode *inode,
4273 * ocfs2_rotate_tree_right() might have extended the 4274 * ocfs2_rotate_tree_right() might have extended the
4274 * transaction without re-journaling our tree root. 4275 * transaction without re-journaling our tree root.
4275 */ 4276 */
4276 ret = ocfs2_et_root_journal_access(handle, inode, et, 4277 ret = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et,
4277 OCFS2_JOURNAL_ACCESS_WRITE); 4278 OCFS2_JOURNAL_ACCESS_WRITE);
4278 if (ret) { 4279 if (ret) {
4279 mlog_errno(ret); 4280 mlog_errno(ret);
@@ -4796,7 +4797,7 @@ int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb,
4796 BUG_ON(num_bits > clusters_to_add); 4797 BUG_ON(num_bits > clusters_to_add);
4797 4798
4798 /* reserve our write early -- insert_extent may update the tree root */ 4799 /* reserve our write early -- insert_extent may update the tree root */
4799 status = ocfs2_et_root_journal_access(handle, inode, et, 4800 status = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et,
4800 OCFS2_JOURNAL_ACCESS_WRITE); 4801 OCFS2_JOURNAL_ACCESS_WRITE);
4801 if (status < 0) { 4802 if (status < 0) {
4802 mlog_errno(status); 4803 mlog_errno(status);
@@ -4971,7 +4972,7 @@ static int ocfs2_replace_extent_rec(struct inode *inode,
4971{ 4972{
4972 int ret; 4973 int ret;
4973 4974
4974 ret = ocfs2_path_bh_journal_access(handle, inode, path, 4975 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), path,
4975 path_num_items(path) - 1); 4976 path_num_items(path) - 1);
4976 if (ret) { 4977 if (ret) {
4977 mlog_errno(ret); 4978 mlog_errno(ret);
@@ -5333,13 +5334,13 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,
5333 goto out; 5334 goto out;
5334 } 5335 }
5335 5336
5336 ret = ocfs2_journal_access_path(inode, handle, path); 5337 ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, path);
5337 if (ret) { 5338 if (ret) {
5338 mlog_errno(ret); 5339 mlog_errno(ret);
5339 goto out; 5340 goto out;
5340 } 5341 }
5341 5342
5342 ret = ocfs2_journal_access_path(inode, handle, left_path); 5343 ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, left_path);
5343 if (ret) { 5344 if (ret) {
5344 mlog_errno(ret); 5345 mlog_errno(ret);
5345 goto out; 5346 goto out;
@@ -5574,7 +5575,7 @@ int ocfs2_remove_btree_range(struct inode *inode,
5574 goto out; 5575 goto out;
5575 } 5576 }
5576 5577
5577 ret = ocfs2_et_root_journal_access(handle, inode, et, 5578 ret = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et,
5578 OCFS2_JOURNAL_ACCESS_WRITE); 5579 OCFS2_JOURNAL_ACCESS_WRITE);
5579 if (ret) { 5580 if (ret) {
5580 mlog_errno(ret); 5581 mlog_errno(ret);
@@ -5691,7 +5692,7 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb,
5691 goto bail; 5692 goto bail;
5692 } 5693 }
5693 5694
5694 status = ocfs2_journal_access_di(handle, tl_inode, tl_bh, 5695 status = ocfs2_journal_access_di(handle, INODE_CACHE(tl_inode), tl_bh,
5695 OCFS2_JOURNAL_ACCESS_WRITE); 5696 OCFS2_JOURNAL_ACCESS_WRITE);
5696 if (status < 0) { 5697 if (status < 0) {
5697 mlog_errno(status); 5698 mlog_errno(status);
@@ -5753,7 +5754,7 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb,
5753 while (i >= 0) { 5754 while (i >= 0) {
5754 /* Caller has given us at least enough credits to 5755 /* Caller has given us at least enough credits to
5755 * update the truncate log dinode */ 5756 * update the truncate log dinode */
5756 status = ocfs2_journal_access_di(handle, tl_inode, tl_bh, 5757 status = ocfs2_journal_access_di(handle, INODE_CACHE(tl_inode), tl_bh,
5757 OCFS2_JOURNAL_ACCESS_WRITE); 5758 OCFS2_JOURNAL_ACCESS_WRITE);
5758 if (status < 0) { 5759 if (status < 0) {
5759 mlog_errno(status); 5760 mlog_errno(status);
@@ -6770,14 +6771,14 @@ static int ocfs2_do_truncate(struct ocfs2_super *osb,
6770 * Each component will be touched, so we might as well journal 6771 * Each component will be touched, so we might as well journal
6771 * here to avoid having to handle errors later. 6772 * here to avoid having to handle errors later.
6772 */ 6773 */
6773 status = ocfs2_journal_access_path(inode, handle, path); 6774 status = ocfs2_journal_access_path(INODE_CACHE(inode), handle, path);
6774 if (status < 0) { 6775 if (status < 0) {
6775 mlog_errno(status); 6776 mlog_errno(status);
6776 goto bail; 6777 goto bail;
6777 } 6778 }
6778 6779
6779 if (last_eb_bh) { 6780 if (last_eb_bh) {
6780 status = ocfs2_journal_access_eb(handle, inode, last_eb_bh, 6781 status = ocfs2_journal_access_eb(handle, INODE_CACHE(inode), last_eb_bh,
6781 OCFS2_JOURNAL_ACCESS_WRITE); 6782 OCFS2_JOURNAL_ACCESS_WRITE);
6782 if (status < 0) { 6783 if (status < 0) {
6783 mlog_errno(status); 6784 mlog_errno(status);
@@ -7139,7 +7140,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
7139 goto out_unlock; 7140 goto out_unlock;
7140 } 7141 }
7141 7142
7142 ret = ocfs2_journal_access_di(handle, inode, di_bh, 7143 ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
7143 OCFS2_JOURNAL_ACCESS_WRITE); 7144 OCFS2_JOURNAL_ACCESS_WRITE);
7144 if (ret) { 7145 if (ret) {
7145 mlog_errno(ret); 7146 mlog_errno(ret);
@@ -7508,7 +7509,7 @@ int ocfs2_truncate_inline(struct inode *inode, struct buffer_head *di_bh,
7508 goto out; 7509 goto out;
7509 } 7510 }
7510 7511
7511 ret = ocfs2_journal_access_di(handle, inode, di_bh, 7512 ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
7512 OCFS2_JOURNAL_ACCESS_WRITE); 7513 OCFS2_JOURNAL_ACCESS_WRITE);
7513 if (ret) { 7514 if (ret) {
7514 mlog_errno(ret); 7515 mlog_errno(ret);
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 8a1e61545f41..49eef2c6f4aa 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -1528,7 +1528,7 @@ static int ocfs2_write_begin_inline(struct address_space *mapping,
1528 goto out; 1528 goto out;
1529 } 1529 }
1530 1530
1531 ret = ocfs2_journal_access_di(handle, inode, wc->w_di_bh, 1531 ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), wc->w_di_bh,
1532 OCFS2_JOURNAL_ACCESS_WRITE); 1532 OCFS2_JOURNAL_ACCESS_WRITE);
1533 if (ret) { 1533 if (ret) {
1534 ocfs2_commit_trans(osb, handle); 1534 ocfs2_commit_trans(osb, handle);
@@ -1773,7 +1773,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,
1773 * We don't want this to fail in ocfs2_write_end(), so do it 1773 * We don't want this to fail in ocfs2_write_end(), so do it
1774 * here. 1774 * here.
1775 */ 1775 */
1776 ret = ocfs2_journal_access_di(handle, inode, wc->w_di_bh, 1776 ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), wc->w_di_bh,
1777 OCFS2_JOURNAL_ACCESS_WRITE); 1777 OCFS2_JOURNAL_ACCESS_WRITE);
1778 if (ret) { 1778 if (ret) {
1779 mlog_errno(ret); 1779 mlog_errno(ret);
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index 273fb7648fce..073ab34b8c2a 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -176,7 +176,7 @@ static int ocfs2_dx_dir_link_trailer(struct inode *dir, handle_t *handle,
176 struct ocfs2_dx_root_block *dx_root; 176 struct ocfs2_dx_root_block *dx_root;
177 struct ocfs2_dir_block_trailer *trailer; 177 struct ocfs2_dir_block_trailer *trailer;
178 178
179 ret = ocfs2_journal_access_dr(handle, dir, dx_root_bh, 179 ret = ocfs2_journal_access_dr(handle, INODE_CACHE(dir), dx_root_bh,
180 OCFS2_JOURNAL_ACCESS_WRITE); 180 OCFS2_JOURNAL_ACCESS_WRITE);
181 if (ret) { 181 if (ret) {
182 mlog_errno(ret); 182 mlog_errno(ret);
@@ -1136,7 +1136,8 @@ int ocfs2_update_entry(struct inode *dir, handle_t *handle,
1136 if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL) 1136 if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
1137 access = ocfs2_journal_access_di; 1137 access = ocfs2_journal_access_di;
1138 1138
1139 ret = access(handle, dir, de_bh, OCFS2_JOURNAL_ACCESS_WRITE); 1139 ret = access(handle, INODE_CACHE(dir), de_bh,
1140 OCFS2_JOURNAL_ACCESS_WRITE);
1140 if (ret) { 1141 if (ret) {
1141 mlog_errno(ret); 1142 mlog_errno(ret);
1142 goto out; 1143 goto out;
@@ -1179,7 +1180,7 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir,
1179 goto bail; 1180 goto bail;
1180 } 1181 }
1181 if (de == de_del) { 1182 if (de == de_del) {
1182 status = access(handle, dir, bh, 1183 status = access(handle, INODE_CACHE(dir), bh,
1183 OCFS2_JOURNAL_ACCESS_WRITE); 1184 OCFS2_JOURNAL_ACCESS_WRITE);
1184 if (status < 0) { 1185 if (status < 0) {
1185 status = -EIO; 1186 status = -EIO;
@@ -1329,7 +1330,7 @@ static int ocfs2_delete_entry_dx(handle_t *handle, struct inode *dir,
1329 * the entry count needs to be updated. Also, we might be 1330 * the entry count needs to be updated. Also, we might be
1330 * adding to the start of the free list. 1331 * adding to the start of the free list.
1331 */ 1332 */
1332 ret = ocfs2_journal_access_dr(handle, dir, dx_root_bh, 1333 ret = ocfs2_journal_access_dr(handle, INODE_CACHE(dir), dx_root_bh,
1333 OCFS2_JOURNAL_ACCESS_WRITE); 1334 OCFS2_JOURNAL_ACCESS_WRITE);
1334 if (ret) { 1335 if (ret) {
1335 mlog_errno(ret); 1336 mlog_errno(ret);
@@ -1337,7 +1338,7 @@ static int ocfs2_delete_entry_dx(handle_t *handle, struct inode *dir,
1337 } 1338 }
1338 1339
1339 if (!ocfs2_dx_root_inline(dx_root)) { 1340 if (!ocfs2_dx_root_inline(dx_root)) {
1340 ret = ocfs2_journal_access_dl(handle, dir, 1341 ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir),
1341 lookup->dl_dx_leaf_bh, 1342 lookup->dl_dx_leaf_bh,
1342 OCFS2_JOURNAL_ACCESS_WRITE); 1343 OCFS2_JOURNAL_ACCESS_WRITE);
1343 if (ret) { 1344 if (ret) {
@@ -1496,7 +1497,7 @@ static int __ocfs2_dx_dir_leaf_insert(struct inode *dir, handle_t *handle,
1496 int ret; 1497 int ret;
1497 struct ocfs2_dx_leaf *dx_leaf; 1498 struct ocfs2_dx_leaf *dx_leaf;
1498 1499
1499 ret = ocfs2_journal_access_dl(handle, dir, dx_leaf_bh, 1500 ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), dx_leaf_bh,
1500 OCFS2_JOURNAL_ACCESS_WRITE); 1501 OCFS2_JOURNAL_ACCESS_WRITE);
1501 if (ret) { 1502 if (ret) {
1502 mlog_errno(ret); 1503 mlog_errno(ret);
@@ -1526,7 +1527,7 @@ static int ocfs2_dx_dir_insert(struct inode *dir, handle_t *handle,
1526 struct ocfs2_dx_root_block *dx_root; 1527 struct ocfs2_dx_root_block *dx_root;
1527 struct buffer_head *dx_root_bh = lookup->dl_dx_root_bh; 1528 struct buffer_head *dx_root_bh = lookup->dl_dx_root_bh;
1528 1529
1529 ret = ocfs2_journal_access_dr(handle, dir, dx_root_bh, 1530 ret = ocfs2_journal_access_dr(handle, INODE_CACHE(dir), dx_root_bh,
1530 OCFS2_JOURNAL_ACCESS_WRITE); 1531 OCFS2_JOURNAL_ACCESS_WRITE);
1531 if (ret) { 1532 if (ret) {
1532 mlog_errno(ret); 1533 mlog_errno(ret);
@@ -1648,11 +1649,13 @@ int __ocfs2_add_entry(handle_t *handle,
1648 */ 1649 */
1649 if (ocfs2_free_list_at_root(lookup)) { 1650 if (ocfs2_free_list_at_root(lookup)) {
1650 bh = lookup->dl_dx_root_bh; 1651 bh = lookup->dl_dx_root_bh;
1651 retval = ocfs2_journal_access_dr(handle, dir, bh, 1652 retval = ocfs2_journal_access_dr(handle,
1653 INODE_CACHE(dir), bh,
1652 OCFS2_JOURNAL_ACCESS_WRITE); 1654 OCFS2_JOURNAL_ACCESS_WRITE);
1653 } else { 1655 } else {
1654 bh = lookup->dl_prev_leaf_bh; 1656 bh = lookup->dl_prev_leaf_bh;
1655 retval = ocfs2_journal_access_db(handle, dir, bh, 1657 retval = ocfs2_journal_access_db(handle,
1658 INODE_CACHE(dir), bh,
1656 OCFS2_JOURNAL_ACCESS_WRITE); 1659 OCFS2_JOURNAL_ACCESS_WRITE);
1657 } 1660 }
1658 if (retval) { 1661 if (retval) {
@@ -1703,11 +1706,13 @@ int __ocfs2_add_entry(handle_t *handle,
1703 } 1706 }
1704 1707
1705 if (insert_bh == parent_fe_bh) 1708 if (insert_bh == parent_fe_bh)
1706 status = ocfs2_journal_access_di(handle, dir, 1709 status = ocfs2_journal_access_di(handle,
1710 INODE_CACHE(dir),
1707 insert_bh, 1711 insert_bh,
1708 OCFS2_JOURNAL_ACCESS_WRITE); 1712 OCFS2_JOURNAL_ACCESS_WRITE);
1709 else { 1713 else {
1710 status = ocfs2_journal_access_db(handle, dir, 1714 status = ocfs2_journal_access_db(handle,
1715 INODE_CACHE(dir),
1711 insert_bh, 1716 insert_bh,
1712 OCFS2_JOURNAL_ACCESS_WRITE); 1717 OCFS2_JOURNAL_ACCESS_WRITE);
1713 1718
@@ -2283,7 +2288,7 @@ static int ocfs2_fill_new_dir_id(struct ocfs2_super *osb,
2283 struct ocfs2_inline_data *data = &di->id2.i_data; 2288 struct ocfs2_inline_data *data = &di->id2.i_data;
2284 unsigned int size = le16_to_cpu(data->id_count); 2289 unsigned int size = le16_to_cpu(data->id_count);
2285 2290
2286 ret = ocfs2_journal_access_di(handle, inode, di_bh, 2291 ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
2287 OCFS2_JOURNAL_ACCESS_WRITE); 2292 OCFS2_JOURNAL_ACCESS_WRITE);
2288 if (ret) { 2293 if (ret) {
2289 mlog_errno(ret); 2294 mlog_errno(ret);
@@ -2337,7 +2342,7 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb,
2337 2342
2338 ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), new_bh); 2343 ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), new_bh);
2339 2344
2340 status = ocfs2_journal_access_db(handle, inode, new_bh, 2345 status = ocfs2_journal_access_db(handle, INODE_CACHE(inode), new_bh,
2341 OCFS2_JOURNAL_ACCESS_CREATE); 2346 OCFS2_JOURNAL_ACCESS_CREATE);
2342 if (status < 0) { 2347 if (status < 0) {
2343 mlog_errno(status); 2348 mlog_errno(status);
@@ -2423,7 +2428,7 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb,
2423 } 2428 }
2424 ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), dx_root_bh); 2429 ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), dx_root_bh);
2425 2430
2426 ret = ocfs2_journal_access_dr(handle, dir, dx_root_bh, 2431 ret = ocfs2_journal_access_dr(handle, INODE_CACHE(dir), dx_root_bh,
2427 OCFS2_JOURNAL_ACCESS_CREATE); 2432 OCFS2_JOURNAL_ACCESS_CREATE);
2428 if (ret < 0) { 2433 if (ret < 0) {
2429 mlog_errno(ret); 2434 mlog_errno(ret);
@@ -2457,7 +2462,7 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb,
2457 if (ret) 2462 if (ret)
2458 mlog_errno(ret); 2463 mlog_errno(ret);
2459 2464
2460 ret = ocfs2_journal_access_di(handle, dir, di_bh, 2465 ret = ocfs2_journal_access_di(handle, INODE_CACHE(dir), di_bh,
2461 OCFS2_JOURNAL_ACCESS_CREATE); 2466 OCFS2_JOURNAL_ACCESS_CREATE);
2462 if (ret) { 2467 if (ret) {
2463 mlog_errno(ret); 2468 mlog_errno(ret);
@@ -2500,7 +2505,7 @@ static int ocfs2_dx_dir_format_cluster(struct ocfs2_super *osb,
2500 2505
2501 ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), bh); 2506 ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), bh);
2502 2507
2503 ret = ocfs2_journal_access_dl(handle, dir, bh, 2508 ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), bh,
2504 OCFS2_JOURNAL_ACCESS_CREATE); 2509 OCFS2_JOURNAL_ACCESS_CREATE);
2505 if (ret < 0) { 2510 if (ret < 0) {
2506 mlog_errno(ret); 2511 mlog_errno(ret);
@@ -3010,7 +3015,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
3010 3015
3011 ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), dirdata_bh); 3016 ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), dirdata_bh);
3012 3017
3013 ret = ocfs2_journal_access_db(handle, dir, dirdata_bh, 3018 ret = ocfs2_journal_access_db(handle, INODE_CACHE(dir), dirdata_bh,
3014 OCFS2_JOURNAL_ACCESS_CREATE); 3019 OCFS2_JOURNAL_ACCESS_CREATE);
3015 if (ret) { 3020 if (ret) {
3016 mlog_errno(ret); 3021 mlog_errno(ret);
@@ -3063,7 +3068,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
3063 * We let the later dirent insert modify c/mtime - to the user 3068 * We let the later dirent insert modify c/mtime - to the user
3064 * the data hasn't changed. 3069 * the data hasn't changed.
3065 */ 3070 */
3066 ret = ocfs2_journal_access_di(handle, dir, di_bh, 3071 ret = ocfs2_journal_access_di(handle, INODE_CACHE(dir), di_bh,
3067 OCFS2_JOURNAL_ACCESS_CREATE); 3072 OCFS2_JOURNAL_ACCESS_CREATE);
3068 if (ret) { 3073 if (ret) {
3069 mlog_errno(ret); 3074 mlog_errno(ret);
@@ -3392,7 +3397,7 @@ do_extend:
3392 3397
3393 ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), new_bh); 3398 ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), new_bh);
3394 3399
3395 status = ocfs2_journal_access_db(handle, dir, new_bh, 3400 status = ocfs2_journal_access_db(handle, INODE_CACHE(dir), new_bh,
3396 OCFS2_JOURNAL_ACCESS_CREATE); 3401 OCFS2_JOURNAL_ACCESS_CREATE);
3397 if (status < 0) { 3402 if (status < 0) {
3398 mlog_errno(status); 3403 mlog_errno(status);
@@ -3888,7 +3893,7 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
3888 } 3893 }
3889 did_quota = 1; 3894 did_quota = 1;
3890 3895
3891 ret = ocfs2_journal_access_dl(handle, dir, dx_leaf_bh, 3896 ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), dx_leaf_bh,
3892 OCFS2_JOURNAL_ACCESS_WRITE); 3897 OCFS2_JOURNAL_ACCESS_WRITE);
3893 if (ret) { 3898 if (ret) {
3894 mlog_errno(ret); 3899 mlog_errno(ret);
@@ -3952,7 +3957,8 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
3952 } 3957 }
3953 3958
3954 for (i = 0; i < num_dx_leaves; i++) { 3959 for (i = 0; i < num_dx_leaves; i++) {
3955 ret = ocfs2_journal_access_dl(handle, dir, orig_dx_leaves[i], 3960 ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir),
3961 orig_dx_leaves[i],
3956 OCFS2_JOURNAL_ACCESS_WRITE); 3962 OCFS2_JOURNAL_ACCESS_WRITE);
3957 if (ret) { 3963 if (ret) {
3958 mlog_errno(ret); 3964 mlog_errno(ret);
@@ -4168,7 +4174,7 @@ static int ocfs2_expand_inline_dx_root(struct inode *dir,
4168 * failure to add the dx_root_bh to the journal won't result 4174 * failure to add the dx_root_bh to the journal won't result
4169 * us losing clusters. 4175 * us losing clusters.
4170 */ 4176 */
4171 ret = ocfs2_journal_access_dr(handle, dir, dx_root_bh, 4177 ret = ocfs2_journal_access_dr(handle, INODE_CACHE(dir), dx_root_bh,
4172 OCFS2_JOURNAL_ACCESS_WRITE); 4178 OCFS2_JOURNAL_ACCESS_WRITE);
4173 if (ret) { 4179 if (ret) {
4174 mlog_errno(ret); 4180 mlog_errno(ret);
@@ -4472,7 +4478,7 @@ static int ocfs2_dx_dir_remove_index(struct inode *dir,
4472 goto out_unlock; 4478 goto out_unlock;
4473 } 4479 }
4474 4480
4475 ret = ocfs2_journal_access_di(handle, dir, di_bh, 4481 ret = ocfs2_journal_access_di(handle, INODE_CACHE(dir), di_bh,
4476 OCFS2_JOURNAL_ACCESS_WRITE); 4482 OCFS2_JOURNAL_ACCESS_WRITE);
4477 if (ret) { 4483 if (ret) {
4478 mlog_errno(ret); 4484 mlog_errno(ret);
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index fe15cee0322a..f518d1bee30a 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -3499,7 +3499,7 @@ static int ocfs2_check_meta_downconvert(struct ocfs2_lock_res *lockres,
3499 int new_level) 3499 int new_level)
3500{ 3500{
3501 struct inode *inode = ocfs2_lock_res_inode(lockres); 3501 struct inode *inode = ocfs2_lock_res_inode(lockres);
3502 int checkpointed = ocfs2_inode_fully_checkpointed(inode); 3502 int checkpointed = ocfs2_ci_fully_checkpointed(INODE_CACHE(inode));
3503 3503
3504 BUG_ON(new_level != DLM_LOCK_NL && new_level != DLM_LOCK_PR); 3504 BUG_ON(new_level != DLM_LOCK_NL && new_level != DLM_LOCK_PR);
3505 BUG_ON(lockres->l_level != DLM_LOCK_EX && !checkpointed); 3505 BUG_ON(lockres->l_level != DLM_LOCK_EX && !checkpointed);
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index aa501d3f93f1..3ddbc5e917e2 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -259,7 +259,7 @@ int ocfs2_update_inode_atime(struct inode *inode,
259 goto out; 259 goto out;
260 } 260 }
261 261
262 ret = ocfs2_journal_access_di(handle, inode, bh, 262 ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), bh,
263 OCFS2_JOURNAL_ACCESS_WRITE); 263 OCFS2_JOURNAL_ACCESS_WRITE);
264 if (ret) { 264 if (ret) {
265 mlog_errno(ret); 265 mlog_errno(ret);
@@ -356,7 +356,7 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb,
356 goto out; 356 goto out;
357 } 357 }
358 358
359 status = ocfs2_journal_access_di(handle, inode, fe_bh, 359 status = ocfs2_journal_access_di(handle, INODE_CACHE(inode), fe_bh,
360 OCFS2_JOURNAL_ACCESS_WRITE); 360 OCFS2_JOURNAL_ACCESS_WRITE);
361 if (status < 0) { 361 if (status < 0) {
362 mlog_errno(status); 362 mlog_errno(status);
@@ -593,7 +593,7 @@ restarted_transaction:
593 /* reserve a write to the file entry early on - that we if we 593 /* reserve a write to the file entry early on - that we if we
594 * run out of credits in the allocation path, we can still 594 * run out of credits in the allocation path, we can still
595 * update i_size. */ 595 * update i_size. */
596 status = ocfs2_journal_access_di(handle, inode, bh, 596 status = ocfs2_journal_access_di(handle, INODE_CACHE(inode), bh,
597 OCFS2_JOURNAL_ACCESS_WRITE); 597 OCFS2_JOURNAL_ACCESS_WRITE);
598 if (status < 0) { 598 if (status < 0) {
599 mlog_errno(status); 599 mlog_errno(status);
@@ -1131,7 +1131,7 @@ static int __ocfs2_write_remove_suid(struct inode *inode,
1131 goto out; 1131 goto out;
1132 } 1132 }
1133 1133
1134 ret = ocfs2_journal_access_di(handle, inode, bh, 1134 ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), bh,
1135 OCFS2_JOURNAL_ACCESS_WRITE); 1135 OCFS2_JOURNAL_ACCESS_WRITE);
1136 if (ret < 0) { 1136 if (ret < 0) {
1137 mlog_errno(ret); 1137 mlog_errno(ret);
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 8a9e7085e99f..179c819e52ec 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -562,7 +562,8 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
562 goto out; 562 goto out;
563 } 563 }
564 564
565 status = ocfs2_journal_access_di(handle, inode, fe_bh, 565 status = ocfs2_journal_access_di(handle, INODE_CACHE(inode),
566 fe_bh,
566 OCFS2_JOURNAL_ACCESS_WRITE); 567 OCFS2_JOURNAL_ACCESS_WRITE);
567 if (status < 0) { 568 if (status < 0) {
568 mlog_errno(status); 569 mlog_errno(status);
@@ -646,7 +647,7 @@ static int ocfs2_remove_inode(struct inode *inode,
646 } 647 }
647 648
648 /* set the inodes dtime */ 649 /* set the inodes dtime */
649 status = ocfs2_journal_access_di(handle, inode, di_bh, 650 status = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
650 OCFS2_JOURNAL_ACCESS_WRITE); 651 OCFS2_JOURNAL_ACCESS_WRITE);
651 if (status < 0) { 652 if (status < 0) {
652 mlog_errno(status); 653 mlog_errno(status);
@@ -1238,7 +1239,7 @@ int ocfs2_mark_inode_dirty(handle_t *handle,
1238 mlog_entry("(inode %llu)\n", 1239 mlog_entry("(inode %llu)\n",
1239 (unsigned long long)OCFS2_I(inode)->ip_blkno); 1240 (unsigned long long)OCFS2_I(inode)->ip_blkno);
1240 1241
1241 status = ocfs2_journal_access_di(handle, inode, bh, 1242 status = ocfs2_journal_access_di(handle, INODE_CACHE(inode), bh,
1242 OCFS2_JOURNAL_ACCESS_WRITE); 1243 OCFS2_JOURNAL_ACCESS_WRITE);
1243 if (status < 0) { 1244 if (status < 0) {
1244 mlog_errno(status); 1245 mlog_errno(status);
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index ddf08d384ba1..5b6c0e441445 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -48,6 +48,7 @@
48#include "slot_map.h" 48#include "slot_map.h"
49#include "super.h" 49#include "super.h"
50#include "sysfile.h" 50#include "sysfile.h"
51#include "uptodate.h"
51#include "quota.h" 52#include "quota.h"
52 53
53#include "buffer_head_io.h" 54#include "buffer_head_io.h"
@@ -601,14 +602,16 @@ static struct ocfs2_triggers dl_triggers = {
601}; 602};
602 603
603static int __ocfs2_journal_access(handle_t *handle, 604static int __ocfs2_journal_access(handle_t *handle,
604 struct inode *inode, 605 struct ocfs2_caching_info *ci,
605 struct buffer_head *bh, 606 struct buffer_head *bh,
606 struct ocfs2_triggers *triggers, 607 struct ocfs2_triggers *triggers,
607 int type) 608 int type)
608{ 609{
609 int status; 610 int status;
611 struct ocfs2_super *osb =
612 OCFS2_SB(ocfs2_metadata_cache_get_super(ci));
610 613
611 BUG_ON(!inode); 614 BUG_ON(!ci || !ci->ci_ops);
612 BUG_ON(!handle); 615 BUG_ON(!handle);
613 BUG_ON(!bh); 616 BUG_ON(!bh);
614 617
@@ -627,15 +630,15 @@ static int __ocfs2_journal_access(handle_t *handle,
627 BUG(); 630 BUG();
628 } 631 }
629 632
630 /* Set the current transaction information on the inode so 633 /* Set the current transaction information on the ci so
631 * that the locking code knows whether it can drop it's locks 634 * that the locking code knows whether it can drop it's locks
632 * on this inode or not. We're protected from the commit 635 * on this ci or not. We're protected from the commit
633 * thread updating the current transaction id until 636 * thread updating the current transaction id until
634 * ocfs2_commit_trans() because ocfs2_start_trans() took 637 * ocfs2_commit_trans() because ocfs2_start_trans() took
635 * j_trans_barrier for us. */ 638 * j_trans_barrier for us. */
636 ocfs2_set_inode_lock_trans(OCFS2_SB(inode->i_sb)->journal, inode); 639 ocfs2_set_ci_lock_trans(osb->journal, ci);
637 640
638 mutex_lock(&OCFS2_I(inode)->ip_io_mutex); 641 ocfs2_metadata_cache_io_lock(ci);
639 switch (type) { 642 switch (type) {
640 case OCFS2_JOURNAL_ACCESS_CREATE: 643 case OCFS2_JOURNAL_ACCESS_CREATE:
641 case OCFS2_JOURNAL_ACCESS_WRITE: 644 case OCFS2_JOURNAL_ACCESS_WRITE:
@@ -650,9 +653,9 @@ static int __ocfs2_journal_access(handle_t *handle,
650 status = -EINVAL; 653 status = -EINVAL;
651 mlog(ML_ERROR, "Uknown access type!\n"); 654 mlog(ML_ERROR, "Uknown access type!\n");
652 } 655 }
653 if (!status && ocfs2_meta_ecc(OCFS2_SB(inode->i_sb)) && triggers) 656 if (!status && ocfs2_meta_ecc(osb) && triggers)
654 jbd2_journal_set_triggers(bh, &triggers->ot_triggers); 657 jbd2_journal_set_triggers(bh, &triggers->ot_triggers);
655 mutex_unlock(&OCFS2_I(inode)->ip_io_mutex); 658 ocfs2_metadata_cache_io_unlock(ci);
656 659
657 if (status < 0) 660 if (status < 0)
658 mlog(ML_ERROR, "Error %d getting %d access to buffer!\n", 661 mlog(ML_ERROR, "Error %d getting %d access to buffer!\n",
@@ -662,66 +665,58 @@ static int __ocfs2_journal_access(handle_t *handle,
662 return status; 665 return status;
663} 666}
664 667
665int ocfs2_journal_access_di(handle_t *handle, struct inode *inode, 668int ocfs2_journal_access_di(handle_t *handle, struct ocfs2_caching_info *ci,
666 struct buffer_head *bh, int type) 669 struct buffer_head *bh, int type)
667{ 670{
668 return __ocfs2_journal_access(handle, inode, bh, &di_triggers, 671 return __ocfs2_journal_access(handle, ci, bh, &di_triggers, type);
669 type);
670} 672}
671 673
672int ocfs2_journal_access_eb(handle_t *handle, struct inode *inode, 674int ocfs2_journal_access_eb(handle_t *handle, struct ocfs2_caching_info *ci,
673 struct buffer_head *bh, int type) 675 struct buffer_head *bh, int type)
674{ 676{
675 return __ocfs2_journal_access(handle, inode, bh, &eb_triggers, 677 return __ocfs2_journal_access(handle, ci, bh, &eb_triggers, type);
676 type);
677} 678}
678 679
679int ocfs2_journal_access_gd(handle_t *handle, struct inode *inode, 680int ocfs2_journal_access_gd(handle_t *handle, struct ocfs2_caching_info *ci,
680 struct buffer_head *bh, int type) 681 struct buffer_head *bh, int type)
681{ 682{
682 return __ocfs2_journal_access(handle, inode, bh, &gd_triggers, 683 return __ocfs2_journal_access(handle, ci, bh, &gd_triggers, type);
683 type);
684} 684}
685 685
686int ocfs2_journal_access_db(handle_t *handle, struct inode *inode, 686int ocfs2_journal_access_db(handle_t *handle, struct ocfs2_caching_info *ci,
687 struct buffer_head *bh, int type) 687 struct buffer_head *bh, int type)
688{ 688{
689 return __ocfs2_journal_access(handle, inode, bh, &db_triggers, 689 return __ocfs2_journal_access(handle, ci, bh, &db_triggers, type);
690 type);
691} 690}
692 691
693int ocfs2_journal_access_xb(handle_t *handle, struct inode *inode, 692int ocfs2_journal_access_xb(handle_t *handle, struct ocfs2_caching_info *ci,
694 struct buffer_head *bh, int type) 693 struct buffer_head *bh, int type)
695{ 694{
696 return __ocfs2_journal_access(handle, inode, bh, &xb_triggers, 695 return __ocfs2_journal_access(handle, ci, bh, &xb_triggers, type);
697 type);
698} 696}
699 697
700int ocfs2_journal_access_dq(handle_t *handle, struct inode *inode, 698int ocfs2_journal_access_dq(handle_t *handle, struct ocfs2_caching_info *ci,
701 struct buffer_head *bh, int type) 699 struct buffer_head *bh, int type)
702{ 700{
703 return __ocfs2_journal_access(handle, inode, bh, &dq_triggers, 701 return __ocfs2_journal_access(handle, ci, bh, &dq_triggers, type);
704 type);
705} 702}
706 703
707int ocfs2_journal_access_dr(handle_t *handle, struct inode *inode, 704int ocfs2_journal_access_dr(handle_t *handle, struct ocfs2_caching_info *ci,
708 struct buffer_head *bh, int type) 705 struct buffer_head *bh, int type)
709{ 706{
710 return __ocfs2_journal_access(handle, inode, bh, &dr_triggers, 707 return __ocfs2_journal_access(handle, ci, bh, &dr_triggers, type);
711 type);
712} 708}
713 709
714int ocfs2_journal_access_dl(handle_t *handle, struct inode *inode, 710int ocfs2_journal_access_dl(handle_t *handle, struct ocfs2_caching_info *ci,
715 struct buffer_head *bh, int type) 711 struct buffer_head *bh, int type)
716{ 712{
717 return __ocfs2_journal_access(handle, inode, bh, &dl_triggers, 713 return __ocfs2_journal_access(handle, ci, bh, &dl_triggers, type);
718 type);
719} 714}
720 715
721int ocfs2_journal_access(handle_t *handle, struct inode *inode, 716int ocfs2_journal_access(handle_t *handle, struct ocfs2_caching_info *ci,
722 struct buffer_head *bh, int type) 717 struct buffer_head *bh, int type)
723{ 718{
724 return __ocfs2_journal_access(handle, inode, bh, NULL, type); 719 return __ocfs2_journal_access(handle, ci, bh, NULL, type);
725} 720}
726 721
727int ocfs2_journal_dirty(handle_t *handle, 722int ocfs2_journal_dirty(handle_t *handle,
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h
index 0bb6754c73f4..6163f28badda 100644
--- a/fs/ocfs2/journal.h
+++ b/fs/ocfs2/journal.h
@@ -90,57 +90,66 @@ static inline unsigned long ocfs2_inc_trans_id(struct ocfs2_journal *j)
90 return old_id; 90 return old_id;
91} 91}
92 92
93static inline void ocfs2_set_inode_lock_trans(struct ocfs2_journal *journal, 93static inline void ocfs2_set_ci_lock_trans(struct ocfs2_journal *journal,
94 struct inode *inode) 94 struct ocfs2_caching_info *ci)
95{ 95{
96 spin_lock(&trans_inc_lock); 96 spin_lock(&trans_inc_lock);
97 INODE_CACHE(inode)->ci_last_trans = journal->j_trans_id; 97 ci->ci_last_trans = journal->j_trans_id;
98 spin_unlock(&trans_inc_lock); 98 spin_unlock(&trans_inc_lock);
99} 99}
100 100
101/* Used to figure out whether it's safe to drop a metadata lock on an 101/* Used to figure out whether it's safe to drop a metadata lock on an
102 * inode. Returns true if all the inodes changes have been 102 * cached object. Returns true if all the object's changes have been
103 * checkpointed to disk. You should be holding the spinlock on the 103 * checkpointed to disk. You should be holding the spinlock on the
104 * metadata lock while calling this to be sure that nobody can take 104 * metadata lock while calling this to be sure that nobody can take
105 * the lock and put it on another transaction. */ 105 * the lock and put it on another transaction. */
106static inline int ocfs2_inode_fully_checkpointed(struct inode *inode) 106static inline int ocfs2_ci_fully_checkpointed(struct ocfs2_caching_info *ci)
107{ 107{
108 int ret; 108 int ret;
109 struct ocfs2_journal *journal = OCFS2_SB(inode->i_sb)->journal; 109 struct ocfs2_journal *journal =
110 OCFS2_SB(ocfs2_metadata_cache_get_super(ci))->journal;
110 111
111 spin_lock(&trans_inc_lock); 112 spin_lock(&trans_inc_lock);
112 ret = time_after(journal->j_trans_id, 113 ret = time_after(journal->j_trans_id, ci->ci_last_trans);
113 INODE_CACHE(inode)->ci_last_trans);
114 spin_unlock(&trans_inc_lock); 114 spin_unlock(&trans_inc_lock);
115 return ret; 115 return ret;
116} 116}
117 117
118/* convenience function to check if an inode is still new (has never 118/* convenience function to check if an object backed by struct
119 * hit disk) Will do you a favor and set created_trans = 0 when you've 119 * ocfs2_caching_info is still new (has never hit disk) Will do you a
120 * been checkpointed. returns '1' if the inode is still new. */ 120 * favor and set created_trans = 0 when you've
121static inline int ocfs2_inode_is_new(struct inode *inode) 121 * been checkpointed. returns '1' if the ci is still new. */
122static inline int ocfs2_ci_is_new(struct ocfs2_caching_info *ci)
122{ 123{
123 int ret; 124 int ret;
125 struct ocfs2_journal *journal =
126 OCFS2_SB(ocfs2_metadata_cache_get_super(ci))->journal;
127
128 spin_lock(&trans_inc_lock);
129 ret = !(time_after(journal->j_trans_id, ci->ci_created_trans));
130 if (!ret)
131 ci->ci_created_trans = 0;
132 spin_unlock(&trans_inc_lock);
133 return ret;
134}
124 135
136/* Wrapper for inodes so we can check system files */
137static inline int ocfs2_inode_is_new(struct inode *inode)
138{
125 /* System files are never "new" as they're written out by 139 /* System files are never "new" as they're written out by
126 * mkfs. This helps us early during mount, before we have the 140 * mkfs. This helps us early during mount, before we have the
127 * journal open and j_trans_id could be junk. */ 141 * journal open and j_trans_id could be junk. */
128 if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE) 142 if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE)
129 return 0; 143 return 0;
130 spin_lock(&trans_inc_lock); 144
131 ret = !(time_after(OCFS2_SB(inode->i_sb)->journal->j_trans_id, 145 return ocfs2_ci_is_new(INODE_CACHE(inode));
132 INODE_CACHE(inode)->ci_created_trans));
133 if (!ret)
134 INODE_CACHE(inode)->ci_created_trans = 0;
135 spin_unlock(&trans_inc_lock);
136 return ret;
137} 146}
138 147
139static inline void ocfs2_inode_set_new(struct ocfs2_super *osb, 148static inline void ocfs2_ci_set_new(struct ocfs2_super *osb,
140 struct inode *inode) 149 struct ocfs2_caching_info *ci)
141{ 150{
142 spin_lock(&trans_inc_lock); 151 spin_lock(&trans_inc_lock);
143 INODE_CACHE(inode)->ci_created_trans = osb->journal->j_trans_id; 152 ci->ci_created_trans = osb->journal->j_trans_id;
144 spin_unlock(&trans_inc_lock); 153 spin_unlock(&trans_inc_lock);
145} 154}
146 155
@@ -201,7 +210,7 @@ static inline void ocfs2_checkpoint_inode(struct inode *inode)
201 if (ocfs2_mount_local(osb)) 210 if (ocfs2_mount_local(osb))
202 return; 211 return;
203 212
204 if (!ocfs2_inode_fully_checkpointed(inode)) { 213 if (!ocfs2_ci_fully_checkpointed(INODE_CACHE(inode))) {
205 /* WARNING: This only kicks off a single 214 /* WARNING: This only kicks off a single
206 * checkpoint. If someone races you and adds more 215 * checkpoint. If someone races you and adds more
207 * metadata to the journal, you won't know, and will 216 * metadata to the journal, you won't know, and will
@@ -211,7 +220,7 @@ static inline void ocfs2_checkpoint_inode(struct inode *inode)
211 ocfs2_start_checkpoint(osb); 220 ocfs2_start_checkpoint(osb);
212 221
213 wait_event(osb->journal->j_checkpointed, 222 wait_event(osb->journal->j_checkpointed,
214 ocfs2_inode_fully_checkpointed(inode)); 223 ocfs2_ci_fully_checkpointed(INODE_CACHE(inode)));
215 } 224 }
216} 225}
217 226
@@ -267,31 +276,31 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks);
267 276
268 277
269/* ocfs2_inode */ 278/* ocfs2_inode */
270int ocfs2_journal_access_di(handle_t *handle, struct inode *inode, 279int ocfs2_journal_access_di(handle_t *handle, struct ocfs2_caching_info *ci,
271 struct buffer_head *bh, int type); 280 struct buffer_head *bh, int type);
272/* ocfs2_extent_block */ 281/* ocfs2_extent_block */
273int ocfs2_journal_access_eb(handle_t *handle, struct inode *inode, 282int ocfs2_journal_access_eb(handle_t *handle, struct ocfs2_caching_info *ci,
274 struct buffer_head *bh, int type); 283 struct buffer_head *bh, int type);
275/* ocfs2_group_desc */ 284/* ocfs2_group_desc */
276int ocfs2_journal_access_gd(handle_t *handle, struct inode *inode, 285int ocfs2_journal_access_gd(handle_t *handle, struct ocfs2_caching_info *ci,
277 struct buffer_head *bh, int type); 286 struct buffer_head *bh, int type);
278/* ocfs2_xattr_block */ 287/* ocfs2_xattr_block */
279int ocfs2_journal_access_xb(handle_t *handle, struct inode *inode, 288int ocfs2_journal_access_xb(handle_t *handle, struct ocfs2_caching_info *ci,
280 struct buffer_head *bh, int type); 289 struct buffer_head *bh, int type);
281/* quota blocks */ 290/* quota blocks */
282int ocfs2_journal_access_dq(handle_t *handle, struct inode *inode, 291int ocfs2_journal_access_dq(handle_t *handle, struct ocfs2_caching_info *ci,
283 struct buffer_head *bh, int type); 292 struct buffer_head *bh, int type);
284/* dirblock */ 293/* dirblock */
285int ocfs2_journal_access_db(handle_t *handle, struct inode *inode, 294int ocfs2_journal_access_db(handle_t *handle, struct ocfs2_caching_info *ci,
286 struct buffer_head *bh, int type); 295 struct buffer_head *bh, int type);
287/* ocfs2_dx_root_block */ 296/* ocfs2_dx_root_block */
288int ocfs2_journal_access_dr(handle_t *handle, struct inode *inode, 297int ocfs2_journal_access_dr(handle_t *handle, struct ocfs2_caching_info *ci,
289 struct buffer_head *bh, int type); 298 struct buffer_head *bh, int type);
290/* ocfs2_dx_leaf */ 299/* ocfs2_dx_leaf */
291int ocfs2_journal_access_dl(handle_t *handle, struct inode *inode, 300int ocfs2_journal_access_dl(handle_t *handle, struct ocfs2_caching_info *ci,
292 struct buffer_head *bh, int type); 301 struct buffer_head *bh, int type);
293/* Anything that has no ecc */ 302/* Anything that has no ecc */
294int ocfs2_journal_access(handle_t *handle, struct inode *inode, 303int ocfs2_journal_access(handle_t *handle, struct ocfs2_caching_info *ci,
295 struct buffer_head *bh, int type); 304 struct buffer_head *bh, int type);
296 305
297/* 306/*
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index da5dd6a70e16..ac10f83edb95 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -297,8 +297,8 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
297 } 297 }
298 memcpy(alloc_copy, alloc, bh->b_size); 298 memcpy(alloc_copy, alloc, bh->b_size);
299 299
300 status = ocfs2_journal_access_di(handle, local_alloc_inode, bh, 300 status = ocfs2_journal_access_di(handle, INODE_CACHE(local_alloc_inode),
301 OCFS2_JOURNAL_ACCESS_WRITE); 301 bh, OCFS2_JOURNAL_ACCESS_WRITE);
302 if (status < 0) { 302 if (status < 0) {
303 mlog_errno(status); 303 mlog_errno(status);
304 goto out_commit; 304 goto out_commit;
@@ -678,7 +678,8 @@ int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb,
678 * delete bits from it! */ 678 * delete bits from it! */
679 *num_bits = bits_wanted; 679 *num_bits = bits_wanted;
680 680
681 status = ocfs2_journal_access_di(handle, local_alloc_inode, 681 status = ocfs2_journal_access_di(handle,
682 INODE_CACHE(local_alloc_inode),
682 osb->local_alloc_bh, 683 osb->local_alloc_bh,
683 OCFS2_JOURNAL_ACCESS_WRITE); 684 OCFS2_JOURNAL_ACCESS_WRITE);
684 if (status < 0) { 685 if (status < 0) {
@@ -1156,7 +1157,8 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
1156 } 1157 }
1157 memcpy(alloc_copy, alloc, osb->local_alloc_bh->b_size); 1158 memcpy(alloc_copy, alloc, osb->local_alloc_bh->b_size);
1158 1159
1159 status = ocfs2_journal_access_di(handle, local_alloc_inode, 1160 status = ocfs2_journal_access_di(handle,
1161 INODE_CACHE(local_alloc_inode),
1160 osb->local_alloc_bh, 1162 osb->local_alloc_bh,
1161 OCFS2_JOURNAL_ACCESS_WRITE); 1163 OCFS2_JOURNAL_ACCESS_WRITE);
1162 if (status < 0) { 1164 if (status < 0) {
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 689761b57a18..c07217ad8796 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -375,7 +375,8 @@ static int ocfs2_mknod(struct inode *dir,
375 goto leave; 375 goto leave;
376 } 376 }
377 377
378 status = ocfs2_journal_access_di(handle, dir, parent_fe_bh, 378 status = ocfs2_journal_access_di(handle, INODE_CACHE(dir),
379 parent_fe_bh,
379 OCFS2_JOURNAL_ACCESS_WRITE); 380 OCFS2_JOURNAL_ACCESS_WRITE);
380 if (status < 0) { 381 if (status < 0) {
381 mlog_errno(status); 382 mlog_errno(status);
@@ -509,7 +510,8 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
509 } 510 }
510 ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), *new_fe_bh); 511 ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), *new_fe_bh);
511 512
512 status = ocfs2_journal_access_di(handle, inode, *new_fe_bh, 513 status = ocfs2_journal_access_di(handle, INODE_CACHE(inode),
514 *new_fe_bh,
513 OCFS2_JOURNAL_ACCESS_CREATE); 515 OCFS2_JOURNAL_ACCESS_CREATE);
514 if (status < 0) { 516 if (status < 0) {
515 mlog_errno(status); 517 mlog_errno(status);
@@ -565,7 +567,7 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
565 } 567 }
566 568
567 ocfs2_populate_inode(inode, fe, 1); 569 ocfs2_populate_inode(inode, fe, 1);
568 ocfs2_inode_set_new(osb, inode); 570 ocfs2_ci_set_new(osb, INODE_CACHE(inode));
569 if (!ocfs2_mount_local(osb)) { 571 if (!ocfs2_mount_local(osb)) {
570 status = ocfs2_create_new_inode_locks(inode); 572 status = ocfs2_create_new_inode_locks(inode);
571 if (status < 0) 573 if (status < 0)
@@ -682,7 +684,7 @@ static int ocfs2_link(struct dentry *old_dentry,
682 goto out_unlock_inode; 684 goto out_unlock_inode;
683 } 685 }
684 686
685 err = ocfs2_journal_access_di(handle, inode, fe_bh, 687 err = ocfs2_journal_access_di(handle, INODE_CACHE(inode), fe_bh,
686 OCFS2_JOURNAL_ACCESS_WRITE); 688 OCFS2_JOURNAL_ACCESS_WRITE);
687 if (err < 0) { 689 if (err < 0) {
688 mlog_errno(err); 690 mlog_errno(err);
@@ -866,7 +868,7 @@ static int ocfs2_unlink(struct inode *dir,
866 goto leave; 868 goto leave;
867 } 869 }
868 870
869 status = ocfs2_journal_access_di(handle, inode, fe_bh, 871 status = ocfs2_journal_access_di(handle, INODE_CACHE(inode), fe_bh,
870 OCFS2_JOURNAL_ACCESS_WRITE); 872 OCFS2_JOURNAL_ACCESS_WRITE);
871 if (status < 0) { 873 if (status < 0) {
872 mlog_errno(status); 874 mlog_errno(status);
@@ -1284,7 +1286,8 @@ static int ocfs2_rename(struct inode *old_dir,
1284 goto bail; 1286 goto bail;
1285 } 1287 }
1286 } 1288 }
1287 status = ocfs2_journal_access_di(handle, new_inode, newfe_bh, 1289 status = ocfs2_journal_access_di(handle, INODE_CACHE(new_inode),
1290 newfe_bh,
1288 OCFS2_JOURNAL_ACCESS_WRITE); 1291 OCFS2_JOURNAL_ACCESS_WRITE);
1289 if (status < 0) { 1292 if (status < 0) {
1290 mlog_errno(status); 1293 mlog_errno(status);
@@ -1331,7 +1334,8 @@ static int ocfs2_rename(struct inode *old_dir,
1331 old_inode->i_ctime = CURRENT_TIME; 1334 old_inode->i_ctime = CURRENT_TIME;
1332 mark_inode_dirty(old_inode); 1335 mark_inode_dirty(old_inode);
1333 1336
1334 status = ocfs2_journal_access_di(handle, old_inode, old_inode_bh, 1337 status = ocfs2_journal_access_di(handle, INODE_CACHE(old_inode),
1338 old_inode_bh,
1335 OCFS2_JOURNAL_ACCESS_WRITE); 1339 OCFS2_JOURNAL_ACCESS_WRITE);
1336 if (status >= 0) { 1340 if (status >= 0) {
1337 old_di = (struct ocfs2_dinode *) old_inode_bh->b_data; 1341 old_di = (struct ocfs2_dinode *) old_inode_bh->b_data;
@@ -1407,9 +1411,10 @@ static int ocfs2_rename(struct inode *old_dir,
1407 (int)old_dir_nlink, old_dir->i_nlink); 1411 (int)old_dir_nlink, old_dir->i_nlink);
1408 } else { 1412 } else {
1409 struct ocfs2_dinode *fe; 1413 struct ocfs2_dinode *fe;
1410 status = ocfs2_journal_access_di(handle, old_dir, 1414 status = ocfs2_journal_access_di(handle,
1411 old_dir_bh, 1415 INODE_CACHE(old_dir),
1412 OCFS2_JOURNAL_ACCESS_WRITE); 1416 old_dir_bh,
1417 OCFS2_JOURNAL_ACCESS_WRITE);
1413 fe = (struct ocfs2_dinode *) old_dir_bh->b_data; 1418 fe = (struct ocfs2_dinode *) old_dir_bh->b_data;
1414 ocfs2_set_links_count(fe, old_dir->i_nlink); 1419 ocfs2_set_links_count(fe, old_dir->i_nlink);
1415 status = ocfs2_journal_dirty(handle, old_dir_bh); 1420 status = ocfs2_journal_dirty(handle, old_dir_bh);
@@ -1530,7 +1535,8 @@ static int ocfs2_create_symlink_data(struct ocfs2_super *osb,
1530 ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), 1535 ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode),
1531 bhs[virtual]); 1536 bhs[virtual]);
1532 1537
1533 status = ocfs2_journal_access(handle, inode, bhs[virtual], 1538 status = ocfs2_journal_access(handle, INODE_CACHE(inode),
1539 bhs[virtual],
1534 OCFS2_JOURNAL_ACCESS_CREATE); 1540 OCFS2_JOURNAL_ACCESS_CREATE);
1535 if (status < 0) { 1541 if (status < 0) {
1536 mlog_errno(status); 1542 mlog_errno(status);
@@ -1918,7 +1924,9 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb,
1918 goto leave; 1924 goto leave;
1919 } 1925 }
1920 1926
1921 status = ocfs2_journal_access_di(handle, orphan_dir_inode, orphan_dir_bh, 1927 status = ocfs2_journal_access_di(handle,
1928 INODE_CACHE(orphan_dir_inode),
1929 orphan_dir_bh,
1922 OCFS2_JOURNAL_ACCESS_WRITE); 1930 OCFS2_JOURNAL_ACCESS_WRITE);
1923 if (status < 0) { 1931 if (status < 0) {
1924 mlog_errno(status); 1932 mlog_errno(status);
@@ -2003,7 +2011,9 @@ int ocfs2_orphan_del(struct ocfs2_super *osb,
2003 goto leave; 2011 goto leave;
2004 } 2012 }
2005 2013
2006 status = ocfs2_journal_access_di(handle,orphan_dir_inode, orphan_dir_bh, 2014 status = ocfs2_journal_access_di(handle,
2015 INODE_CACHE(orphan_dir_inode),
2016 orphan_dir_bh,
2007 OCFS2_JOURNAL_ACCESS_WRITE); 2017 OCFS2_JOURNAL_ACCESS_WRITE);
2008 if (status < 0) { 2018 if (status < 0) {
2009 mlog_errno(status); 2019 mlog_errno(status);
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 18b5fea98c91..d370262b3621 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -91,6 +91,11 @@ struct ocfs2_caching_info {
91 struct rb_root ci_tree; 91 struct rb_root ci_tree;
92 } ci_cache; 92 } ci_cache;
93}; 93};
94/*
95 * Need this prototype here instead of in uptodate.h because journal.h
96 * uses it.
97 */
98struct super_block *ocfs2_metadata_cache_get_super(struct ocfs2_caching_info *ci);
94 99
95/* this limits us to 256 nodes 100/* this limits us to 256 nodes
96 * if we need more, we can do a kmalloc for the map */ 101 * if we need more, we can do a kmalloc for the map */
@@ -408,7 +413,8 @@ struct ocfs2_super
408#define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info) 413#define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info)
409 414
410/* Useful typedef for passing around journal access functions */ 415/* Useful typedef for passing around journal access functions */
411typedef int (*ocfs2_journal_access_func)(handle_t *handle, struct inode *inode, 416typedef int (*ocfs2_journal_access_func)(handle_t *handle,
417 struct ocfs2_caching_info *ci,
412 struct buffer_head *bh, int type); 418 struct buffer_head *bh, int type);
413 419
414static inline int ocfs2_should_order_data(struct inode *inode) 420static inline int ocfs2_should_order_data(struct inode *inode)
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index 0d7125bb71d9..7eadf8bf1e1f 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -254,7 +254,8 @@ ssize_t ocfs2_quota_write(struct super_block *sb, int type,
254 set_buffer_uptodate(bh); 254 set_buffer_uptodate(bh);
255 unlock_buffer(bh); 255 unlock_buffer(bh);
256 ocfs2_set_buffer_uptodate(INODE_CACHE(gqinode), bh); 256 ocfs2_set_buffer_uptodate(INODE_CACHE(gqinode), bh);
257 err = ocfs2_journal_access_dq(handle, gqinode, bh, ja_type); 257 err = ocfs2_journal_access_dq(handle, INODE_CACHE(gqinode), bh,
258 ja_type);
258 if (err < 0) { 259 if (err < 0) {
259 brelse(bh); 260 brelse(bh);
260 goto out; 261 goto out;
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
index 3df2954ac83b..1a2c50a759fa 100644
--- a/fs/ocfs2/quota_local.c
+++ b/fs/ocfs2/quota_local.c
@@ -108,7 +108,7 @@ static int ocfs2_modify_bh(struct inode *inode, struct buffer_head *bh,
108 mlog_errno(status); 108 mlog_errno(status);
109 return status; 109 return status;
110 } 110 }
111 status = ocfs2_journal_access_dq(handle, inode, bh, 111 status = ocfs2_journal_access_dq(handle, INODE_CACHE(inode), bh,
112 OCFS2_JOURNAL_ACCESS_WRITE); 112 OCFS2_JOURNAL_ACCESS_WRITE);
113 if (status < 0) { 113 if (status < 0) {
114 mlog_errno(status); 114 mlog_errno(status);
@@ -510,7 +510,8 @@ static int ocfs2_recover_local_quota_file(struct inode *lqinode,
510 goto out_commit; 510 goto out_commit;
511 } 511 }
512 /* Release local quota file entry */ 512 /* Release local quota file entry */
513 status = ocfs2_journal_access_dq(handle, lqinode, 513 status = ocfs2_journal_access_dq(handle,
514 INODE_CACHE(lqinode),
514 qbh, OCFS2_JOURNAL_ACCESS_WRITE); 515 qbh, OCFS2_JOURNAL_ACCESS_WRITE);
515 if (status < 0) { 516 if (status < 0) {
516 mlog_errno(status); 517 mlog_errno(status);
@@ -619,7 +620,8 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,
619 mlog_errno(status); 620 mlog_errno(status);
620 goto out_bh; 621 goto out_bh;
621 } 622 }
622 status = ocfs2_journal_access_dq(handle, lqinode, bh, 623 status = ocfs2_journal_access_dq(handle, INODE_CACHE(lqinode),
624 bh,
623 OCFS2_JOURNAL_ACCESS_WRITE); 625 OCFS2_JOURNAL_ACCESS_WRITE);
624 if (status < 0) { 626 if (status < 0) {
625 mlog_errno(status); 627 mlog_errno(status);
@@ -994,7 +996,7 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk(
994 } 996 }
995 dchunk = (struct ocfs2_local_disk_chunk *)bh->b_data; 997 dchunk = (struct ocfs2_local_disk_chunk *)bh->b_data;
996 ocfs2_set_new_buffer_uptodate(INODE_CACHE(lqinode), bh); 998 ocfs2_set_new_buffer_uptodate(INODE_CACHE(lqinode), bh);
997 status = ocfs2_journal_access_dq(handle, lqinode, bh, 999 status = ocfs2_journal_access_dq(handle, INODE_CACHE(lqinode), bh,
998 OCFS2_JOURNAL_ACCESS_CREATE); 1000 OCFS2_JOURNAL_ACCESS_CREATE);
999 if (status < 0) { 1001 if (status < 0) {
1000 mlog_errno(status); 1002 mlog_errno(status);
@@ -1028,7 +1030,7 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk(
1028 goto out_trans; 1030 goto out_trans;
1029 } 1031 }
1030 ocfs2_set_new_buffer_uptodate(INODE_CACHE(lqinode), dbh); 1032 ocfs2_set_new_buffer_uptodate(INODE_CACHE(lqinode), dbh);
1031 status = ocfs2_journal_access_dq(handle, lqinode, dbh, 1033 status = ocfs2_journal_access_dq(handle, INODE_CACHE(lqinode), dbh,
1032 OCFS2_JOURNAL_ACCESS_CREATE); 1034 OCFS2_JOURNAL_ACCESS_CREATE);
1033 if (status < 0) { 1035 if (status < 0) {
1034 mlog_errno(status); 1036 mlog_errno(status);
@@ -1143,7 +1145,7 @@ static struct ocfs2_quota_chunk *ocfs2_extend_local_quota_file(
1143 goto out; 1145 goto out;
1144 } 1146 }
1145 /* Zero created block */ 1147 /* Zero created block */
1146 status = ocfs2_journal_access_dq(handle, lqinode, bh, 1148 status = ocfs2_journal_access_dq(handle, INODE_CACHE(lqinode), bh,
1147 OCFS2_JOURNAL_ACCESS_CREATE); 1149 OCFS2_JOURNAL_ACCESS_CREATE);
1148 if (status < 0) { 1150 if (status < 0) {
1149 mlog_errno(status); 1151 mlog_errno(status);
@@ -1158,7 +1160,8 @@ static struct ocfs2_quota_chunk *ocfs2_extend_local_quota_file(
1158 goto out_trans; 1160 goto out_trans;
1159 } 1161 }
1160 /* Update chunk header */ 1162 /* Update chunk header */
1161 status = ocfs2_journal_access_dq(handle, lqinode, chunk->qc_headerbh, 1163 status = ocfs2_journal_access_dq(handle, INODE_CACHE(lqinode),
1164 chunk->qc_headerbh,
1162 OCFS2_JOURNAL_ACCESS_WRITE); 1165 OCFS2_JOURNAL_ACCESS_WRITE);
1163 if (status < 0) { 1166 if (status < 0) {
1164 mlog_errno(status); 1167 mlog_errno(status);
@@ -1292,7 +1295,8 @@ static int ocfs2_local_release_dquot(struct dquot *dquot)
1292 goto out; 1295 goto out;
1293 } 1296 }
1294 1297
1295 status = ocfs2_journal_access_dq(handle, sb_dqopt(sb)->files[type], 1298 status = ocfs2_journal_access_dq(handle,
1299 INODE_CACHE(sb_dqopt(sb)->files[type]),
1296 od->dq_chunk->qc_headerbh, OCFS2_JOURNAL_ACCESS_WRITE); 1300 od->dq_chunk->qc_headerbh, OCFS2_JOURNAL_ACCESS_WRITE);
1297 if (status < 0) { 1301 if (status < 0) {
1298 mlog_errno(status); 1302 mlog_errno(status);
diff --git a/fs/ocfs2/resize.c b/fs/ocfs2/resize.c
index 7465f0fded77..3c3d673a4d20 100644
--- a/fs/ocfs2/resize.c
+++ b/fs/ocfs2/resize.c
@@ -106,8 +106,8 @@ static int ocfs2_update_last_group_and_inode(handle_t *handle,
106 mlog_entry("(new_clusters=%d, first_new_cluster = %u)\n", 106 mlog_entry("(new_clusters=%d, first_new_cluster = %u)\n",
107 new_clusters, first_new_cluster); 107 new_clusters, first_new_cluster);
108 108
109 ret = ocfs2_journal_access_gd(handle, bm_inode, group_bh, 109 ret = ocfs2_journal_access_gd(handle, INODE_CACHE(bm_inode),
110 OCFS2_JOURNAL_ACCESS_WRITE); 110 group_bh, OCFS2_JOURNAL_ACCESS_WRITE);
111 if (ret < 0) { 111 if (ret < 0) {
112 mlog_errno(ret); 112 mlog_errno(ret);
113 goto out; 113 goto out;
@@ -141,7 +141,7 @@ static int ocfs2_update_last_group_and_inode(handle_t *handle,
141 } 141 }
142 142
143 /* update the inode accordingly. */ 143 /* update the inode accordingly. */
144 ret = ocfs2_journal_access_di(handle, bm_inode, bm_bh, 144 ret = ocfs2_journal_access_di(handle, INODE_CACHE(bm_inode), bm_bh,
145 OCFS2_JOURNAL_ACCESS_WRITE); 145 OCFS2_JOURNAL_ACCESS_WRITE);
146 if (ret < 0) { 146 if (ret < 0) {
147 mlog_errno(ret); 147 mlog_errno(ret);
@@ -536,8 +536,8 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input)
536 cl = &fe->id2.i_chain; 536 cl = &fe->id2.i_chain;
537 cr = &cl->cl_recs[input->chain]; 537 cr = &cl->cl_recs[input->chain];
538 538
539 ret = ocfs2_journal_access_gd(handle, main_bm_inode, group_bh, 539 ret = ocfs2_journal_access_gd(handle, INODE_CACHE(main_bm_inode),
540 OCFS2_JOURNAL_ACCESS_WRITE); 540 group_bh, OCFS2_JOURNAL_ACCESS_WRITE);
541 if (ret < 0) { 541 if (ret < 0) {
542 mlog_errno(ret); 542 mlog_errno(ret);
543 goto out_commit; 543 goto out_commit;
@@ -552,8 +552,8 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input)
552 goto out_commit; 552 goto out_commit;
553 } 553 }
554 554
555 ret = ocfs2_journal_access_di(handle, main_bm_inode, main_bm_bh, 555 ret = ocfs2_journal_access_di(handle, INODE_CACHE(main_bm_inode),
556 OCFS2_JOURNAL_ACCESS_WRITE); 556 main_bm_bh, OCFS2_JOURNAL_ACCESS_WRITE);
557 if (ret < 0) { 557 if (ret < 0) {
558 mlog_errno(ret); 558 mlog_errno(ret);
559 goto out_commit; 559 goto out_commit;
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index 21aaaaaaa2d3..a6c442c82e3d 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -352,7 +352,7 @@ static int ocfs2_block_group_fill(handle_t *handle,
352 } 352 }
353 353
354 status = ocfs2_journal_access_gd(handle, 354 status = ocfs2_journal_access_gd(handle,
355 alloc_inode, 355 INODE_CACHE(alloc_inode),
356 bg_bh, 356 bg_bh,
357 OCFS2_JOURNAL_ACCESS_CREATE); 357 OCFS2_JOURNAL_ACCESS_CREATE);
358 if (status < 0) { 358 if (status < 0) {
@@ -491,7 +491,7 @@ static int ocfs2_block_group_alloc(struct ocfs2_super *osb,
491 491
492 bg = (struct ocfs2_group_desc *) bg_bh->b_data; 492 bg = (struct ocfs2_group_desc *) bg_bh->b_data;
493 493
494 status = ocfs2_journal_access_di(handle, alloc_inode, 494 status = ocfs2_journal_access_di(handle, INODE_CACHE(alloc_inode),
495 bh, OCFS2_JOURNAL_ACCESS_WRITE); 495 bh, OCFS2_JOURNAL_ACCESS_WRITE);
496 if (status < 0) { 496 if (status < 0) {
497 mlog_errno(status); 497 mlog_errno(status);
@@ -1033,7 +1033,7 @@ static inline int ocfs2_block_group_set_bits(handle_t *handle,
1033 journal_type = OCFS2_JOURNAL_ACCESS_UNDO; 1033 journal_type = OCFS2_JOURNAL_ACCESS_UNDO;
1034 1034
1035 status = ocfs2_journal_access_gd(handle, 1035 status = ocfs2_journal_access_gd(handle,
1036 alloc_inode, 1036 INODE_CACHE(alloc_inode),
1037 group_bh, 1037 group_bh,
1038 journal_type); 1038 journal_type);
1039 if (status < 0) { 1039 if (status < 0) {
@@ -1106,7 +1106,8 @@ static int ocfs2_relink_block_group(handle_t *handle,
1106 bg_ptr = le64_to_cpu(bg->bg_next_group); 1106 bg_ptr = le64_to_cpu(bg->bg_next_group);
1107 prev_bg_ptr = le64_to_cpu(prev_bg->bg_next_group); 1107 prev_bg_ptr = le64_to_cpu(prev_bg->bg_next_group);
1108 1108
1109 status = ocfs2_journal_access_gd(handle, alloc_inode, prev_bg_bh, 1109 status = ocfs2_journal_access_gd(handle, INODE_CACHE(alloc_inode),
1110 prev_bg_bh,
1110 OCFS2_JOURNAL_ACCESS_WRITE); 1111 OCFS2_JOURNAL_ACCESS_WRITE);
1111 if (status < 0) { 1112 if (status < 0) {
1112 mlog_errno(status); 1113 mlog_errno(status);
@@ -1121,8 +1122,8 @@ static int ocfs2_relink_block_group(handle_t *handle,
1121 goto out_rollback; 1122 goto out_rollback;
1122 } 1123 }
1123 1124
1124 status = ocfs2_journal_access_gd(handle, alloc_inode, bg_bh, 1125 status = ocfs2_journal_access_gd(handle, INODE_CACHE(alloc_inode),
1125 OCFS2_JOURNAL_ACCESS_WRITE); 1126 bg_bh, OCFS2_JOURNAL_ACCESS_WRITE);
1126 if (status < 0) { 1127 if (status < 0) {
1127 mlog_errno(status); 1128 mlog_errno(status);
1128 goto out_rollback; 1129 goto out_rollback;
@@ -1136,8 +1137,8 @@ static int ocfs2_relink_block_group(handle_t *handle,
1136 goto out_rollback; 1137 goto out_rollback;
1137 } 1138 }
1138 1139
1139 status = ocfs2_journal_access_di(handle, alloc_inode, fe_bh, 1140 status = ocfs2_journal_access_di(handle, INODE_CACHE(alloc_inode),
1140 OCFS2_JOURNAL_ACCESS_WRITE); 1141 fe_bh, OCFS2_JOURNAL_ACCESS_WRITE);
1141 if (status < 0) { 1142 if (status < 0) {
1142 mlog_errno(status); 1143 mlog_errno(status);
1143 goto out_rollback; 1144 goto out_rollback;
@@ -1288,7 +1289,7 @@ static int ocfs2_alloc_dinode_update_counts(struct inode *inode,
1288 struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data; 1289 struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data;
1289 struct ocfs2_chain_list *cl = (struct ocfs2_chain_list *) &di->id2.i_chain; 1290 struct ocfs2_chain_list *cl = (struct ocfs2_chain_list *) &di->id2.i_chain;
1290 1291
1291 ret = ocfs2_journal_access_di(handle, inode, di_bh, 1292 ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
1292 OCFS2_JOURNAL_ACCESS_WRITE); 1293 OCFS2_JOURNAL_ACCESS_WRITE);
1293 if (ret < 0) { 1294 if (ret < 0) {
1294 mlog_errno(ret); 1295 mlog_errno(ret);
@@ -1461,7 +1462,7 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac,
1461 /* Ok, claim our bits now: set the info on dinode, chainlist 1462 /* Ok, claim our bits now: set the info on dinode, chainlist
1462 * and then the group */ 1463 * and then the group */
1463 status = ocfs2_journal_access_di(handle, 1464 status = ocfs2_journal_access_di(handle,
1464 alloc_inode, 1465 INODE_CACHE(alloc_inode),
1465 ac->ac_bh, 1466 ac->ac_bh,
1466 OCFS2_JOURNAL_ACCESS_WRITE); 1467 OCFS2_JOURNAL_ACCESS_WRITE);
1467 if (status < 0) { 1468 if (status < 0) {
@@ -1907,8 +1908,8 @@ static inline int ocfs2_block_group_clear_bits(handle_t *handle,
1907 if (ocfs2_is_cluster_bitmap(alloc_inode)) 1908 if (ocfs2_is_cluster_bitmap(alloc_inode))
1908 journal_type = OCFS2_JOURNAL_ACCESS_UNDO; 1909 journal_type = OCFS2_JOURNAL_ACCESS_UNDO;
1909 1910
1910 status = ocfs2_journal_access_gd(handle, alloc_inode, group_bh, 1911 status = ocfs2_journal_access_gd(handle, INODE_CACHE(alloc_inode),
1911 journal_type); 1912 group_bh, journal_type);
1912 if (status < 0) { 1913 if (status < 0) {
1913 mlog_errno(status); 1914 mlog_errno(status);
1914 goto bail; 1915 goto bail;
@@ -1993,8 +1994,8 @@ int ocfs2_free_suballoc_bits(handle_t *handle,
1993 goto bail; 1994 goto bail;
1994 } 1995 }
1995 1996
1996 status = ocfs2_journal_access_di(handle, alloc_inode, alloc_bh, 1997 status = ocfs2_journal_access_di(handle, INODE_CACHE(alloc_inode),
1997 OCFS2_JOURNAL_ACCESS_WRITE); 1998 alloc_bh, OCFS2_JOURNAL_ACCESS_WRITE);
1998 if (status < 0) { 1999 if (status < 0) {
1999 mlog_errno(status); 2000 mlog_errno(status);
2000 goto bail; 2001 goto bail;
diff --git a/fs/ocfs2/uptodate.h b/fs/ocfs2/uptodate.h
index 80dbb1db0a5a..0d826fe2da0d 100644
--- a/fs/ocfs2/uptodate.h
+++ b/fs/ocfs2/uptodate.h
@@ -64,7 +64,6 @@ void ocfs2_metadata_cache_purge(struct ocfs2_caching_info *ci);
64void ocfs2_metadata_cache_exit(struct ocfs2_caching_info *ci); 64void ocfs2_metadata_cache_exit(struct ocfs2_caching_info *ci);
65 65
66u64 ocfs2_metadata_cache_owner(struct ocfs2_caching_info *ci); 66u64 ocfs2_metadata_cache_owner(struct ocfs2_caching_info *ci);
67struct super_block *ocfs2_metadata_cache_get_super(struct ocfs2_caching_info *ci);
68void ocfs2_metadata_cache_io_lock(struct ocfs2_caching_info *ci); 67void ocfs2_metadata_cache_io_lock(struct ocfs2_caching_info *ci);
69void ocfs2_metadata_cache_io_unlock(struct ocfs2_caching_info *ci); 68void ocfs2_metadata_cache_io_unlock(struct ocfs2_caching_info *ci);
70 69
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 19de5c487242..93aae7953c2e 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -297,7 +297,8 @@ static int ocfs2_xattr_bucket_journal_access(handle_t *handle,
297 int i, rc = 0; 297 int i, rc = 0;
298 298
299 for (i = 0; i < bucket->bu_blocks; i++) { 299 for (i = 0; i < bucket->bu_blocks; i++) {
300 rc = ocfs2_journal_access(handle, bucket->bu_inode, 300 rc = ocfs2_journal_access(handle,
301 INODE_CACHE(bucket->bu_inode),
301 bucket->bu_bhs[i], type); 302 bucket->bu_bhs[i], type);
302 if (rc) { 303 if (rc) {
303 mlog_errno(rc); 304 mlog_errno(rc);
@@ -604,7 +605,7 @@ static int ocfs2_xattr_extend_allocation(struct inode *inode,
604 605
605 ocfs2_init_xattr_value_extent_tree(&et, inode, vb); 606 ocfs2_init_xattr_value_extent_tree(&et, inode, vb);
606 607
607 status = vb->vb_access(handle, inode, vb->vb_bh, 608 status = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh,
608 OCFS2_JOURNAL_ACCESS_WRITE); 609 OCFS2_JOURNAL_ACCESS_WRITE);
609 if (status < 0) { 610 if (status < 0) {
610 mlog_errno(status); 611 mlog_errno(status);
@@ -658,7 +659,7 @@ static int __ocfs2_remove_xattr_range(struct inode *inode,
658 659
659 ocfs2_init_xattr_value_extent_tree(&et, inode, vb); 660 ocfs2_init_xattr_value_extent_tree(&et, inode, vb);
660 661
661 ret = vb->vb_access(handle, inode, vb->vb_bh, 662 ret = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh,
662 OCFS2_JOURNAL_ACCESS_WRITE); 663 OCFS2_JOURNAL_ACCESS_WRITE);
663 if (ret) { 664 if (ret) {
664 mlog_errno(ret); 665 mlog_errno(ret);
@@ -1217,7 +1218,7 @@ static int __ocfs2_xattr_set_value_outside(struct inode *inode,
1217 } 1218 }
1218 1219
1219 ret = ocfs2_journal_access(handle, 1220 ret = ocfs2_journal_access(handle,
1220 inode, 1221 INODE_CACHE(inode),
1221 bh, 1222 bh,
1222 OCFS2_JOURNAL_ACCESS_WRITE); 1223 OCFS2_JOURNAL_ACCESS_WRITE);
1223 if (ret < 0) { 1224 if (ret < 0) {
@@ -1268,7 +1269,7 @@ static int ocfs2_xattr_cleanup(struct inode *inode,
1268 void *val = xs->base + offs; 1269 void *val = xs->base + offs;
1269 size_t size = OCFS2_XATTR_SIZE(name_len) + OCFS2_XATTR_ROOT_SIZE; 1270 size_t size = OCFS2_XATTR_SIZE(name_len) + OCFS2_XATTR_ROOT_SIZE;
1270 1271
1271 ret = vb->vb_access(handle, inode, vb->vb_bh, 1272 ret = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh,
1272 OCFS2_JOURNAL_ACCESS_WRITE); 1273 OCFS2_JOURNAL_ACCESS_WRITE);
1273 if (ret) { 1274 if (ret) {
1274 mlog_errno(ret); 1275 mlog_errno(ret);
@@ -1296,7 +1297,7 @@ static int ocfs2_xattr_update_entry(struct inode *inode,
1296{ 1297{
1297 int ret; 1298 int ret;
1298 1299
1299 ret = vb->vb_access(handle, inode, vb->vb_bh, 1300 ret = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh,
1300 OCFS2_JOURNAL_ACCESS_WRITE); 1301 OCFS2_JOURNAL_ACCESS_WRITE);
1301 if (ret) { 1302 if (ret) {
1302 mlog_errno(ret); 1303 mlog_errno(ret);
@@ -1617,7 +1618,7 @@ static int ocfs2_xattr_set_entry(struct inode *inode,
1617 } 1618 }
1618 } 1619 }
1619 1620
1620 ret = ocfs2_journal_access_di(handle, inode, xs->inode_bh, 1621 ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), xs->inode_bh,
1621 OCFS2_JOURNAL_ACCESS_WRITE); 1622 OCFS2_JOURNAL_ACCESS_WRITE);
1622 if (ret) { 1623 if (ret) {
1623 mlog_errno(ret); 1624 mlog_errno(ret);
@@ -1625,7 +1626,7 @@ static int ocfs2_xattr_set_entry(struct inode *inode,
1625 } 1626 }
1626 1627
1627 if (!(flag & OCFS2_INLINE_XATTR_FL)) { 1628 if (!(flag & OCFS2_INLINE_XATTR_FL)) {
1628 ret = vb.vb_access(handle, inode, vb.vb_bh, 1629 ret = vb.vb_access(handle, INODE_CACHE(inode), vb.vb_bh,
1629 OCFS2_JOURNAL_ACCESS_WRITE); 1630 OCFS2_JOURNAL_ACCESS_WRITE);
1630 if (ret) { 1631 if (ret) {
1631 mlog_errno(ret); 1632 mlog_errno(ret);
@@ -1898,7 +1899,7 @@ int ocfs2_xattr_remove(struct inode *inode, struct buffer_head *di_bh)
1898 mlog_errno(ret); 1899 mlog_errno(ret);
1899 goto out; 1900 goto out;
1900 } 1901 }
1901 ret = ocfs2_journal_access_di(handle, inode, di_bh, 1902 ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
1902 OCFS2_JOURNAL_ACCESS_WRITE); 1903 OCFS2_JOURNAL_ACCESS_WRITE);
1903 if (ret) { 1904 if (ret) {
1904 mlog_errno(ret); 1905 mlog_errno(ret);
@@ -2107,7 +2108,8 @@ static int ocfs2_xattr_block_set(struct inode *inode,
2107 int ret; 2108 int ret;
2108 2109
2109 if (!xs->xattr_bh) { 2110 if (!xs->xattr_bh) {
2110 ret = ocfs2_journal_access_di(handle, inode, xs->inode_bh, 2111 ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode),
2112 xs->inode_bh,
2111 OCFS2_JOURNAL_ACCESS_CREATE); 2113 OCFS2_JOURNAL_ACCESS_CREATE);
2112 if (ret < 0) { 2114 if (ret < 0) {
2113 mlog_errno(ret); 2115 mlog_errno(ret);
@@ -2125,7 +2127,8 @@ static int ocfs2_xattr_block_set(struct inode *inode,
2125 new_bh = sb_getblk(inode->i_sb, first_blkno); 2127 new_bh = sb_getblk(inode->i_sb, first_blkno);
2126 ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), new_bh); 2128 ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), new_bh);
2127 2129
2128 ret = ocfs2_journal_access_xb(handle, inode, new_bh, 2130 ret = ocfs2_journal_access_xb(handle, INODE_CACHE(inode),
2131 new_bh,
2129 OCFS2_JOURNAL_ACCESS_CREATE); 2132 OCFS2_JOURNAL_ACCESS_CREATE);
2130 if (ret < 0) { 2133 if (ret < 0) {
2131 mlog_errno(ret); 2134 mlog_errno(ret);
@@ -2600,7 +2603,7 @@ static int __ocfs2_xattr_set_handle(struct inode *inode,
2600 2603
2601 if (!ret) { 2604 if (!ret) {
2602 /* Update inode ctime. */ 2605 /* Update inode ctime. */
2603 ret = ocfs2_journal_access_di(ctxt->handle, inode, 2606 ret = ocfs2_journal_access_di(ctxt->handle, INODE_CACHE(inode),
2604 xis->inode_bh, 2607 xis->inode_bh,
2605 OCFS2_JOURNAL_ACCESS_WRITE); 2608 OCFS2_JOURNAL_ACCESS_WRITE);
2606 if (ret) { 2609 if (ret) {
@@ -3428,7 +3431,7 @@ static int ocfs2_xattr_create_index_block(struct inode *inode,
3428 */ 3431 */
3429 down_write(&oi->ip_alloc_sem); 3432 down_write(&oi->ip_alloc_sem);
3430 3433
3431 ret = ocfs2_journal_access_xb(handle, inode, xb_bh, 3434 ret = ocfs2_journal_access_xb(handle, INODE_CACHE(inode), xb_bh,
3432 OCFS2_JOURNAL_ACCESS_WRITE); 3435 OCFS2_JOURNAL_ACCESS_WRITE);
3433 if (ret) { 3436 if (ret) {
3434 mlog_errno(ret); 3437 mlog_errno(ret);
@@ -4267,7 +4270,7 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode,
4267 4270
4268 ocfs2_init_xattr_tree_extent_tree(&et, inode, root_bh); 4271 ocfs2_init_xattr_tree_extent_tree(&et, inode, root_bh);
4269 4272
4270 ret = ocfs2_journal_access_xb(handle, inode, root_bh, 4273 ret = ocfs2_journal_access_xb(handle, INODE_CACHE(inode), root_bh,
4271 OCFS2_JOURNAL_ACCESS_WRITE); 4274 OCFS2_JOURNAL_ACCESS_WRITE);
4272 if (ret < 0) { 4275 if (ret < 0) {
4273 mlog_errno(ret); 4276 mlog_errno(ret);
@@ -4873,7 +4876,7 @@ static int ocfs2_rm_xattr_cluster(struct inode *inode,
4873 goto out; 4876 goto out;
4874 } 4877 }
4875 4878
4876 ret = ocfs2_journal_access_xb(handle, inode, root_bh, 4879 ret = ocfs2_journal_access_xb(handle, INODE_CACHE(inode), root_bh,
4877 OCFS2_JOURNAL_ACCESS_WRITE); 4880 OCFS2_JOURNAL_ACCESS_WRITE);
4878 if (ret) { 4881 if (ret) {
4879 mlog_errno(ret); 4882 mlog_errno(ret);