diff options
author | Joel Becker <joel.becker@oracle.com> | 2008-08-20 19:25:06 -0400 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2008-10-13 19:57:04 -0400 |
commit | 35dc0aa3c5e7391319754e0c19cdfc0a28eb5b25 (patch) | |
tree | 709fc00742bbcf9fc8941e0fe61845a22bb5a73b /fs | |
parent | ff1ec20ef65d51cc3466e86912cdeaac16f3aaa0 (diff) |
ocfs2: Prefix the extent tree operations structure.
The ocfs2_extent_tree_operations structure gains a field prefix on its
members. The ->eo_sanity_check() operation gains a wrapper function for
completeness. All of the extent tree operation wrappers gain a
consistent name (ocfs2_et_*()).
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/alloc.c | 85 |
1 files changed, 46 insertions, 39 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index f65cb43edb7c..f2e35a8f0197 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -65,12 +65,13 @@ | |||
65 | struct ocfs2_extent_tree; | 65 | struct ocfs2_extent_tree; |
66 | 66 | ||
67 | struct ocfs2_extent_tree_operations { | 67 | struct ocfs2_extent_tree_operations { |
68 | void (*set_last_eb_blk) (struct ocfs2_extent_tree *et, u64 blkno); | 68 | void (*eo_set_last_eb_blk)(struct ocfs2_extent_tree *et, |
69 | u64 (*get_last_eb_blk) (struct ocfs2_extent_tree *et); | 69 | u64 blkno); |
70 | void (*update_clusters) (struct inode *inode, | 70 | u64 (*eo_get_last_eb_blk)(struct ocfs2_extent_tree *et); |
71 | struct ocfs2_extent_tree *et, | 71 | void (*eo_update_clusters)(struct inode *inode, |
72 | u32 new_clusters); | 72 | struct ocfs2_extent_tree *et, |
73 | int (*sanity_check) (struct inode *inode, struct ocfs2_extent_tree *et); | 73 | u32 new_clusters); |
74 | int (*eo_sanity_check)(struct inode *inode, struct ocfs2_extent_tree *et); | ||
74 | }; | 75 | }; |
75 | 76 | ||
76 | struct ocfs2_extent_tree { | 77 | struct ocfs2_extent_tree { |
@@ -132,10 +133,10 @@ static int ocfs2_dinode_sanity_check(struct inode *inode, | |||
132 | } | 133 | } |
133 | 134 | ||
134 | static struct ocfs2_extent_tree_operations ocfs2_dinode_et_ops = { | 135 | static struct ocfs2_extent_tree_operations ocfs2_dinode_et_ops = { |
135 | .set_last_eb_blk = ocfs2_dinode_set_last_eb_blk, | 136 | .eo_set_last_eb_blk = ocfs2_dinode_set_last_eb_blk, |
136 | .get_last_eb_blk = ocfs2_dinode_get_last_eb_blk, | 137 | .eo_get_last_eb_blk = ocfs2_dinode_get_last_eb_blk, |
137 | .update_clusters = ocfs2_dinode_update_clusters, | 138 | .eo_update_clusters = ocfs2_dinode_update_clusters, |
138 | .sanity_check = ocfs2_dinode_sanity_check, | 139 | .eo_sanity_check = ocfs2_dinode_sanity_check, |
139 | }; | 140 | }; |
140 | 141 | ||
141 | static void ocfs2_xattr_value_set_last_eb_blk(struct ocfs2_extent_tree *et, | 142 | static void ocfs2_xattr_value_set_last_eb_blk(struct ocfs2_extent_tree *et, |
@@ -172,10 +173,10 @@ static int ocfs2_xattr_value_sanity_check(struct inode *inode, | |||
172 | } | 173 | } |
173 | 174 | ||
174 | static struct ocfs2_extent_tree_operations ocfs2_xattr_et_ops = { | 175 | static struct ocfs2_extent_tree_operations ocfs2_xattr_et_ops = { |
175 | .set_last_eb_blk = ocfs2_xattr_value_set_last_eb_blk, | 176 | .eo_set_last_eb_blk = ocfs2_xattr_value_set_last_eb_blk, |
176 | .get_last_eb_blk = ocfs2_xattr_value_get_last_eb_blk, | 177 | .eo_get_last_eb_blk = ocfs2_xattr_value_get_last_eb_blk, |
177 | .update_clusters = ocfs2_xattr_value_update_clusters, | 178 | .eo_update_clusters = ocfs2_xattr_value_update_clusters, |
178 | .sanity_check = ocfs2_xattr_value_sanity_check, | 179 | .eo_sanity_check = ocfs2_xattr_value_sanity_check, |
179 | }; | 180 | }; |
180 | 181 | ||
181 | static void ocfs2_xattr_tree_set_last_eb_blk(struct ocfs2_extent_tree *et, | 182 | static void ocfs2_xattr_tree_set_last_eb_blk(struct ocfs2_extent_tree *et, |
@@ -214,10 +215,10 @@ static int ocfs2_xattr_tree_sanity_check(struct inode *inode, | |||
214 | } | 215 | } |
215 | 216 | ||
216 | static struct ocfs2_extent_tree_operations ocfs2_xattr_tree_et_ops = { | 217 | static struct ocfs2_extent_tree_operations ocfs2_xattr_tree_et_ops = { |
217 | .set_last_eb_blk = ocfs2_xattr_tree_set_last_eb_blk, | 218 | .eo_set_last_eb_blk = ocfs2_xattr_tree_set_last_eb_blk, |
218 | .get_last_eb_blk = ocfs2_xattr_tree_get_last_eb_blk, | 219 | .eo_get_last_eb_blk = ocfs2_xattr_tree_get_last_eb_blk, |
219 | .update_clusters = ocfs2_xattr_tree_update_clusters, | 220 | .eo_update_clusters = ocfs2_xattr_tree_update_clusters, |
220 | .sanity_check = ocfs2_xattr_tree_sanity_check, | 221 | .eo_sanity_check = ocfs2_xattr_tree_sanity_check, |
221 | }; | 222 | }; |
222 | 223 | ||
223 | static struct ocfs2_extent_tree* | 224 | static struct ocfs2_extent_tree* |
@@ -265,22 +266,28 @@ static void ocfs2_free_extent_tree(struct ocfs2_extent_tree *et) | |||
265 | } | 266 | } |
266 | } | 267 | } |
267 | 268 | ||
268 | static inline void ocfs2_set_last_eb_blk(struct ocfs2_extent_tree *et, | 269 | static inline void ocfs2_et_set_last_eb_blk(struct ocfs2_extent_tree *et, |
269 | u64 new_last_eb_blk) | 270 | u64 new_last_eb_blk) |
270 | { | 271 | { |
271 | et->eops->set_last_eb_blk(et, new_last_eb_blk); | 272 | et->eops->eo_set_last_eb_blk(et, new_last_eb_blk); |
272 | } | 273 | } |
273 | 274 | ||
274 | static inline u64 ocfs2_get_last_eb_blk(struct ocfs2_extent_tree *et) | 275 | static inline u64 ocfs2_et_get_last_eb_blk(struct ocfs2_extent_tree *et) |
275 | { | 276 | { |
276 | return et->eops->get_last_eb_blk(et); | 277 | return et->eops->eo_get_last_eb_blk(et); |
277 | } | 278 | } |
278 | 279 | ||
279 | static inline void ocfs2_update_clusters(struct inode *inode, | 280 | static inline void ocfs2_et_update_clusters(struct inode *inode, |
280 | struct ocfs2_extent_tree *et, | 281 | struct ocfs2_extent_tree *et, |
281 | u32 clusters) | 282 | u32 clusters) |
283 | { | ||
284 | et->eops->eo_update_clusters(inode, et, clusters); | ||
285 | } | ||
286 | |||
287 | static inline int ocfs2_et_sanity_check(struct inode *inode, | ||
288 | struct ocfs2_extent_tree *et) | ||
282 | { | 289 | { |
283 | et->eops->update_clusters(inode, et, clusters); | 290 | return et->eops->eo_sanity_check(inode, et); |
284 | } | 291 | } |
285 | 292 | ||
286 | static void ocfs2_free_truncate_context(struct ocfs2_truncate_context *tc); | 293 | static void ocfs2_free_truncate_context(struct ocfs2_truncate_context *tc); |
@@ -913,7 +920,7 @@ static int ocfs2_add_branch(struct ocfs2_super *osb, | |||
913 | 920 | ||
914 | /* fe needs a new last extent block pointer, as does the | 921 | /* fe needs a new last extent block pointer, as does the |
915 | * next_leaf on the previously last-extent-block. */ | 922 | * next_leaf on the previously last-extent-block. */ |
916 | ocfs2_set_last_eb_blk(et, new_last_eb_blk); | 923 | ocfs2_et_set_last_eb_blk(et, new_last_eb_blk); |
917 | 924 | ||
918 | eb = (struct ocfs2_extent_block *) (*last_eb_bh)->b_data; | 925 | eb = (struct ocfs2_extent_block *) (*last_eb_bh)->b_data; |
919 | eb->h_next_leaf_blk = cpu_to_le64(new_last_eb_blk); | 926 | eb->h_next_leaf_blk = cpu_to_le64(new_last_eb_blk); |
@@ -1029,7 +1036,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb, | |||
1029 | /* If this is our 1st tree depth shift, then last_eb_blk | 1036 | /* If this is our 1st tree depth shift, then last_eb_blk |
1030 | * becomes the allocated extent block */ | 1037 | * becomes the allocated extent block */ |
1031 | if (root_el->l_tree_depth == cpu_to_le16(1)) | 1038 | if (root_el->l_tree_depth == cpu_to_le16(1)) |
1032 | ocfs2_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); | 1039 | ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); |
1033 | 1040 | ||
1034 | status = ocfs2_journal_dirty(handle, et->root_bh); | 1041 | status = ocfs2_journal_dirty(handle, et->root_bh); |
1035 | if (status < 0) { | 1042 | if (status < 0) { |
@@ -2427,7 +2434,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle, | |||
2427 | ocfs2_update_edge_lengths(inode, handle, left_path); | 2434 | ocfs2_update_edge_lengths(inode, handle, left_path); |
2428 | 2435 | ||
2429 | eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data; | 2436 | eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data; |
2430 | ocfs2_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); | 2437 | ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); |
2431 | 2438 | ||
2432 | /* | 2439 | /* |
2433 | * Removal of the extent in the left leaf was skipped | 2440 | * Removal of the extent in the left leaf was skipped |
@@ -2688,7 +2695,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, | |||
2688 | struct ocfs2_extent_list *el; | 2695 | struct ocfs2_extent_list *el; |
2689 | 2696 | ||
2690 | 2697 | ||
2691 | ret = et->eops->sanity_check(inode, et); | 2698 | ret = ocfs2_et_sanity_check(inode, et); |
2692 | if (ret) | 2699 | if (ret) |
2693 | goto out; | 2700 | goto out; |
2694 | /* | 2701 | /* |
@@ -2747,7 +2754,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, | |||
2747 | ocfs2_update_edge_lengths(inode, handle, left_path); | 2754 | ocfs2_update_edge_lengths(inode, handle, left_path); |
2748 | 2755 | ||
2749 | eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data; | 2756 | eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data; |
2750 | ocfs2_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); | 2757 | ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); |
2751 | } else { | 2758 | } else { |
2752 | /* | 2759 | /* |
2753 | * 'path' is also the leftmost path which | 2760 | * 'path' is also the leftmost path which |
@@ -2763,7 +2770,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, | |||
2763 | el->l_next_free_rec = 0; | 2770 | el->l_next_free_rec = 0; |
2764 | memset(&el->l_recs[0], 0, sizeof(struct ocfs2_extent_rec)); | 2771 | memset(&el->l_recs[0], 0, sizeof(struct ocfs2_extent_rec)); |
2765 | 2772 | ||
2766 | ocfs2_set_last_eb_blk(et, 0); | 2773 | ocfs2_et_set_last_eb_blk(et, 0); |
2767 | } | 2774 | } |
2768 | 2775 | ||
2769 | ocfs2_journal_dirty(handle, path_root_bh(path)); | 2776 | ocfs2_journal_dirty(handle, path_root_bh(path)); |
@@ -3980,8 +3987,8 @@ static int ocfs2_do_insert_extent(struct inode *inode, | |||
3980 | 3987 | ||
3981 | out_update_clusters: | 3988 | out_update_clusters: |
3982 | if (type->ins_split == SPLIT_NONE) | 3989 | if (type->ins_split == SPLIT_NONE) |
3983 | ocfs2_update_clusters(inode, et, | 3990 | ocfs2_et_update_clusters(inode, et, |
3984 | le16_to_cpu(insert_rec->e_leaf_clusters)); | 3991 | le16_to_cpu(insert_rec->e_leaf_clusters)); |
3985 | 3992 | ||
3986 | ret = ocfs2_journal_dirty(handle, et->root_bh); | 3993 | ret = ocfs2_journal_dirty(handle, et->root_bh); |
3987 | if (ret) | 3994 | if (ret) |
@@ -4229,7 +4236,7 @@ static int ocfs2_figure_insert_type(struct inode *inode, | |||
4229 | * may want it later. | 4236 | * may want it later. |
4230 | */ | 4237 | */ |
4231 | ret = ocfs2_read_block(OCFS2_SB(inode->i_sb), | 4238 | ret = ocfs2_read_block(OCFS2_SB(inode->i_sb), |
4232 | ocfs2_get_last_eb_blk(et), &bh, | 4239 | ocfs2_et_get_last_eb_blk(et), &bh, |
4233 | OCFS2_BH_CACHED, inode); | 4240 | OCFS2_BH_CACHED, inode); |
4234 | if (ret) { | 4241 | if (ret) { |
4235 | mlog_exit(ret); | 4242 | mlog_exit(ret); |
@@ -4306,7 +4313,7 @@ static int ocfs2_figure_insert_type(struct inode *inode, | |||
4306 | * the case that we're doing a tail append, so maybe we can | 4313 | * the case that we're doing a tail append, so maybe we can |
4307 | * take advantage of that information somehow. | 4314 | * take advantage of that information somehow. |
4308 | */ | 4315 | */ |
4309 | if (ocfs2_get_last_eb_blk(et) == | 4316 | if (ocfs2_et_get_last_eb_blk(et) == |
4310 | path_leaf_bh(path)->b_blocknr) { | 4317 | path_leaf_bh(path)->b_blocknr) { |
4311 | /* | 4318 | /* |
4312 | * Ok, ocfs2_find_path() returned us the rightmost | 4319 | * Ok, ocfs2_find_path() returned us the rightmost |
@@ -4814,7 +4821,7 @@ static int __ocfs2_mark_extent_written(struct inode *inode, | |||
4814 | struct ocfs2_extent_block *eb; | 4821 | struct ocfs2_extent_block *eb; |
4815 | 4822 | ||
4816 | ret = ocfs2_read_block(OCFS2_SB(inode->i_sb), | 4823 | ret = ocfs2_read_block(OCFS2_SB(inode->i_sb), |
4817 | ocfs2_get_last_eb_blk(et), | 4824 | ocfs2_et_get_last_eb_blk(et), |
4818 | &last_eb_bh, OCFS2_BH_CACHED, inode); | 4825 | &last_eb_bh, OCFS2_BH_CACHED, inode); |
4819 | if (ret) { | 4826 | if (ret) { |
4820 | mlog_exit(ret); | 4827 | mlog_exit(ret); |
@@ -4981,7 +4988,7 @@ static int ocfs2_split_tree(struct inode *inode, struct ocfs2_extent_tree *et, | |||
4981 | depth = path->p_tree_depth; | 4988 | depth = path->p_tree_depth; |
4982 | if (depth > 0) { | 4989 | if (depth > 0) { |
4983 | ret = ocfs2_read_block(OCFS2_SB(inode->i_sb), | 4990 | ret = ocfs2_read_block(OCFS2_SB(inode->i_sb), |
4984 | ocfs2_get_last_eb_blk(et), | 4991 | ocfs2_et_get_last_eb_blk(et), |
4985 | &last_eb_bh, OCFS2_BH_CACHED, inode); | 4992 | &last_eb_bh, OCFS2_BH_CACHED, inode); |
4986 | if (ret < 0) { | 4993 | if (ret < 0) { |
4987 | mlog_errno(ret); | 4994 | mlog_errno(ret); |