aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2009-02-12 20:32:34 -0500
committerJoel Becker <joel.becker@oracle.com>2009-09-04 19:07:51 -0400
commitd9a0a1f83bf083b55b3c1f16efddecc31abace61 (patch)
tree7e75311f678fb943f2a0b14c91a0877fd7813efe /fs
parent0cf2f7632b1789b811ab20b611c4156e6de2b055 (diff)
ocfs2: Store the ocfs2_caching_info on ocfs2_extent_tree.
What do we cache? Metadata blocks. What are most of our non-inode metadata blocks? Extent blocks for our btrees. struct ocfs2_extent_tree is the main structure for managing those. So let's store the associated ocfs2_caching_info there. This means that ocfs2_et_root_journal_access() doesn't need struct inode anymore, and any place that has an et can refer to et->et_ci instead of INODE_CACHE(inode). Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/alloc.c26
-rw-r--r--fs/ocfs2/alloc.h4
2 files changed, 16 insertions, 14 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 616afa9f7bd1..a26294caf1cf 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -352,6 +352,7 @@ static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et,
352{ 352{
353 et->et_ops = ops; 353 et->et_ops = ops;
354 et->et_root_bh = bh; 354 et->et_root_bh = bh;
355 et->et_ci = INODE_CACHE(inode);
355 et->et_root_journal_access = access; 356 et->et_root_journal_access = access;
356 if (!obj) 357 if (!obj)
357 obj = (void *)bh->b_data; 358 obj = (void *)bh->b_data;
@@ -415,11 +416,10 @@ static inline void ocfs2_et_update_clusters(struct inode *inode,
415} 416}
416 417
417static inline int ocfs2_et_root_journal_access(handle_t *handle, 418static inline int ocfs2_et_root_journal_access(handle_t *handle,
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, ci, et->et_root_bh, 422 return et->et_root_journal_access(handle, et->et_ci, et->et_root_bh,
423 type); 423 type);
424} 424}
425 425
@@ -1209,7 +1209,7 @@ static int ocfs2_add_branch(struct ocfs2_super *osb,
1209 mlog_errno(status); 1209 mlog_errno(status);
1210 goto bail; 1210 goto bail;
1211 } 1211 }
1212 status = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et, 1212 status = ocfs2_et_root_journal_access(handle, et,
1213 OCFS2_JOURNAL_ACCESS_WRITE); 1213 OCFS2_JOURNAL_ACCESS_WRITE);
1214 if (status < 0) { 1214 if (status < 0) {
1215 mlog_errno(status); 1215 mlog_errno(status);
@@ -1325,7 +1325,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb,
1325 goto bail; 1325 goto bail;
1326 } 1326 }
1327 1327
1328 status = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et, 1328 status = ocfs2_et_root_journal_access(handle, et,
1329 OCFS2_JOURNAL_ACCESS_WRITE); 1329 OCFS2_JOURNAL_ACCESS_WRITE);
1330 if (status < 0) { 1330 if (status < 0) {
1331 mlog_errno(status); 1331 mlog_errno(status);
@@ -2674,7 +2674,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,
2674 * We have to update i_last_eb_blk during the meta 2674 * We have to update i_last_eb_blk during the meta
2675 * data delete. 2675 * data delete.
2676 */ 2676 */
2677 ret = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et, 2677 ret = ocfs2_et_root_journal_access(handle, et,
2678 OCFS2_JOURNAL_ACCESS_WRITE); 2678 OCFS2_JOURNAL_ACCESS_WRITE);
2679 if (ret) { 2679 if (ret) {
2680 mlog_errno(ret); 2680 mlog_errno(ret);
@@ -3026,7 +3026,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,
3026 goto out; 3026 goto out;
3027 } 3027 }
3028 3028
3029 ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, path); 3029 ret = ocfs2_journal_access_path(et->et_ci, handle, path);
3030 if (ret) { 3030 if (ret) {
3031 mlog_errno(ret); 3031 mlog_errno(ret);
3032 goto out; 3032 goto out;
@@ -3056,7 +3056,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,
3056 goto out; 3056 goto out;
3057 } 3057 }
3058 3058
3059 ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, left_path); 3059 ret = ocfs2_journal_access_path(et->et_ci, handle, left_path);
3060 if (ret) { 3060 if (ret) {
3061 mlog_errno(ret); 3061 mlog_errno(ret);
3062 goto out; 3062 goto out;
@@ -4212,7 +4212,7 @@ static int ocfs2_do_insert_extent(struct inode *inode,
4212 4212
4213 el = et->et_root_el; 4213 el = et->et_root_el;
4214 4214
4215 ret = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et, 4215 ret = ocfs2_et_root_journal_access(handle, et,
4216 OCFS2_JOURNAL_ACCESS_WRITE); 4216 OCFS2_JOURNAL_ACCESS_WRITE);
4217 if (ret) { 4217 if (ret) {
4218 mlog_errno(ret); 4218 mlog_errno(ret);
@@ -4274,7 +4274,7 @@ static int ocfs2_do_insert_extent(struct inode *inode,
4274 * ocfs2_rotate_tree_right() might have extended the 4274 * ocfs2_rotate_tree_right() might have extended the
4275 * transaction without re-journaling our tree root. 4275 * transaction without re-journaling our tree root.
4276 */ 4276 */
4277 ret = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et, 4277 ret = ocfs2_et_root_journal_access(handle, et,
4278 OCFS2_JOURNAL_ACCESS_WRITE); 4278 OCFS2_JOURNAL_ACCESS_WRITE);
4279 if (ret) { 4279 if (ret) {
4280 mlog_errno(ret); 4280 mlog_errno(ret);
@@ -4797,7 +4797,7 @@ int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb,
4797 BUG_ON(num_bits > clusters_to_add); 4797 BUG_ON(num_bits > clusters_to_add);
4798 4798
4799 /* reserve our write early -- insert_extent may update the tree root */ 4799 /* reserve our write early -- insert_extent may update the tree root */
4800 status = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et, 4800 status = ocfs2_et_root_journal_access(handle, et,
4801 OCFS2_JOURNAL_ACCESS_WRITE); 4801 OCFS2_JOURNAL_ACCESS_WRITE);
4802 if (status < 0) { 4802 if (status < 0) {
4803 mlog_errno(status); 4803 mlog_errno(status);
@@ -5334,13 +5334,13 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,
5334 goto out; 5334 goto out;
5335 } 5335 }
5336 5336
5337 ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, path); 5337 ret = ocfs2_journal_access_path(et->et_ci, handle, path);
5338 if (ret) { 5338 if (ret) {
5339 mlog_errno(ret); 5339 mlog_errno(ret);
5340 goto out; 5340 goto out;
5341 } 5341 }
5342 5342
5343 ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, left_path); 5343 ret = ocfs2_journal_access_path(et->et_ci, handle, left_path);
5344 if (ret) { 5344 if (ret) {
5345 mlog_errno(ret); 5345 mlog_errno(ret);
5346 goto out; 5346 goto out;
@@ -5575,7 +5575,7 @@ int ocfs2_remove_btree_range(struct inode *inode,
5575 goto out; 5575 goto out;
5576 } 5576 }
5577 5577
5578 ret = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et, 5578 ret = ocfs2_et_root_journal_access(handle, et,
5579 OCFS2_JOURNAL_ACCESS_WRITE); 5579 OCFS2_JOURNAL_ACCESS_WRITE);
5580 if (ret) { 5580 if (ret) {
5581 mlog_errno(ret); 5581 mlog_errno(ret);
diff --git a/fs/ocfs2/alloc.h b/fs/ocfs2/alloc.h
index 353254ba29e1..285d40b4b0fb 100644
--- a/fs/ocfs2/alloc.h
+++ b/fs/ocfs2/alloc.h
@@ -45,7 +45,8 @@
45 * 45 *
46 * ocfs2_extent_tree contains info for the root of the b-tree, it must have a 46 * ocfs2_extent_tree contains info for the root of the b-tree, it must have a
47 * root ocfs2_extent_list and a root_bh so that they can be used in the b-tree 47 * root ocfs2_extent_list and a root_bh so that they can be used in the b-tree
48 * functions. With metadata ecc, we now call different journal_access 48 * functions. It needs the ocfs2_caching_info structure associated with
49 * I/O on the tree. With metadata ecc, we now call different journal_access
49 * functions for each type of metadata, so it must have the 50 * functions for each type of metadata, so it must have the
50 * root_journal_access function. 51 * root_journal_access function.
51 * ocfs2_extent_tree_operations abstract the normal operations we do for 52 * ocfs2_extent_tree_operations abstract the normal operations we do for
@@ -56,6 +57,7 @@ struct ocfs2_extent_tree {
56 struct ocfs2_extent_tree_operations *et_ops; 57 struct ocfs2_extent_tree_operations *et_ops;
57 struct buffer_head *et_root_bh; 58 struct buffer_head *et_root_bh;
58 struct ocfs2_extent_list *et_root_el; 59 struct ocfs2_extent_list *et_root_el;
60 struct ocfs2_caching_info *et_ci;
59 ocfs2_journal_access_func et_root_journal_access; 61 ocfs2_journal_access_func et_root_journal_access;
60 void *et_object; 62 void *et_object;
61 unsigned int et_max_leaf_clusters; 63 unsigned int et_max_leaf_clusters;