]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Joel Becker <joel.becker@oracle.com> |
2 | Date: Sat, 18 Oct 2008 19:11:42 -0700 | |
3 | Subject: ocfs2: Field prefixes for the xattr_bucket structure | |
4 | Patch-mainline: 2.6.29 | |
5 | ||
6 | The ocfs2_xattr_bucket structure keeps track of the buffers for one | |
7 | xattr bucket. Let's prefix the fields for easier code navigation. | |
8 | ||
9 | Signed-off-by: Joel Becker <joel.becker@oracle.com> | |
10 | Signed-off-by: Mark Fasheh <mfasheh@suse.com> | |
11 | --- | |
12 | fs/ocfs2/xattr.c | 100 +++++++++++++++++++++++++++--------------------------- | |
13 | 1 files changed, 50 insertions(+), 50 deletions(-) | |
14 | ||
15 | diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c | |
16 | index 74d7367..9c0ee42 100644 | |
17 | --- a/fs/ocfs2/xattr.c | |
18 | +++ b/fs/ocfs2/xattr.c | |
19 | @@ -61,8 +61,8 @@ struct ocfs2_xattr_def_value_root { | |
20 | }; | |
21 | ||
22 | struct ocfs2_xattr_bucket { | |
23 | - struct buffer_head *bhs[OCFS2_XATTR_MAX_BLOCKS_PER_BUCKET]; | |
24 | - struct ocfs2_xattr_header *xh; | |
25 | + struct buffer_head *bu_bhs[OCFS2_XATTR_MAX_BLOCKS_PER_BUCKET]; | |
26 | + struct ocfs2_xattr_header *bu_xh; | |
27 | }; | |
28 | ||
29 | #define OCFS2_XATTR_ROOT_SIZE (sizeof(struct ocfs2_xattr_def_value_root)) | |
30 | @@ -795,11 +795,11 @@ static int ocfs2_xattr_block_get(struct inode *inode, | |
31 | ||
32 | if (le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED) { | |
33 | ret = ocfs2_xattr_bucket_get_name_value(inode, | |
34 | - xs->bucket.xh, | |
35 | + xs->bucket.bu_xh, | |
36 | i, | |
37 | &block_off, | |
38 | &name_offset); | |
39 | - xs->base = xs->bucket.bhs[block_off]->b_data; | |
40 | + xs->base = xs->bucket.bu_bhs[block_off]->b_data; | |
41 | } | |
42 | if (ocfs2_xattr_is_local(xs->here)) { | |
43 | memcpy(buffer, (void *)xs->base + | |
44 | @@ -818,7 +818,7 @@ static int ocfs2_xattr_block_get(struct inode *inode, | |
45 | ret = size; | |
46 | cleanup: | |
47 | for (i = 0; i < OCFS2_XATTR_MAX_BLOCKS_PER_BUCKET; i++) | |
48 | - brelse(xs->bucket.bhs[i]); | |
49 | + brelse(xs->bucket.bu_bhs[i]); | |
50 | memset(&xs->bucket, 0, sizeof(xs->bucket)); | |
51 | ||
52 | brelse(xs->xattr_bh); | |
53 | @@ -2032,7 +2032,7 @@ cleanup: | |
54 | brelse(di_bh); | |
55 | brelse(xbs.xattr_bh); | |
56 | for (i = 0; i < blk_per_bucket; i++) | |
57 | - brelse(xbs.bucket.bhs[i]); | |
58 | + brelse(xbs.bucket.bu_bhs[i]); | |
59 | ||
60 | return ret; | |
61 | } | |
62 | @@ -2276,13 +2276,13 @@ static int ocfs2_xattr_bucket_find(struct inode *inode, | |
63 | lower_bh = bh; | |
64 | bh = NULL; | |
65 | } | |
66 | - xs->bucket.bhs[0] = lower_bh; | |
67 | - xs->bucket.xh = (struct ocfs2_xattr_header *) | |
68 | - xs->bucket.bhs[0]->b_data; | |
69 | + xs->bucket.bu_bhs[0] = lower_bh; | |
70 | + xs->bucket.bu_xh = (struct ocfs2_xattr_header *) | |
71 | + xs->bucket.bu_bhs[0]->b_data; | |
72 | lower_bh = NULL; | |
73 | ||
74 | - xs->header = xs->bucket.xh; | |
75 | - xs->base = xs->bucket.bhs[0]->b_data; | |
76 | + xs->header = xs->bucket.bu_xh; | |
77 | + xs->base = xs->bucket.bu_bhs[0]->b_data; | |
78 | xs->end = xs->base + inode->i_sb->s_blocksize; | |
79 | ||
80 | if (found) { | |
81 | @@ -2290,8 +2290,8 @@ static int ocfs2_xattr_bucket_find(struct inode *inode, | |
82 | * If we have found the xattr enty, read all the blocks in | |
83 | * this bucket. | |
84 | */ | |
85 | - ret = ocfs2_read_blocks(inode, xs->bucket.bhs[0]->b_blocknr + 1, | |
86 | - blk_per_bucket - 1, &xs->bucket.bhs[1], | |
87 | + ret = ocfs2_read_blocks(inode, xs->bucket.bu_bhs[0]->b_blocknr + 1, | |
88 | + blk_per_bucket - 1, &xs->bucket.bu_bhs[1], | |
89 | 0); | |
90 | if (ret) { | |
91 | mlog_errno(ret); | |
92 | @@ -2300,7 +2300,7 @@ static int ocfs2_xattr_bucket_find(struct inode *inode, | |
93 | ||
94 | xs->here = &xs->header->xh_entries[index]; | |
95 | mlog(0, "find xattr %s in bucket %llu, entry = %u\n", name, | |
96 | - (unsigned long long)xs->bucket.bhs[0]->b_blocknr, index); | |
97 | + (unsigned long long)xs->bucket.bu_bhs[0]->b_blocknr, index); | |
98 | } else | |
99 | ret = -ENODATA; | |
100 | ||
101 | @@ -2370,23 +2370,23 @@ static int ocfs2_iterate_xattr_buckets(struct inode *inode, | |
102 | ||
103 | for (i = 0; i < num_buckets; i++, blkno += blk_per_bucket) { | |
104 | ret = ocfs2_read_blocks(inode, blkno, blk_per_bucket, | |
105 | - bucket.bhs, 0); | |
106 | + bucket.bu_bhs, 0); | |
107 | if (ret) { | |
108 | mlog_errno(ret); | |
109 | goto out; | |
110 | } | |
111 | ||
112 | - bucket.xh = (struct ocfs2_xattr_header *)bucket.bhs[0]->b_data; | |
113 | + bucket.bu_xh = (struct ocfs2_xattr_header *)bucket.bu_bhs[0]->b_data; | |
114 | /* | |
115 | * The real bucket num in this series of blocks is stored | |
116 | * in the 1st bucket. | |
117 | */ | |
118 | if (i == 0) | |
119 | - num_buckets = le16_to_cpu(bucket.xh->xh_num_buckets); | |
120 | + num_buckets = le16_to_cpu(bucket.bu_xh->xh_num_buckets); | |
121 | ||
122 | mlog(0, "iterating xattr bucket %llu, first hash %u\n", | |
123 | (unsigned long long)blkno, | |
124 | - le32_to_cpu(bucket.xh->xh_entries[0].xe_name_hash)); | |
125 | + le32_to_cpu(bucket.bu_xh->xh_entries[0].xe_name_hash)); | |
126 | if (func) { | |
127 | ret = func(inode, &bucket, para); | |
128 | if (ret) { | |
129 | @@ -2396,13 +2396,13 @@ static int ocfs2_iterate_xattr_buckets(struct inode *inode, | |
130 | } | |
131 | ||
132 | for (j = 0; j < blk_per_bucket; j++) | |
133 | - brelse(bucket.bhs[j]); | |
134 | + brelse(bucket.bu_bhs[j]); | |
135 | memset(&bucket, 0, sizeof(bucket)); | |
136 | } | |
137 | ||
138 | out: | |
139 | for (j = 0; j < blk_per_bucket; j++) | |
140 | - brelse(bucket.bhs[j]); | |
141 | + brelse(bucket.bu_bhs[j]); | |
142 | ||
143 | return ret; | |
144 | } | |
145 | @@ -2441,21 +2441,21 @@ static int ocfs2_list_xattr_bucket(struct inode *inode, | |
146 | int i, block_off, new_offset; | |
147 | const char *prefix, *name; | |
148 | ||
149 | - for (i = 0 ; i < le16_to_cpu(bucket->xh->xh_count); i++) { | |
150 | - struct ocfs2_xattr_entry *entry = &bucket->xh->xh_entries[i]; | |
151 | + for (i = 0 ; i < le16_to_cpu(bucket->bu_xh->xh_count); i++) { | |
152 | + struct ocfs2_xattr_entry *entry = &bucket->bu_xh->xh_entries[i]; | |
153 | type = ocfs2_xattr_get_type(entry); | |
154 | prefix = ocfs2_xattr_prefix(type); | |
155 | ||
156 | if (prefix) { | |
157 | ret = ocfs2_xattr_bucket_get_name_value(inode, | |
158 | - bucket->xh, | |
159 | + bucket->bu_xh, | |
160 | i, | |
161 | &block_off, | |
162 | &new_offset); | |
163 | if (ret) | |
164 | break; | |
165 | ||
166 | - name = (const char *)bucket->bhs[block_off]->b_data + | |
167 | + name = (const char *)bucket->bu_bhs[block_off]->b_data + | |
168 | new_offset; | |
169 | ret = ocfs2_xattr_list_entry(xl->buffer, | |
170 | xl->buffer_size, | |
171 | @@ -2626,10 +2626,10 @@ static int ocfs2_xattr_update_xattr_search(struct inode *inode, | |
172 | int i, blocksize = inode->i_sb->s_blocksize; | |
173 | u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb); | |
174 | ||
175 | - xs->bucket.bhs[0] = new_bh; | |
176 | + xs->bucket.bu_bhs[0] = new_bh; | |
177 | get_bh(new_bh); | |
178 | - xs->bucket.xh = (struct ocfs2_xattr_header *)xs->bucket.bhs[0]->b_data; | |
179 | - xs->header = xs->bucket.xh; | |
180 | + xs->bucket.bu_xh = (struct ocfs2_xattr_header *)xs->bucket.bu_bhs[0]->b_data; | |
181 | + xs->header = xs->bucket.bu_xh; | |
182 | ||
183 | xs->base = new_bh->b_data; | |
184 | xs->end = xs->base + inode->i_sb->s_blocksize; | |
185 | @@ -2637,8 +2637,8 @@ static int ocfs2_xattr_update_xattr_search(struct inode *inode, | |
186 | if (!xs->not_found) { | |
187 | if (OCFS2_XATTR_BUCKET_SIZE != blocksize) { | |
188 | ret = ocfs2_read_blocks(inode, | |
189 | - xs->bucket.bhs[0]->b_blocknr + 1, | |
190 | - blk_per_bucket - 1, &xs->bucket.bhs[1], | |
191 | + xs->bucket.bu_bhs[0]->b_blocknr + 1, | |
192 | + blk_per_bucket - 1, &xs->bucket.bu_bhs[1], | |
193 | 0); | |
194 | if (ret) { | |
195 | mlog_errno(ret); | |
196 | @@ -2835,7 +2835,7 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode, | |
197 | size_t end, offset, len, value_len; | |
198 | struct ocfs2_xattr_header *xh; | |
199 | char *entries, *buf, *bucket_buf = NULL; | |
200 | - u64 blkno = bucket->bhs[0]->b_blocknr; | |
201 | + u64 blkno = bucket->bu_bhs[0]->b_blocknr; | |
202 | u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb); | |
203 | u16 xh_free_start; | |
204 | size_t blocksize = inode->i_sb->s_blocksize; | |
205 | @@ -3929,7 +3929,7 @@ static inline char *ocfs2_xattr_bucket_get_val(struct inode *inode, | |
206 | int block_off = offs >> inode->i_sb->s_blocksize_bits; | |
207 | ||
208 | offs = offs % inode->i_sb->s_blocksize; | |
209 | - return bucket->bhs[block_off]->b_data + offs; | |
210 | + return bucket->bu_bhs[block_off]->b_data + offs; | |
211 | } | |
212 | ||
213 | /* | |
214 | @@ -4124,12 +4124,12 @@ static int ocfs2_xattr_set_entry_in_bucket(struct inode *inode, | |
215 | ||
216 | mlog(0, "Set xattr entry len = %lu index = %d in bucket %llu\n", | |
217 | (unsigned long)xi->value_len, xi->name_index, | |
218 | - (unsigned long long)xs->bucket.bhs[0]->b_blocknr); | |
219 | + (unsigned long long)xs->bucket.bu_bhs[0]->b_blocknr); | |
220 | ||
221 | - if (!xs->bucket.bhs[1]) { | |
222 | + if (!xs->bucket.bu_bhs[1]) { | |
223 | ret = ocfs2_read_blocks(inode, | |
224 | - xs->bucket.bhs[0]->b_blocknr + 1, | |
225 | - blk_per_bucket - 1, &xs->bucket.bhs[1], | |
226 | + xs->bucket.bu_bhs[0]->b_blocknr + 1, | |
227 | + blk_per_bucket - 1, &xs->bucket.bu_bhs[1], | |
228 | 0); | |
229 | if (ret) { | |
230 | mlog_errno(ret); | |
231 | @@ -4146,7 +4146,7 @@ static int ocfs2_xattr_set_entry_in_bucket(struct inode *inode, | |
232 | } | |
233 | ||
234 | for (i = 0; i < blk_per_bucket; i++) { | |
235 | - ret = ocfs2_journal_access(handle, inode, xs->bucket.bhs[i], | |
236 | + ret = ocfs2_journal_access(handle, inode, xs->bucket.bu_bhs[i], | |
237 | OCFS2_JOURNAL_ACCESS_WRITE); | |
238 | if (ret < 0) { | |
239 | mlog_errno(ret); | |
240 | @@ -4158,7 +4158,7 @@ static int ocfs2_xattr_set_entry_in_bucket(struct inode *inode, | |
241 | ||
242 | /*Only dirty the blocks we have touched in set xattr. */ | |
243 | ret = ocfs2_xattr_bucket_handle_journal(inode, handle, xs, | |
244 | - xs->bucket.bhs, blk_per_bucket); | |
245 | + xs->bucket.bu_bhs, blk_per_bucket); | |
246 | if (ret) | |
247 | mlog_errno(ret); | |
248 | out: | |
249 | @@ -4272,10 +4272,10 @@ static int ocfs2_xattr_bucket_value_truncate_xs(struct inode *inode, | |
250 | struct ocfs2_xattr_entry *xe = xs->here; | |
251 | struct ocfs2_xattr_header *xh = (struct ocfs2_xattr_header *)xs->base; | |
252 | ||
253 | - BUG_ON(!xs->bucket.bhs[0] || !xe || ocfs2_xattr_is_local(xe)); | |
254 | + BUG_ON(!xs->bucket.bu_bhs[0] || !xe || ocfs2_xattr_is_local(xe)); | |
255 | ||
256 | offset = xe - xh->xh_entries; | |
257 | - ret = ocfs2_xattr_bucket_value_truncate(inode, xs->bucket.bhs[0], | |
258 | + ret = ocfs2_xattr_bucket_value_truncate(inode, xs->bucket.bu_bhs[0], | |
259 | offset, len); | |
260 | if (ret) | |
261 | mlog_errno(ret); | |
262 | @@ -4395,7 +4395,7 @@ static void ocfs2_xattr_bucket_remove_xs(struct inode *inode, | |
263 | struct ocfs2_xattr_search *xs) | |
264 | { | |
265 | handle_t *handle = NULL; | |
266 | - struct ocfs2_xattr_header *xh = xs->bucket.xh; | |
267 | + struct ocfs2_xattr_header *xh = xs->bucket.bu_xh; | |
268 | struct ocfs2_xattr_entry *last = &xh->xh_entries[ | |
269 | le16_to_cpu(xh->xh_count) - 1]; | |
270 | int ret = 0; | |
271 | @@ -4407,7 +4407,7 @@ static void ocfs2_xattr_bucket_remove_xs(struct inode *inode, | |
272 | return; | |
273 | } | |
274 | ||
275 | - ret = ocfs2_journal_access(handle, inode, xs->bucket.bhs[0], | |
276 | + ret = ocfs2_journal_access(handle, inode, xs->bucket.bu_bhs[0], | |
277 | OCFS2_JOURNAL_ACCESS_WRITE); | |
278 | if (ret) { | |
279 | mlog_errno(ret); | |
280 | @@ -4420,7 +4420,7 @@ static void ocfs2_xattr_bucket_remove_xs(struct inode *inode, | |
281 | memset(last, 0, sizeof(struct ocfs2_xattr_entry)); | |
282 | le16_add_cpu(&xh->xh_count, -1); | |
283 | ||
284 | - ret = ocfs2_journal_dirty(handle, xs->bucket.bhs[0]); | |
285 | + ret = ocfs2_journal_dirty(handle, xs->bucket.bu_bhs[0]); | |
286 | if (ret < 0) | |
287 | mlog_errno(ret); | |
288 | out_commit: | |
289 | @@ -4530,7 +4530,7 @@ static int ocfs2_check_xattr_bucket_collision(struct inode *inode, | |
290 | struct ocfs2_xattr_bucket *bucket, | |
291 | const char *name) | |
292 | { | |
293 | - struct ocfs2_xattr_header *xh = bucket->xh; | |
294 | + struct ocfs2_xattr_header *xh = bucket->bu_xh; | |
295 | u32 name_hash = ocfs2_xattr_name_hash(inode, name, strlen(name)); | |
296 | ||
297 | if (name_hash != le32_to_cpu(xh->xh_entries[0].xe_name_hash)) | |
298 | @@ -4540,7 +4540,7 @@ static int ocfs2_check_xattr_bucket_collision(struct inode *inode, | |
299 | xh->xh_entries[0].xe_name_hash) { | |
300 | mlog(ML_ERROR, "Too much hash collision in xattr bucket %llu, " | |
301 | "hash = %u\n", | |
302 | - (unsigned long long)bucket->bhs[0]->b_blocknr, | |
303 | + (unsigned long long)bucket->bu_bhs[0]->b_blocknr, | |
304 | le32_to_cpu(xh->xh_entries[0].xe_name_hash)); | |
305 | return -ENOSPC; | |
306 | } | |
307 | @@ -4574,7 +4574,7 @@ try_again: | |
308 | ||
309 | mlog_bug_on_msg(header_size > blocksize, "bucket %llu has header size " | |
310 | "of %u which exceed block size\n", | |
311 | - (unsigned long long)xs->bucket.bhs[0]->b_blocknr, | |
312 | + (unsigned long long)xs->bucket.bu_bhs[0]->b_blocknr, | |
313 | header_size); | |
314 | ||
315 | if (xi->value && xi->value_len > OCFS2_XATTR_INLINE_SIZE) | |
316 | @@ -4614,7 +4614,7 @@ try_again: | |
317 | mlog(0, "xs->not_found = %d, in xattr bucket %llu: free = %d, " | |
318 | "need = %d, max_free = %d, xh_free_start = %u, xh_name_value_len =" | |
319 | " %u\n", xs->not_found, | |
320 | - (unsigned long long)xs->bucket.bhs[0]->b_blocknr, | |
321 | + (unsigned long long)xs->bucket.bu_bhs[0]->b_blocknr, | |
322 | free, need, max_free, le16_to_cpu(xh->xh_free_start), | |
323 | le16_to_cpu(xh->xh_name_value_len)); | |
324 | ||
325 | @@ -4667,14 +4667,14 @@ try_again: | |
326 | ||
327 | ret = ocfs2_add_new_xattr_bucket(inode, | |
328 | xs->xattr_bh, | |
329 | - xs->bucket.bhs[0]); | |
330 | + xs->bucket.bu_bhs[0]); | |
331 | if (ret) { | |
332 | mlog_errno(ret); | |
333 | goto out; | |
334 | } | |
335 | ||
336 | for (i = 0; i < blk_per_bucket; i++) | |
337 | - brelse(xs->bucket.bhs[i]); | |
338 | + brelse(xs->bucket.bu_bhs[i]); | |
339 | ||
340 | memset(&xs->bucket, 0, sizeof(xs->bucket)); | |
341 | ||
342 | @@ -4700,7 +4700,7 @@ static int ocfs2_delete_xattr_in_bucket(struct inode *inode, | |
343 | void *para) | |
344 | { | |
345 | int ret = 0; | |
346 | - struct ocfs2_xattr_header *xh = bucket->xh; | |
347 | + struct ocfs2_xattr_header *xh = bucket->bu_xh; | |
348 | u16 i; | |
349 | struct ocfs2_xattr_entry *xe; | |
350 | ||
351 | @@ -4710,7 +4710,7 @@ static int ocfs2_delete_xattr_in_bucket(struct inode *inode, | |
352 | continue; | |
353 | ||
354 | ret = ocfs2_xattr_bucket_value_truncate(inode, | |
355 | - bucket->bhs[0], | |
356 | + bucket->bu_bhs[0], | |
357 | i, 0); | |
358 | if (ret) { | |
359 | mlog_errno(ret); | |
360 | -- | |
361 | 1.5.6 | |
362 |