diff options
author | Joel Becker <joel.becker@oracle.com> | 2009-02-12 20:49:26 -0500 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2009-09-04 19:07:52 -0400 |
commit | 3d03a305ded8057155bd3c801e64ffef9f534827 (patch) | |
tree | 4f220711f42c1abbd80a9fe8c2b6ee47e846a587 /fs | |
parent | d9a0a1f83bf083b55b3c1f16efddecc31abace61 (diff) |
ocfs2: Pass ocfs2_caching_info to ocfs2_read_extent_block().
extent blocks belong to btrees on more than just inodes, so we want to
pass the ocfs2_caching_info structure directly to
ocfs2_read_extent_block(). A number of places in alloc.c can now drop
struct inode from their argument list.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/alloc.c | 38 | ||||
-rw-r--r-- | fs/ocfs2/alloc.h | 3 | ||||
-rw-r--r-- | fs/ocfs2/dir.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/extent_map.c | 4 | ||||
-rw-r--r-- | fs/ocfs2/suballoc.c | 2 |
5 files changed, 25 insertions, 24 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index a26294caf1cf..1ff13d3958dd 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -854,13 +854,13 @@ static int ocfs2_validate_extent_block(struct super_block *sb, | |||
854 | return 0; | 854 | return 0; |
855 | } | 855 | } |
856 | 856 | ||
857 | int ocfs2_read_extent_block(struct inode *inode, u64 eb_blkno, | 857 | int ocfs2_read_extent_block(struct ocfs2_caching_info *ci, u64 eb_blkno, |
858 | struct buffer_head **bh) | 858 | struct buffer_head **bh) |
859 | { | 859 | { |
860 | int rc; | 860 | int rc; |
861 | struct buffer_head *tmp = *bh; | 861 | struct buffer_head *tmp = *bh; |
862 | 862 | ||
863 | rc = ocfs2_read_block(INODE_CACHE(inode), eb_blkno, &tmp, | 863 | rc = ocfs2_read_block(ci, eb_blkno, &tmp, |
864 | ocfs2_validate_extent_block); | 864 | ocfs2_validate_extent_block); |
865 | 865 | ||
866 | /* If ocfs2_read_block() got us a new bh, pass it up. */ | 866 | /* If ocfs2_read_block() got us a new bh, pass it up. */ |
@@ -875,7 +875,6 @@ int ocfs2_read_extent_block(struct inode *inode, u64 eb_blkno, | |||
875 | * How many free extents have we got before we need more meta data? | 875 | * How many free extents have we got before we need more meta data? |
876 | */ | 876 | */ |
877 | int ocfs2_num_free_extents(struct ocfs2_super *osb, | 877 | int ocfs2_num_free_extents(struct ocfs2_super *osb, |
878 | struct inode *inode, | ||
879 | struct ocfs2_extent_tree *et) | 878 | struct ocfs2_extent_tree *et) |
880 | { | 879 | { |
881 | int retval; | 880 | int retval; |
@@ -890,7 +889,8 @@ int ocfs2_num_free_extents(struct ocfs2_super *osb, | |||
890 | last_eb_blk = ocfs2_et_get_last_eb_blk(et); | 889 | last_eb_blk = ocfs2_et_get_last_eb_blk(et); |
891 | 890 | ||
892 | if (last_eb_blk) { | 891 | if (last_eb_blk) { |
893 | retval = ocfs2_read_extent_block(inode, last_eb_blk, &eb_bh); | 892 | retval = ocfs2_read_extent_block(et->et_ci, last_eb_blk, |
893 | &eb_bh); | ||
894 | if (retval < 0) { | 894 | if (retval < 0) { |
895 | mlog_errno(retval); | 895 | mlog_errno(retval); |
896 | goto bail; | 896 | goto bail; |
@@ -1382,7 +1382,6 @@ bail: | |||
1382 | * return status < 0 indicates an error. | 1382 | * return status < 0 indicates an error. |
1383 | */ | 1383 | */ |
1384 | static int ocfs2_find_branch_target(struct ocfs2_super *osb, | 1384 | static int ocfs2_find_branch_target(struct ocfs2_super *osb, |
1385 | struct inode *inode, | ||
1386 | struct ocfs2_extent_tree *et, | 1385 | struct ocfs2_extent_tree *et, |
1387 | struct buffer_head **target_bh) | 1386 | struct buffer_head **target_bh) |
1388 | { | 1387 | { |
@@ -1401,19 +1400,21 @@ static int ocfs2_find_branch_target(struct ocfs2_super *osb, | |||
1401 | 1400 | ||
1402 | while(le16_to_cpu(el->l_tree_depth) > 1) { | 1401 | while(le16_to_cpu(el->l_tree_depth) > 1) { |
1403 | if (le16_to_cpu(el->l_next_free_rec) == 0) { | 1402 | if (le16_to_cpu(el->l_next_free_rec) == 0) { |
1404 | ocfs2_error(inode->i_sb, "Dinode %llu has empty " | 1403 | ocfs2_error(ocfs2_metadata_cache_get_super(et->et_ci), |
1404 | "Owner %llu has empty " | ||
1405 | "extent list (next_free_rec == 0)", | 1405 | "extent list (next_free_rec == 0)", |
1406 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | 1406 | (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci)); |
1407 | status = -EIO; | 1407 | status = -EIO; |
1408 | goto bail; | 1408 | goto bail; |
1409 | } | 1409 | } |
1410 | i = le16_to_cpu(el->l_next_free_rec) - 1; | 1410 | i = le16_to_cpu(el->l_next_free_rec) - 1; |
1411 | blkno = le64_to_cpu(el->l_recs[i].e_blkno); | 1411 | blkno = le64_to_cpu(el->l_recs[i].e_blkno); |
1412 | if (!blkno) { | 1412 | if (!blkno) { |
1413 | ocfs2_error(inode->i_sb, "Dinode %llu has extent " | 1413 | ocfs2_error(ocfs2_metadata_cache_get_super(et->et_ci), |
1414 | "Owner %llu has extent " | ||
1414 | "list where extent # %d has no physical " | 1415 | "list where extent # %d has no physical " |
1415 | "block start", | 1416 | "block start", |
1416 | (unsigned long long)OCFS2_I(inode)->ip_blkno, i); | 1417 | (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci), i); |
1417 | status = -EIO; | 1418 | status = -EIO; |
1418 | goto bail; | 1419 | goto bail; |
1419 | } | 1420 | } |
@@ -1421,7 +1422,7 @@ static int ocfs2_find_branch_target(struct ocfs2_super *osb, | |||
1421 | brelse(bh); | 1422 | brelse(bh); |
1422 | bh = NULL; | 1423 | bh = NULL; |
1423 | 1424 | ||
1424 | status = ocfs2_read_extent_block(inode, blkno, &bh); | 1425 | status = ocfs2_read_extent_block(et->et_ci, blkno, &bh); |
1425 | if (status < 0) { | 1426 | if (status < 0) { |
1426 | mlog_errno(status); | 1427 | mlog_errno(status); |
1427 | goto bail; | 1428 | goto bail; |
@@ -1475,7 +1476,7 @@ static int ocfs2_grow_tree(struct inode *inode, handle_t *handle, | |||
1475 | 1476 | ||
1476 | BUG_ON(meta_ac == NULL); | 1477 | BUG_ON(meta_ac == NULL); |
1477 | 1478 | ||
1478 | shift = ocfs2_find_branch_target(osb, inode, et, &bh); | 1479 | shift = ocfs2_find_branch_target(osb, et, &bh); |
1479 | if (shift < 0) { | 1480 | if (shift < 0) { |
1480 | ret = shift; | 1481 | ret = shift; |
1481 | mlog_errno(ret); | 1482 | mlog_errno(ret); |
@@ -1780,7 +1781,7 @@ static int __ocfs2_find_path(struct inode *inode, | |||
1780 | 1781 | ||
1781 | brelse(bh); | 1782 | brelse(bh); |
1782 | bh = NULL; | 1783 | bh = NULL; |
1783 | ret = ocfs2_read_extent_block(inode, blkno, &bh); | 1784 | ret = ocfs2_read_extent_block(INODE_CACHE(inode), blkno, &bh); |
1784 | if (ret) { | 1785 | if (ret) { |
1785 | mlog_errno(ret); | 1786 | mlog_errno(ret); |
1786 | goto out; | 1787 | goto out; |
@@ -3032,7 +3033,8 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, | |||
3032 | goto out; | 3033 | goto out; |
3033 | } | 3034 | } |
3034 | 3035 | ||
3035 | ret = ocfs2_find_cpos_for_left_leaf(inode->i_sb, path, &cpos); | 3036 | ret = ocfs2_find_cpos_for_left_leaf(ocfs2_metadata_cache_get_super(et->et_ci), |
3037 | path, &cpos); | ||
3036 | if (ret) { | 3038 | if (ret) { |
3037 | mlog_errno(ret); | 3039 | mlog_errno(ret); |
3038 | goto out; | 3040 | goto out; |
@@ -4557,7 +4559,7 @@ static int ocfs2_figure_insert_type(struct inode *inode, | |||
4557 | * ocfs2_figure_insert_type() and ocfs2_add_branch() | 4559 | * ocfs2_figure_insert_type() and ocfs2_add_branch() |
4558 | * may want it later. | 4560 | * may want it later. |
4559 | */ | 4561 | */ |
4560 | ret = ocfs2_read_extent_block(inode, | 4562 | ret = ocfs2_read_extent_block(et->et_ci, |
4561 | ocfs2_et_get_last_eb_blk(et), | 4563 | ocfs2_et_get_last_eb_blk(et), |
4562 | &bh); | 4564 | &bh); |
4563 | if (ret) { | 4565 | if (ret) { |
@@ -4760,7 +4762,7 @@ int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb, | |||
4760 | if (mark_unwritten) | 4762 | if (mark_unwritten) |
4761 | flags = OCFS2_EXT_UNWRITTEN; | 4763 | flags = OCFS2_EXT_UNWRITTEN; |
4762 | 4764 | ||
4763 | free_extents = ocfs2_num_free_extents(osb, inode, et); | 4765 | free_extents = ocfs2_num_free_extents(osb, et); |
4764 | if (free_extents < 0) { | 4766 | if (free_extents < 0) { |
4765 | status = free_extents; | 4767 | status = free_extents; |
4766 | mlog_errno(status); | 4768 | mlog_errno(status); |
@@ -5048,7 +5050,7 @@ static int __ocfs2_mark_extent_written(struct inode *inode, | |||
5048 | if (path->p_tree_depth) { | 5050 | if (path->p_tree_depth) { |
5049 | struct ocfs2_extent_block *eb; | 5051 | struct ocfs2_extent_block *eb; |
5050 | 5052 | ||
5051 | ret = ocfs2_read_extent_block(inode, | 5053 | ret = ocfs2_read_extent_block(et->et_ci, |
5052 | ocfs2_et_get_last_eb_blk(et), | 5054 | ocfs2_et_get_last_eb_blk(et), |
5053 | &last_eb_bh); | 5055 | &last_eb_bh); |
5054 | if (ret) { | 5056 | if (ret) { |
@@ -5203,7 +5205,7 @@ static int ocfs2_split_tree(struct inode *inode, struct ocfs2_extent_tree *et, | |||
5203 | 5205 | ||
5204 | depth = path->p_tree_depth; | 5206 | depth = path->p_tree_depth; |
5205 | if (depth > 0) { | 5207 | if (depth > 0) { |
5206 | ret = ocfs2_read_extent_block(inode, | 5208 | ret = ocfs2_read_extent_block(et->et_ci, |
5207 | ocfs2_et_get_last_eb_blk(et), | 5209 | ocfs2_et_get_last_eb_blk(et), |
5208 | &last_eb_bh); | 5210 | &last_eb_bh); |
5209 | if (ret < 0) { | 5211 | if (ret < 0) { |
@@ -7447,7 +7449,7 @@ int ocfs2_prepare_truncate(struct ocfs2_super *osb, | |||
7447 | ocfs2_init_dealloc_ctxt(&(*tc)->tc_dealloc); | 7449 | ocfs2_init_dealloc_ctxt(&(*tc)->tc_dealloc); |
7448 | 7450 | ||
7449 | if (fe->id2.i_list.l_tree_depth) { | 7451 | if (fe->id2.i_list.l_tree_depth) { |
7450 | status = ocfs2_read_extent_block(inode, | 7452 | status = ocfs2_read_extent_block(INODE_CACHE(inode), |
7451 | le64_to_cpu(fe->i_last_eb_blk), | 7453 | le64_to_cpu(fe->i_last_eb_blk), |
7452 | &last_eb_bh); | 7454 | &last_eb_bh); |
7453 | if (status < 0) { | 7455 | if (status < 0) { |
diff --git a/fs/ocfs2/alloc.h b/fs/ocfs2/alloc.h index 285d40b4b0fb..ed78ee5139bc 100644 --- a/fs/ocfs2/alloc.h +++ b/fs/ocfs2/alloc.h | |||
@@ -86,7 +86,7 @@ void ocfs2_init_dx_root_extent_tree(struct ocfs2_extent_tree *et, | |||
86 | * allocated. This is a cached read. The extent block will be validated | 86 | * allocated. This is a cached read. The extent block will be validated |
87 | * with ocfs2_validate_extent_block(). | 87 | * with ocfs2_validate_extent_block(). |
88 | */ | 88 | */ |
89 | int ocfs2_read_extent_block(struct inode *inode, u64 eb_blkno, | 89 | int ocfs2_read_extent_block(struct ocfs2_caching_info *ci, u64 eb_blkno, |
90 | struct buffer_head **bh); | 90 | struct buffer_head **bh); |
91 | 91 | ||
92 | struct ocfs2_alloc_context; | 92 | struct ocfs2_alloc_context; |
@@ -132,7 +132,6 @@ int ocfs2_remove_btree_range(struct inode *inode, | |||
132 | struct ocfs2_cached_dealloc_ctxt *dealloc); | 132 | struct ocfs2_cached_dealloc_ctxt *dealloc); |
133 | 133 | ||
134 | int ocfs2_num_free_extents(struct ocfs2_super *osb, | 134 | int ocfs2_num_free_extents(struct ocfs2_super *osb, |
135 | struct inode *inode, | ||
136 | struct ocfs2_extent_tree *et); | 135 | struct ocfs2_extent_tree *et); |
137 | 136 | ||
138 | /* | 137 | /* |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 073ab34b8c2a..00e43281b9a4 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -3346,7 +3346,7 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb, | |||
3346 | if (dir_i_size == ocfs2_clusters_to_bytes(sb, OCFS2_I(dir)->ip_clusters)) { | 3346 | if (dir_i_size == ocfs2_clusters_to_bytes(sb, OCFS2_I(dir)->ip_clusters)) { |
3347 | spin_unlock(&OCFS2_I(dir)->ip_lock); | 3347 | spin_unlock(&OCFS2_I(dir)->ip_lock); |
3348 | ocfs2_init_dinode_extent_tree(&et, dir, parent_fe_bh); | 3348 | ocfs2_init_dinode_extent_tree(&et, dir, parent_fe_bh); |
3349 | num_free_extents = ocfs2_num_free_extents(osb, dir, &et); | 3349 | num_free_extents = ocfs2_num_free_extents(osb, &et); |
3350 | if (num_free_extents < 0) { | 3350 | if (num_free_extents < 0) { |
3351 | status = num_free_extents; | 3351 | status = num_free_extents; |
3352 | mlog_errno(status); | 3352 | mlog_errno(status); |
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c index dbd8a16d5125..a5dc13e6fe76 100644 --- a/fs/ocfs2/extent_map.c +++ b/fs/ocfs2/extent_map.c | |||
@@ -293,7 +293,7 @@ static int ocfs2_last_eb_is_empty(struct inode *inode, | |||
293 | struct ocfs2_extent_block *eb; | 293 | struct ocfs2_extent_block *eb; |
294 | struct ocfs2_extent_list *el; | 294 | struct ocfs2_extent_list *el; |
295 | 295 | ||
296 | ret = ocfs2_read_extent_block(inode, last_eb_blk, &eb_bh); | 296 | ret = ocfs2_read_extent_block(INODE_CACHE(inode), last_eb_blk, &eb_bh); |
297 | if (ret) { | 297 | if (ret) { |
298 | mlog_errno(ret); | 298 | mlog_errno(ret); |
299 | goto out; | 299 | goto out; |
@@ -375,7 +375,7 @@ static int ocfs2_figure_hole_clusters(struct inode *inode, | |||
375 | if (le64_to_cpu(eb->h_next_leaf_blk) == 0ULL) | 375 | if (le64_to_cpu(eb->h_next_leaf_blk) == 0ULL) |
376 | goto no_more_extents; | 376 | goto no_more_extents; |
377 | 377 | ||
378 | ret = ocfs2_read_extent_block(inode, | 378 | ret = ocfs2_read_extent_block(INODE_CACHE(inode), |
379 | le64_to_cpu(eb->h_next_leaf_blk), | 379 | le64_to_cpu(eb->h_next_leaf_blk), |
380 | &next_eb_bh); | 380 | &next_eb_bh); |
381 | if (ret) { | 381 | if (ret) { |
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index a6c442c82e3d..c30b644d9572 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -2152,7 +2152,7 @@ int ocfs2_lock_allocators(struct inode *inode, | |||
2152 | 2152 | ||
2153 | BUG_ON(clusters_to_add != 0 && data_ac == NULL); | 2153 | BUG_ON(clusters_to_add != 0 && data_ac == NULL); |
2154 | 2154 | ||
2155 | num_free_extents = ocfs2_num_free_extents(osb, inode, et); | 2155 | num_free_extents = ocfs2_num_free_extents(osb, et); |
2156 | if (num_free_extents < 0) { | 2156 | if (num_free_extents < 0) { |
2157 | ret = num_free_extents; | 2157 | ret = num_free_extents; |
2158 | mlog_errno(ret); | 2158 | mlog_errno(ret); |