]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | From: Joel Becker <joel.becker@oracle.com> |
2 | Subject: ocfs2: Prefix the ocfs2_extent_tree structure. | |
3 | Patch-mainline: 2.6.28? | |
4 | References: FATE302067 | |
5 | ||
6 | The members of the ocfs2_extent_tree structure gain a prefix of 'et_'. | |
7 | All users are updated. | |
8 | ||
9 | Signed-off-by: Joel Becker <joel.becker@oracle.com> | |
10 | Acked-by: Mark Fasheh <mark.fasheh@suse.com> | |
11 | --- | |
12 | fs/ocfs2/alloc.c | 118 ++++++++++++++++++++++++++++-------------------------- | |
13 | 1 files changed, 61 insertions(+), 57 deletions(-) | |
14 | ||
15 | diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c | |
16 | index 9fe49f2..ab16b89 100644 | |
17 | --- a/fs/ocfs2/alloc.c | |
18 | +++ b/fs/ocfs2/alloc.c | |
19 | @@ -75,28 +75,30 @@ struct ocfs2_extent_tree_operations { | |
20 | }; | |
21 | ||
22 | struct ocfs2_extent_tree { | |
23 | - enum ocfs2_extent_tree_type type; | |
24 | - struct ocfs2_extent_tree_operations *eops; | |
25 | - struct buffer_head *root_bh; | |
26 | - struct ocfs2_extent_list *root_el; | |
27 | - void *private; | |
28 | - unsigned int max_leaf_clusters; | |
29 | + enum ocfs2_extent_tree_type et_type; | |
30 | + struct ocfs2_extent_tree_operations *et_ops; | |
31 | + struct buffer_head *et_root_bh; | |
32 | + struct ocfs2_extent_list *et_root_el; | |
33 | + void *et_private; | |
34 | + unsigned int et_max_leaf_clusters; | |
35 | }; | |
36 | ||
37 | static void ocfs2_dinode_set_last_eb_blk(struct ocfs2_extent_tree *et, | |
38 | u64 blkno) | |
39 | { | |
40 | - struct ocfs2_dinode *di = (struct ocfs2_dinode *)et->root_bh->b_data; | |
41 | + struct ocfs2_dinode *di = | |
42 | + (struct ocfs2_dinode *)et->et_root_bh->b_data; | |
43 | ||
44 | - BUG_ON(et->type != OCFS2_DINODE_EXTENT); | |
45 | + BUG_ON(et->et_type != OCFS2_DINODE_EXTENT); | |
46 | di->i_last_eb_blk = cpu_to_le64(blkno); | |
47 | } | |
48 | ||
49 | static u64 ocfs2_dinode_get_last_eb_blk(struct ocfs2_extent_tree *et) | |
50 | { | |
51 | - struct ocfs2_dinode *di = (struct ocfs2_dinode *)et->root_bh->b_data; | |
52 | + struct ocfs2_dinode *di = | |
53 | + (struct ocfs2_dinode *)et->et_root_bh->b_data; | |
54 | ||
55 | - BUG_ON(et->type != OCFS2_DINODE_EXTENT); | |
56 | + BUG_ON(et->et_type != OCFS2_DINODE_EXTENT); | |
57 | return le64_to_cpu(di->i_last_eb_blk); | |
58 | } | |
59 | ||
60 | @@ -105,7 +107,7 @@ static void ocfs2_dinode_update_clusters(struct inode *inode, | |
61 | u32 clusters) | |
62 | { | |
63 | struct ocfs2_dinode *di = | |
64 | - (struct ocfs2_dinode *)et->root_bh->b_data; | |
65 | + (struct ocfs2_dinode *)et->et_root_bh->b_data; | |
66 | ||
67 | le32_add_cpu(&di->i_clusters, clusters); | |
68 | spin_lock(&OCFS2_I(inode)->ip_lock); | |
69 | @@ -119,9 +121,9 @@ static int ocfs2_dinode_sanity_check(struct inode *inode, | |
70 | int ret = 0; | |
71 | struct ocfs2_dinode *di; | |
72 | ||
73 | - BUG_ON(et->type != OCFS2_DINODE_EXTENT); | |
74 | + BUG_ON(et->et_type != OCFS2_DINODE_EXTENT); | |
75 | ||
76 | - di = (struct ocfs2_dinode *)et->root_bh->b_data; | |
77 | + di = (struct ocfs2_dinode *)et->et_root_bh->b_data; | |
78 | if (!OCFS2_IS_VALID_DINODE(di)) { | |
79 | ret = -EIO; | |
80 | ocfs2_error(inode->i_sb, | |
81 | @@ -143,7 +145,7 @@ static void ocfs2_xattr_value_set_last_eb_blk(struct ocfs2_extent_tree *et, | |
82 | u64 blkno) | |
83 | { | |
84 | struct ocfs2_xattr_value_root *xv = | |
85 | - (struct ocfs2_xattr_value_root *)et->private; | |
86 | + (struct ocfs2_xattr_value_root *)et->et_private; | |
87 | ||
88 | xv->xr_last_eb_blk = cpu_to_le64(blkno); | |
89 | } | |
90 | @@ -151,7 +153,7 @@ static void ocfs2_xattr_value_set_last_eb_blk(struct ocfs2_extent_tree *et, | |
91 | static u64 ocfs2_xattr_value_get_last_eb_blk(struct ocfs2_extent_tree *et) | |
92 | { | |
93 | struct ocfs2_xattr_value_root *xv = | |
94 | - (struct ocfs2_xattr_value_root *) et->private; | |
95 | + (struct ocfs2_xattr_value_root *) et->et_private; | |
96 | ||
97 | return le64_to_cpu(xv->xr_last_eb_blk); | |
98 | } | |
99 | @@ -161,7 +163,7 @@ static void ocfs2_xattr_value_update_clusters(struct inode *inode, | |
100 | u32 clusters) | |
101 | { | |
102 | struct ocfs2_xattr_value_root *xv = | |
103 | - (struct ocfs2_xattr_value_root *)et->private; | |
104 | + (struct ocfs2_xattr_value_root *)et->et_private; | |
105 | ||
106 | le32_add_cpu(&xv->xr_clusters, clusters); | |
107 | } | |
108 | @@ -183,7 +185,7 @@ static void ocfs2_xattr_tree_set_last_eb_blk(struct ocfs2_extent_tree *et, | |
109 | u64 blkno) | |
110 | { | |
111 | struct ocfs2_xattr_block *xb = | |
112 | - (struct ocfs2_xattr_block *) et->root_bh->b_data; | |
113 | + (struct ocfs2_xattr_block *) et->et_root_bh->b_data; | |
114 | struct ocfs2_xattr_tree_root *xt = &xb->xb_attrs.xb_root; | |
115 | ||
116 | xt->xt_last_eb_blk = cpu_to_le64(blkno); | |
117 | @@ -192,7 +194,7 @@ static void ocfs2_xattr_tree_set_last_eb_blk(struct ocfs2_extent_tree *et, | |
118 | static u64 ocfs2_xattr_tree_get_last_eb_blk(struct ocfs2_extent_tree *et) | |
119 | { | |
120 | struct ocfs2_xattr_block *xb = | |
121 | - (struct ocfs2_xattr_block *) et->root_bh->b_data; | |
122 | + (struct ocfs2_xattr_block *) et->et_root_bh->b_data; | |
123 | struct ocfs2_xattr_tree_root *xt = &xb->xb_attrs.xb_root; | |
124 | ||
125 | return le64_to_cpu(xt->xt_last_eb_blk); | |
126 | @@ -203,7 +205,7 @@ static void ocfs2_xattr_tree_update_clusters(struct inode *inode, | |
127 | u32 clusters) | |
128 | { | |
129 | struct ocfs2_xattr_block *xb = | |
130 | - (struct ocfs2_xattr_block *)et->root_bh->b_data; | |
131 | + (struct ocfs2_xattr_block *)et->et_root_bh->b_data; | |
132 | ||
133 | le32_add_cpu(&xb->xb_attrs.xb_root.xt_clusters, clusters); | |
134 | } | |
135 | @@ -233,25 +235,26 @@ static struct ocfs2_extent_tree* | |
136 | if (!et) | |
137 | return NULL; | |
138 | ||
139 | - et->type = et_type; | |
140 | + et->et_type = et_type; | |
141 | get_bh(bh); | |
142 | - et->root_bh = bh; | |
143 | - et->private = private; | |
144 | + et->et_root_bh = bh; | |
145 | + et->et_private = private; | |
146 | ||
147 | if (et_type == OCFS2_DINODE_EXTENT) { | |
148 | - et->root_el = &((struct ocfs2_dinode *)bh->b_data)->id2.i_list; | |
149 | - et->eops = &ocfs2_dinode_et_ops; | |
150 | + et->et_root_el = | |
151 | + &((struct ocfs2_dinode *)bh->b_data)->id2.i_list; | |
152 | + et->et_ops = &ocfs2_dinode_et_ops; | |
153 | } else if (et_type == OCFS2_XATTR_VALUE_EXTENT) { | |
154 | struct ocfs2_xattr_value_root *xv = | |
155 | (struct ocfs2_xattr_value_root *) private; | |
156 | - et->root_el = &xv->xr_list; | |
157 | - et->eops = &ocfs2_xattr_et_ops; | |
158 | + et->et_root_el = &xv->xr_list; | |
159 | + et->et_ops = &ocfs2_xattr_et_ops; | |
160 | } else if (et_type == OCFS2_XATTR_TREE_EXTENT) { | |
161 | struct ocfs2_xattr_block *xb = | |
162 | (struct ocfs2_xattr_block *)bh->b_data; | |
163 | - et->root_el = &xb->xb_attrs.xb_root.xt_list; | |
164 | - et->eops = &ocfs2_xattr_tree_et_ops; | |
165 | - et->max_leaf_clusters = ocfs2_clusters_for_bytes(inode->i_sb, | |
166 | + et->et_root_el = &xb->xb_attrs.xb_root.xt_list; | |
167 | + et->et_ops = &ocfs2_xattr_tree_et_ops; | |
168 | + et->et_max_leaf_clusters = ocfs2_clusters_for_bytes(inode->i_sb, | |
169 | OCFS2_MAX_XATTR_TREE_LEAF_SIZE); | |
170 | } | |
171 | ||
172 | @@ -261,7 +264,7 @@ static struct ocfs2_extent_tree* | |
173 | static void ocfs2_free_extent_tree(struct ocfs2_extent_tree *et) | |
174 | { | |
175 | if (et) { | |
176 | - brelse(et->root_bh); | |
177 | + brelse(et->et_root_bh); | |
178 | kfree(et); | |
179 | } | |
180 | } | |
181 | @@ -269,25 +272,25 @@ static void ocfs2_free_extent_tree(struct ocfs2_extent_tree *et) | |
182 | static inline void ocfs2_et_set_last_eb_blk(struct ocfs2_extent_tree *et, | |
183 | u64 new_last_eb_blk) | |
184 | { | |
185 | - et->eops->eo_set_last_eb_blk(et, new_last_eb_blk); | |
186 | + et->et_ops->eo_set_last_eb_blk(et, new_last_eb_blk); | |
187 | } | |
188 | ||
189 | static inline u64 ocfs2_et_get_last_eb_blk(struct ocfs2_extent_tree *et) | |
190 | { | |
191 | - return et->eops->eo_get_last_eb_blk(et); | |
192 | + return et->et_ops->eo_get_last_eb_blk(et); | |
193 | } | |
194 | ||
195 | static inline void ocfs2_et_update_clusters(struct inode *inode, | |
196 | struct ocfs2_extent_tree *et, | |
197 | u32 clusters) | |
198 | { | |
199 | - et->eops->eo_update_clusters(inode, et, clusters); | |
200 | + et->et_ops->eo_update_clusters(inode, et, clusters); | |
201 | } | |
202 | ||
203 | static inline int ocfs2_et_sanity_check(struct inode *inode, | |
204 | struct ocfs2_extent_tree *et) | |
205 | { | |
206 | - return et->eops->eo_sanity_check(inode, et); | |
207 | + return et->et_ops->eo_sanity_check(inode, et); | |
208 | } | |
209 | ||
210 | static void ocfs2_free_truncate_context(struct ocfs2_truncate_context *tc); | |
211 | @@ -805,7 +808,7 @@ static int ocfs2_add_branch(struct ocfs2_super *osb, | |
212 | eb = (struct ocfs2_extent_block *) eb_bh->b_data; | |
213 | el = &eb->h_list; | |
214 | } else | |
215 | - el = et->root_el; | |
216 | + el = et->et_root_el; | |
217 | ||
218 | /* we never add a branch to a leaf. */ | |
219 | BUG_ON(!el->l_tree_depth); | |
220 | @@ -895,7 +898,7 @@ static int ocfs2_add_branch(struct ocfs2_super *osb, | |
221 | mlog_errno(status); | |
222 | goto bail; | |
223 | } | |
224 | - status = ocfs2_journal_access(handle, inode, et->root_bh, | |
225 | + status = ocfs2_journal_access(handle, inode, et->et_root_bh, | |
226 | OCFS2_JOURNAL_ACCESS_WRITE); | |
227 | if (status < 0) { | |
228 | mlog_errno(status); | |
229 | @@ -928,7 +931,7 @@ static int ocfs2_add_branch(struct ocfs2_super *osb, | |
230 | status = ocfs2_journal_dirty(handle, *last_eb_bh); | |
231 | if (status < 0) | |
232 | mlog_errno(status); | |
233 | - status = ocfs2_journal_dirty(handle, et->root_bh); | |
234 | + status = ocfs2_journal_dirty(handle, et->et_root_bh); | |
235 | if (status < 0) | |
236 | mlog_errno(status); | |
237 | if (eb_bh) { | |
238 | @@ -994,7 +997,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb, | |
239 | } | |
240 | ||
241 | eb_el = &eb->h_list; | |
242 | - root_el = et->root_el; | |
243 | + root_el = et->et_root_el; | |
244 | ||
245 | status = ocfs2_journal_access(handle, inode, new_eb_bh, | |
246 | OCFS2_JOURNAL_ACCESS_CREATE); | |
247 | @@ -1015,7 +1018,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb, | |
248 | goto bail; | |
249 | } | |
250 | ||
251 | - status = ocfs2_journal_access(handle, inode, et->root_bh, | |
252 | + status = ocfs2_journal_access(handle, inode, et->et_root_bh, | |
253 | OCFS2_JOURNAL_ACCESS_WRITE); | |
254 | if (status < 0) { | |
255 | mlog_errno(status); | |
256 | @@ -1038,7 +1041,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb, | |
257 | if (root_el->l_tree_depth == cpu_to_le16(1)) | |
258 | ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); | |
259 | ||
260 | - status = ocfs2_journal_dirty(handle, et->root_bh); | |
261 | + status = ocfs2_journal_dirty(handle, et->et_root_bh); | |
262 | if (status < 0) { | |
263 | mlog_errno(status); | |
264 | goto bail; | |
265 | @@ -1088,7 +1091,7 @@ static int ocfs2_find_branch_target(struct ocfs2_super *osb, | |
266 | ||
267 | *target_bh = NULL; | |
268 | ||
269 | - el = et->root_el; | |
270 | + el = et->et_root_el; | |
271 | ||
272 | while(le16_to_cpu(el->l_tree_depth) > 1) { | |
273 | if (le16_to_cpu(el->l_next_free_rec) == 0) { | |
274 | @@ -1140,7 +1143,7 @@ static int ocfs2_find_branch_target(struct ocfs2_super *osb, | |
275 | ||
276 | /* If we didn't find one and the fe doesn't have any room, | |
277 | * then return '1' */ | |
278 | - el = et->root_el; | |
279 | + el = et->et_root_el; | |
280 | if (!lowest_bh && (el->l_next_free_rec == el->l_count)) | |
281 | status = 1; | |
282 | ||
283 | @@ -1169,7 +1172,7 @@ static int ocfs2_grow_tree(struct inode *inode, handle_t *handle, | |
284 | struct ocfs2_alloc_context *meta_ac) | |
285 | { | |
286 | int ret, shift; | |
287 | - struct ocfs2_extent_list *el = et->root_el; | |
288 | + struct ocfs2_extent_list *el = et->et_root_el; | |
289 | int depth = le16_to_cpu(el->l_tree_depth); | |
290 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | |
291 | struct buffer_head *bh = NULL; | |
292 | @@ -2774,7 +2777,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, | |
293 | */ | |
294 | ocfs2_unlink_path(inode, handle, dealloc, path, 1); | |
295 | ||
296 | - el = et->root_el; | |
297 | + el = et->et_root_el; | |
298 | el->l_tree_depth = 0; | |
299 | el->l_next_free_rec = 0; | |
300 | memset(&el->l_recs[0], 0, sizeof(struct ocfs2_extent_rec)); | |
301 | @@ -3907,9 +3910,9 @@ static int ocfs2_do_insert_extent(struct inode *inode, | |
302 | struct ocfs2_path *left_path = NULL; | |
303 | struct ocfs2_extent_list *el; | |
304 | ||
305 | - el = et->root_el; | |
306 | + el = et->et_root_el; | |
307 | ||
308 | - ret = ocfs2_journal_access(handle, inode, et->root_bh, | |
309 | + ret = ocfs2_journal_access(handle, inode, et->et_root_bh, | |
310 | OCFS2_JOURNAL_ACCESS_WRITE); | |
311 | if (ret) { | |
312 | mlog_errno(ret); | |
313 | @@ -3921,7 +3924,7 @@ static int ocfs2_do_insert_extent(struct inode *inode, | |
314 | goto out_update_clusters; | |
315 | } | |
316 | ||
317 | - right_path = ocfs2_new_path(et->root_bh, et->root_el); | |
318 | + right_path = ocfs2_new_path(et->et_root_bh, et->et_root_el); | |
319 | if (!right_path) { | |
320 | ret = -ENOMEM; | |
321 | mlog_errno(ret); | |
322 | @@ -3971,7 +3974,7 @@ static int ocfs2_do_insert_extent(struct inode *inode, | |
323 | * ocfs2_rotate_tree_right() might have extended the | |
324 | * transaction without re-journaling our tree root. | |
325 | */ | |
326 | - ret = ocfs2_journal_access(handle, inode, et->root_bh, | |
327 | + ret = ocfs2_journal_access(handle, inode, et->et_root_bh, | |
328 | OCFS2_JOURNAL_ACCESS_WRITE); | |
329 | if (ret) { | |
330 | mlog_errno(ret); | |
331 | @@ -3999,7 +4002,7 @@ out_update_clusters: | |
332 | ocfs2_et_update_clusters(inode, et, | |
333 | le16_to_cpu(insert_rec->e_leaf_clusters)); | |
334 | ||
335 | - ret = ocfs2_journal_dirty(handle, et->root_bh); | |
336 | + ret = ocfs2_journal_dirty(handle, et->et_root_bh); | |
337 | if (ret) | |
338 | mlog_errno(ret); | |
339 | ||
340 | @@ -4157,7 +4160,8 @@ static void ocfs2_figure_contig_type(struct inode *inode, | |
341 | * Caller might want us to limit the size of extents, don't | |
342 | * calculate contiguousness if we might exceed that limit. | |
343 | */ | |
344 | - if (et->max_leaf_clusters && len > et->max_leaf_clusters) | |
345 | + if (et->et_max_leaf_clusters && | |
346 | + (len > et->et_max_leaf_clusters)) | |
347 | insert->ins_contig = CONTIG_NONE; | |
348 | } | |
349 | } | |
350 | @@ -4234,7 +4238,7 @@ static int ocfs2_figure_insert_type(struct inode *inode, | |
351 | ||
352 | insert->ins_split = SPLIT_NONE; | |
353 | ||
354 | - el = et->root_el; | |
355 | + el = et->et_root_el; | |
356 | insert->ins_tree_depth = le16_to_cpu(el->l_tree_depth); | |
357 | ||
358 | if (el->l_tree_depth) { | |
359 | @@ -4272,7 +4276,7 @@ static int ocfs2_figure_insert_type(struct inode *inode, | |
360 | return 0; | |
361 | } | |
362 | ||
363 | - path = ocfs2_new_path(et->root_bh, et->root_el); | |
364 | + path = ocfs2_new_path(et->et_root_bh, et->et_root_el); | |
365 | if (!path) { | |
366 | ret = -ENOMEM; | |
367 | mlog_errno(ret); | |
368 | @@ -4413,7 +4417,7 @@ static int ocfs2_insert_extent(struct ocfs2_super *osb, | |
369 | status = ocfs2_do_insert_extent(inode, handle, et, &rec, &insert); | |
370 | if (status < 0) | |
371 | mlog_errno(status); | |
372 | - else if (et->type == OCFS2_DINODE_EXTENT) | |
373 | + else if (et->et_type == OCFS2_DINODE_EXTENT) | |
374 | ocfs2_extent_map_insert_rec(inode, &rec); | |
375 | ||
376 | bail: | |
377 | @@ -4687,7 +4691,7 @@ leftright: | |
378 | */ | |
379 | rec = path_leaf_el(path)->l_recs[split_index]; | |
380 | ||
381 | - rightmost_el = et->root_el; | |
382 | + rightmost_el = et->et_root_el; | |
383 | ||
384 | depth = le16_to_cpu(rightmost_el->l_tree_depth); | |
385 | if (depth) { | |
386 | @@ -4930,7 +4934,7 @@ int ocfs2_mark_extent_written(struct inode *inode, struct buffer_head *root_bh, | |
387 | if (et_type == OCFS2_DINODE_EXTENT) | |
388 | ocfs2_extent_map_trunc(inode, 0); | |
389 | ||
390 | - left_path = ocfs2_new_path(et->root_bh, et->root_el); | |
391 | + left_path = ocfs2_new_path(et->et_root_bh, et->et_root_el); | |
392 | if (!left_path) { | |
393 | ret = -ENOMEM; | |
394 | mlog_errno(ret); | |
395 | @@ -5010,7 +5014,7 @@ static int ocfs2_split_tree(struct inode *inode, struct ocfs2_extent_tree *et, | |
396 | rightmost_el = path_leaf_el(path); | |
397 | ||
398 | credits += path->p_tree_depth + | |
399 | - ocfs2_extend_meta_needed(et->root_el); | |
400 | + ocfs2_extend_meta_needed(et->et_root_el); | |
401 | ret = ocfs2_extend_trans(handle, credits); | |
402 | if (ret) { | |
403 | mlog_errno(ret); | |
404 | @@ -5223,7 +5227,7 @@ int ocfs2_remove_extent(struct inode *inode, struct buffer_head *root_bh, | |
405 | ||
406 | ocfs2_extent_map_trunc(inode, 0); | |
407 | ||
408 | - path = ocfs2_new_path(et->root_bh, et->root_el); | |
409 | + path = ocfs2_new_path(et->et_root_bh, et->et_root_el); | |
410 | if (!path) { | |
411 | ret = -ENOMEM; | |
412 | mlog_errno(ret); | |
413 | -- | |
414 | 1.5.4.5 | |
415 |