]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Joel Becker <joel.becker@oracle.com> |
2 | Subject: ocfs2: Prefix the extent tree operations structure. | |
3 | Patch-mainline: 2.6.28? | |
4 | References: FATE302067 | |
5 | ||
6 | The ocfs2_extent_tree_operations structure gains a field prefix on its | |
7 | members. The ->eo_sanity_check() operation gains a wrapper function for | |
8 | completeness. All of the extent tree operation wrappers gain a | |
9 | consistent name (ocfs2_et_*()). | |
10 | ||
11 | Signed-off-by: Joel Becker <joel.becker@oracle.com> | |
12 | Acked-by: Mark Fasheh <mark.fasheh@suse.com> | |
13 | --- | |
14 | fs/ocfs2/alloc.c | 85 +++++++++++++++++++++++++++++------------------------ | |
15 | 1 files changed, 46 insertions(+), 39 deletions(-) | |
16 | ||
17 | diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c | |
18 | index 16879bd..9fe49f2 100644 | |
19 | --- a/fs/ocfs2/alloc.c | |
20 | +++ b/fs/ocfs2/alloc.c | |
21 | @@ -65,12 +65,13 @@ | |
22 | struct ocfs2_extent_tree; | |
23 | ||
24 | struct ocfs2_extent_tree_operations { | |
25 | - void (*set_last_eb_blk) (struct ocfs2_extent_tree *et, u64 blkno); | |
26 | - u64 (*get_last_eb_blk) (struct ocfs2_extent_tree *et); | |
27 | - void (*update_clusters) (struct inode *inode, | |
28 | - struct ocfs2_extent_tree *et, | |
29 | - u32 new_clusters); | |
30 | - int (*sanity_check) (struct inode *inode, struct ocfs2_extent_tree *et); | |
31 | + void (*eo_set_last_eb_blk)(struct ocfs2_extent_tree *et, | |
32 | + u64 blkno); | |
33 | + u64 (*eo_get_last_eb_blk)(struct ocfs2_extent_tree *et); | |
34 | + void (*eo_update_clusters)(struct inode *inode, | |
35 | + struct ocfs2_extent_tree *et, | |
36 | + u32 new_clusters); | |
37 | + int (*eo_sanity_check)(struct inode *inode, struct ocfs2_extent_tree *et); | |
38 | }; | |
39 | ||
40 | struct ocfs2_extent_tree { | |
41 | @@ -132,10 +133,10 @@ static int ocfs2_dinode_sanity_check(struct inode *inode, | |
42 | } | |
43 | ||
44 | static struct ocfs2_extent_tree_operations ocfs2_dinode_et_ops = { | |
45 | - .set_last_eb_blk = ocfs2_dinode_set_last_eb_blk, | |
46 | - .get_last_eb_blk = ocfs2_dinode_get_last_eb_blk, | |
47 | - .update_clusters = ocfs2_dinode_update_clusters, | |
48 | - .sanity_check = ocfs2_dinode_sanity_check, | |
49 | + .eo_set_last_eb_blk = ocfs2_dinode_set_last_eb_blk, | |
50 | + .eo_get_last_eb_blk = ocfs2_dinode_get_last_eb_blk, | |
51 | + .eo_update_clusters = ocfs2_dinode_update_clusters, | |
52 | + .eo_sanity_check = ocfs2_dinode_sanity_check, | |
53 | }; | |
54 | ||
55 | static void ocfs2_xattr_value_set_last_eb_blk(struct ocfs2_extent_tree *et, | |
56 | @@ -172,10 +173,10 @@ static int ocfs2_xattr_value_sanity_check(struct inode *inode, | |
57 | } | |
58 | ||
59 | static struct ocfs2_extent_tree_operations ocfs2_xattr_et_ops = { | |
60 | - .set_last_eb_blk = ocfs2_xattr_value_set_last_eb_blk, | |
61 | - .get_last_eb_blk = ocfs2_xattr_value_get_last_eb_blk, | |
62 | - .update_clusters = ocfs2_xattr_value_update_clusters, | |
63 | - .sanity_check = ocfs2_xattr_value_sanity_check, | |
64 | + .eo_set_last_eb_blk = ocfs2_xattr_value_set_last_eb_blk, | |
65 | + .eo_get_last_eb_blk = ocfs2_xattr_value_get_last_eb_blk, | |
66 | + .eo_update_clusters = ocfs2_xattr_value_update_clusters, | |
67 | + .eo_sanity_check = ocfs2_xattr_value_sanity_check, | |
68 | }; | |
69 | ||
70 | static void ocfs2_xattr_tree_set_last_eb_blk(struct ocfs2_extent_tree *et, | |
71 | @@ -214,10 +215,10 @@ static int ocfs2_xattr_tree_sanity_check(struct inode *inode, | |
72 | } | |
73 | ||
74 | static struct ocfs2_extent_tree_operations ocfs2_xattr_tree_et_ops = { | |
75 | - .set_last_eb_blk = ocfs2_xattr_tree_set_last_eb_blk, | |
76 | - .get_last_eb_blk = ocfs2_xattr_tree_get_last_eb_blk, | |
77 | - .update_clusters = ocfs2_xattr_tree_update_clusters, | |
78 | - .sanity_check = ocfs2_xattr_tree_sanity_check, | |
79 | + .eo_set_last_eb_blk = ocfs2_xattr_tree_set_last_eb_blk, | |
80 | + .eo_get_last_eb_blk = ocfs2_xattr_tree_get_last_eb_blk, | |
81 | + .eo_update_clusters = ocfs2_xattr_tree_update_clusters, | |
82 | + .eo_sanity_check = ocfs2_xattr_tree_sanity_check, | |
83 | }; | |
84 | ||
85 | static struct ocfs2_extent_tree* | |
86 | @@ -265,22 +266,28 @@ static void ocfs2_free_extent_tree(struct ocfs2_extent_tree *et) | |
87 | } | |
88 | } | |
89 | ||
90 | -static inline void ocfs2_set_last_eb_blk(struct ocfs2_extent_tree *et, | |
91 | - u64 new_last_eb_blk) | |
92 | +static inline void ocfs2_et_set_last_eb_blk(struct ocfs2_extent_tree *et, | |
93 | + u64 new_last_eb_blk) | |
94 | { | |
95 | - et->eops->set_last_eb_blk(et, new_last_eb_blk); | |
96 | + et->eops->eo_set_last_eb_blk(et, new_last_eb_blk); | |
97 | } | |
98 | ||
99 | -static inline u64 ocfs2_get_last_eb_blk(struct ocfs2_extent_tree *et) | |
100 | +static inline u64 ocfs2_et_get_last_eb_blk(struct ocfs2_extent_tree *et) | |
101 | { | |
102 | - return et->eops->get_last_eb_blk(et); | |
103 | + return et->eops->eo_get_last_eb_blk(et); | |
104 | } | |
105 | ||
106 | -static inline void ocfs2_update_clusters(struct inode *inode, | |
107 | - struct ocfs2_extent_tree *et, | |
108 | - u32 clusters) | |
109 | +static inline void ocfs2_et_update_clusters(struct inode *inode, | |
110 | + struct ocfs2_extent_tree *et, | |
111 | + u32 clusters) | |
112 | +{ | |
113 | + et->eops->eo_update_clusters(inode, et, clusters); | |
114 | +} | |
115 | + | |
116 | +static inline int ocfs2_et_sanity_check(struct inode *inode, | |
117 | + struct ocfs2_extent_tree *et) | |
118 | { | |
119 | - et->eops->update_clusters(inode, et, clusters); | |
120 | + return et->eops->eo_sanity_check(inode, et); | |
121 | } | |
122 | ||
123 | static void ocfs2_free_truncate_context(struct ocfs2_truncate_context *tc); | |
124 | @@ -913,7 +920,7 @@ static int ocfs2_add_branch(struct ocfs2_super *osb, | |
125 | ||
126 | /* fe needs a new last extent block pointer, as does the | |
127 | * next_leaf on the previously last-extent-block. */ | |
128 | - ocfs2_set_last_eb_blk(et, new_last_eb_blk); | |
129 | + ocfs2_et_set_last_eb_blk(et, new_last_eb_blk); | |
130 | ||
131 | eb = (struct ocfs2_extent_block *) (*last_eb_bh)->b_data; | |
132 | eb->h_next_leaf_blk = cpu_to_le64(new_last_eb_blk); | |
133 | @@ -1029,7 +1036,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb, | |
134 | /* If this is our 1st tree depth shift, then last_eb_blk | |
135 | * becomes the allocated extent block */ | |
136 | if (root_el->l_tree_depth == cpu_to_le16(1)) | |
137 | - ocfs2_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); | |
138 | + ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); | |
139 | ||
140 | status = ocfs2_journal_dirty(handle, et->root_bh); | |
141 | if (status < 0) { | |
142 | @@ -2436,7 +2443,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle, | |
143 | ocfs2_update_edge_lengths(inode, handle, left_path); | |
144 | ||
145 | eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data; | |
146 | - ocfs2_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); | |
147 | + ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); | |
148 | ||
149 | /* | |
150 | * Removal of the extent in the left leaf was skipped | |
151 | @@ -2697,7 +2704,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, | |
152 | struct ocfs2_extent_list *el; | |
153 | ||
154 | ||
155 | - ret = et->eops->sanity_check(inode, et); | |
156 | + ret = ocfs2_et_sanity_check(inode, et); | |
157 | if (ret) | |
158 | goto out; | |
159 | /* | |
160 | @@ -2756,7 +2763,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, | |
161 | ocfs2_update_edge_lengths(inode, handle, left_path); | |
162 | ||
163 | eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data; | |
164 | - ocfs2_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); | |
165 | + ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); | |
166 | } else { | |
167 | /* | |
168 | * 'path' is also the leftmost path which | |
169 | @@ -2772,7 +2779,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, | |
170 | el->l_next_free_rec = 0; | |
171 | memset(&el->l_recs[0], 0, sizeof(struct ocfs2_extent_rec)); | |
172 | ||
173 | - ocfs2_set_last_eb_blk(et, 0); | |
174 | + ocfs2_et_set_last_eb_blk(et, 0); | |
175 | } | |
176 | ||
177 | ocfs2_journal_dirty(handle, path_root_bh(path)); | |
178 | @@ -3989,8 +3996,8 @@ static int ocfs2_do_insert_extent(struct inode *inode, | |
179 | ||
180 | out_update_clusters: | |
181 | if (type->ins_split == SPLIT_NONE) | |
182 | - ocfs2_update_clusters(inode, et, | |
183 | - le16_to_cpu(insert_rec->e_leaf_clusters)); | |
184 | + ocfs2_et_update_clusters(inode, et, | |
185 | + le16_to_cpu(insert_rec->e_leaf_clusters)); | |
186 | ||
187 | ret = ocfs2_journal_dirty(handle, et->root_bh); | |
188 | if (ret) | |
189 | @@ -4238,7 +4245,7 @@ static int ocfs2_figure_insert_type(struct inode *inode, | |
190 | * may want it later. | |
191 | */ | |
192 | ret = ocfs2_read_block(OCFS2_SB(inode->i_sb), | |
193 | - ocfs2_get_last_eb_blk(et), &bh, | |
194 | + ocfs2_et_get_last_eb_blk(et), &bh, | |
195 | OCFS2_BH_CACHED, inode); | |
196 | if (ret) { | |
197 | mlog_exit(ret); | |
198 | @@ -4315,7 +4322,7 @@ static int ocfs2_figure_insert_type(struct inode *inode, | |
199 | * the case that we're doing a tail append, so maybe we can | |
200 | * take advantage of that information somehow. | |
201 | */ | |
202 | - if (ocfs2_get_last_eb_blk(et) == | |
203 | + if (ocfs2_et_get_last_eb_blk(et) == | |
204 | path_leaf_bh(path)->b_blocknr) { | |
205 | /* | |
206 | * Ok, ocfs2_find_path() returned us the rightmost | |
207 | @@ -4823,7 +4830,7 @@ static int __ocfs2_mark_extent_written(struct inode *inode, | |
208 | struct ocfs2_extent_block *eb; | |
209 | ||
210 | ret = ocfs2_read_block(OCFS2_SB(inode->i_sb), | |
211 | - ocfs2_get_last_eb_blk(et), | |
212 | + ocfs2_et_get_last_eb_blk(et), | |
213 | &last_eb_bh, OCFS2_BH_CACHED, inode); | |
214 | if (ret) { | |
215 | mlog_exit(ret); | |
216 | @@ -4990,7 +4997,7 @@ static int ocfs2_split_tree(struct inode *inode, struct ocfs2_extent_tree *et, | |
217 | depth = path->p_tree_depth; | |
218 | if (depth > 0) { | |
219 | ret = ocfs2_read_block(OCFS2_SB(inode->i_sb), | |
220 | - ocfs2_get_last_eb_blk(et), | |
221 | + ocfs2_et_get_last_eb_blk(et), | |
222 | &last_eb_bh, OCFS2_BH_CACHED, inode); | |
223 | if (ret < 0) { | |
224 | mlog_errno(ret); | |
225 | -- | |
226 | 1.5.4.5 | |
227 |