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
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.
9 Signed-off-by: Joel Becker <joel.becker@oracle.com>
10 Signed-off-by: Mark Fasheh <mfasheh@suse.com>
12 fs/ocfs2/xattr.c | 100 +++++++++++++++++++++++++++---------------------------
13 1 files changed, 50 insertions(+), 50 deletions(-)
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 {
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;
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,
32 if (le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED) {
33 ret = ocfs2_xattr_bucket_get_name_value(inode,
39 - xs->base = xs->bucket.bhs[block_off]->b_data;
40 + xs->base = xs->bucket.bu_bhs[block_off]->b_data;
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,
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));
53 @@ -2032,7 +2032,7 @@ cleanup:
56 for (i = 0; i < blk_per_bucket; i++)
57 - brelse(xbs.bucket.bhs[i]);
58 + brelse(xbs.bucket.bu_bhs[i]);
62 @@ -2276,13 +2276,13 @@ static int ocfs2_xattr_bucket_find(struct inode *inode,
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;
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;
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
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],
92 @@ -2300,7 +2300,7 @@ static int ocfs2_xattr_bucket_find(struct inode *inode,
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);
101 @@ -2370,23 +2370,23 @@ static int ocfs2_iterate_xattr_buckets(struct inode *inode,
103 for (i = 0; i < num_buckets; i++, blkno += blk_per_bucket) {
104 ret = ocfs2_read_blocks(inode, blkno, blk_per_bucket,
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;
115 * The real bucket num in this series of blocks is stored
119 - num_buckets = le16_to_cpu(bucket.xh->xh_num_buckets);
120 + num_buckets = le16_to_cpu(bucket.bu_xh->xh_num_buckets);
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));
127 ret = func(inode, &bucket, para);
129 @@ -2396,13 +2396,13 @@ static int ocfs2_iterate_xattr_buckets(struct inode *inode,
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));
139 for (j = 0; j < blk_per_bucket; j++)
140 - brelse(bucket.bhs[j]);
141 + brelse(bucket.bu_bhs[j]);
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;
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);
157 ret = ocfs2_xattr_bucket_get_name_value(inode,
166 - name = (const char *)bucket->bhs[block_off]->b_data +
167 + name = (const char *)bucket->bu_bhs[block_off]->b_data +
169 ret = ocfs2_xattr_list_entry(xl->buffer,
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);
175 - xs->bucket.bhs[0] = new_bh;
176 + xs->bucket.bu_bhs[0] = 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;
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],
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);
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;
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;
214 @@ -4124,12 +4124,12 @@ static int ocfs2_xattr_set_entry_in_bucket(struct inode *inode,
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);
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],
231 @@ -4146,7 +4146,7 @@ static int ocfs2_xattr_set_entry_in_bucket(struct inode *inode,
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);
240 @@ -4158,7 +4158,7 @@ static int ocfs2_xattr_set_entry_in_bucket(struct inode *inode,
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);
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;
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));
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],
262 @@ -4395,7 +4395,7 @@ static void ocfs2_xattr_bucket_remove_xs(struct inode *inode,
263 struct ocfs2_xattr_search *xs)
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];
271 @@ -4407,7 +4407,7 @@ static void ocfs2_xattr_bucket_remove_xs(struct inode *inode,
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);
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);
284 - ret = ocfs2_journal_dirty(handle, xs->bucket.bhs[0]);
285 + ret = ocfs2_journal_dirty(handle, xs->bucket.bu_bhs[0]);
289 @@ -4530,7 +4530,7 @@ static int ocfs2_check_xattr_bucket_collision(struct inode *inode,
290 struct ocfs2_xattr_bucket *bucket,
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));
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, "
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));
307 @@ -4574,7 +4574,7 @@ try_again:
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,
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));
325 @@ -4667,14 +4667,14 @@ try_again:
327 ret = ocfs2_add_new_xattr_bucket(inode,
329 - xs->bucket.bhs[0]);
330 + xs->bucket.bu_bhs[0]);
336 for (i = 0; i < blk_per_bucket; i++)
337 - brelse(xs->bucket.bhs[i]);
338 + brelse(xs->bucket.bu_bhs[i]);
340 memset(&xs->bucket, 0, sizeof(xs->bucket));
342 @@ -4700,7 +4700,7 @@ static int ocfs2_delete_xattr_in_bucket(struct inode *inode,
346 - struct ocfs2_xattr_header *xh = bucket->xh;
347 + struct ocfs2_xattr_header *xh = bucket->bu_xh;
349 struct ocfs2_xattr_entry *xe;
351 @@ -4710,7 +4710,7 @@ static int ocfs2_delete_xattr_in_bucket(struct inode *inode,
354 ret = ocfs2_xattr_bucket_value_truncate(inode,