add patch fix-off-by-one-fsmap-error-on-1k-block-filesystems
[ext4-patch-queue.git] / make-mb-block-cache-names-more-explicit
blob6e69c98f112cc1b46eca5a74665c386852ae9cd1
1 ext2, ext4: make mb block cache names more explicit
3 From: Tahsin Erdogan <tahsin@google.com>
5 There will be a second mb_cache instance that tracks ea_inodes. Make
6 existing names more explicit so that it is clear that they refer to
7 xattr block cache.
9 Signed-off-by: Tahsin Erdogan <tahsin@google.com>
10 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 ---
12 v2:
13  - renamed s_mb_cache to s_mb_block_cache in both ext2 and ext4
14  - renamed local variables named ext[24]_mb_cache to mb_block_cache
15  - renamed macro EXT4_GET_MB_CACHE() to MB_BLOCK_CACHE()
16  - added MB_BLOCK_CACHE() to ext2 for consistency with ext4
18  fs/ext2/ext2.h  |  2 +-
19  fs/ext2/super.c | 16 ++++++-------
20  fs/ext2/xattr.c | 36 +++++++++++++++--------------
21  fs/ext4/ext4.h  |  2 +-
22  fs/ext4/super.c | 18 +++++++--------
23  fs/ext4/xattr.c | 71 ++++++++++++++++++++++++++++++---------------------------
24  6 files changed, 75 insertions(+), 70 deletions(-)
26 diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
27 index 03f5ce1d3dbe..23ebb92484c6 100644
28 --- a/fs/ext2/ext2.h
29 +++ b/fs/ext2/ext2.h
30 @@ -113,7 +113,7 @@ struct ext2_sb_info {
31          * of the mount options.
32          */
33         spinlock_t s_lock;
34 -       struct mb_cache *s_mb_cache;
35 +       struct mb_cache *s_ea_block_cache;
36  };
38  static inline spinlock_t *
39 diff --git a/fs/ext2/super.c b/fs/ext2/super.c
40 index 9c2028b50e5c..7b1bc9059863 100644
41 --- a/fs/ext2/super.c
42 +++ b/fs/ext2/super.c
43 @@ -147,9 +147,9 @@ static void ext2_put_super (struct super_block * sb)
45         ext2_quota_off_umount(sb);
47 -       if (sbi->s_mb_cache) {
48 -               ext2_xattr_destroy_cache(sbi->s_mb_cache);
49 -               sbi->s_mb_cache = NULL;
50 +       if (sbi->s_ea_block_cache) {
51 +               ext2_xattr_destroy_cache(sbi->s_ea_block_cache);
52 +               sbi->s_ea_block_cache = NULL;
53         }
54         if (!(sb->s_flags & MS_RDONLY)) {
55                 struct ext2_super_block *es = sbi->s_es;
56 @@ -1131,9 +1131,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
57         }
59  #ifdef CONFIG_EXT2_FS_XATTR
60 -       sbi->s_mb_cache = ext2_xattr_create_cache();
61 -       if (!sbi->s_mb_cache) {
62 -               ext2_msg(sb, KERN_ERR, "Failed to create an mb_cache");
63 +       sbi->s_ea_block_cache = ext2_xattr_create_cache();
64 +       if (!sbi->s_ea_block_cache) {
65 +               ext2_msg(sb, KERN_ERR, "Failed to create ea_block_cache");
66                 goto failed_mount3;
67         }
68  #endif
69 @@ -1182,8 +1182,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
70                         sb->s_id);
71         goto failed_mount;
72  failed_mount3:
73 -       if (sbi->s_mb_cache)
74 -               ext2_xattr_destroy_cache(sbi->s_mb_cache);
75 +       if (sbi->s_ea_block_cache)
76 +               ext2_xattr_destroy_cache(sbi->s_ea_block_cache);
77         percpu_counter_destroy(&sbi->s_freeblocks_counter);
78         percpu_counter_destroy(&sbi->s_freeinodes_counter);
79         percpu_counter_destroy(&sbi->s_dirs_counter);
80 diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
81 index 1e5f76070580..1b9b1268d418 100644
82 --- a/fs/ext2/xattr.c
83 +++ b/fs/ext2/xattr.c
84 @@ -121,6 +121,8 @@ const struct xattr_handler *ext2_xattr_handlers[] = {
85         NULL
86  };
88 +#define EA_BLOCK_CACHE(inode)  (EXT2_SB(inode->i_sb)->s_ea_block_cache)
90  static inline const struct xattr_handler *
91  ext2_xattr_handler(int name_index)
92  {
93 @@ -150,7 +152,7 @@ ext2_xattr_get(struct inode *inode, int name_index, const char *name,
94         size_t name_len, size;
95         char *end;
96         int error;
97 -       struct mb_cache *ext2_mb_cache = EXT2_SB(inode->i_sb)->s_mb_cache;
98 +       struct mb_cache *ea_block_cache = EA_BLOCK_CACHE(inode);
100         ea_idebug(inode, "name=%d.%s, buffer=%p, buffer_size=%ld",
101                   name_index, name, buffer, (long)buffer_size);
102 @@ -195,7 +197,7 @@ bad_block:  ext2_error(inode->i_sb, "ext2_xattr_get",
103                         goto found;
104                 entry = next;
105         }
106 -       if (ext2_xattr_cache_insert(ext2_mb_cache, bh))
107 +       if (ext2_xattr_cache_insert(ea_block_cache, bh))
108                 ea_idebug(inode, "cache insert failed");
109         error = -ENODATA;
110         goto cleanup;
111 @@ -208,7 +210,7 @@ bad_block:  ext2_error(inode->i_sb, "ext2_xattr_get",
112             le16_to_cpu(entry->e_value_offs) + size > inode->i_sb->s_blocksize)
113                 goto bad_block;
115 -       if (ext2_xattr_cache_insert(ext2_mb_cache, bh))
116 +       if (ext2_xattr_cache_insert(ea_block_cache, bh))
117                 ea_idebug(inode, "cache insert failed");
118         if (buffer) {
119                 error = -ERANGE;
120 @@ -246,7 +248,7 @@ ext2_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
121         char *end;
122         size_t rest = buffer_size;
123         int error;
124 -       struct mb_cache *ext2_mb_cache = EXT2_SB(inode->i_sb)->s_mb_cache;
125 +       struct mb_cache *ea_block_cache = EA_BLOCK_CACHE(inode);
127         ea_idebug(inode, "buffer=%p, buffer_size=%ld",
128                   buffer, (long)buffer_size);
129 @@ -281,7 +283,7 @@ bad_block:  ext2_error(inode->i_sb, "ext2_xattr_list",
130                         goto bad_block;
131                 entry = next;
132         }
133 -       if (ext2_xattr_cache_insert(ext2_mb_cache, bh))
134 +       if (ext2_xattr_cache_insert(ea_block_cache, bh))
135                 ea_idebug(inode, "cache insert failed");
137         /* list the attribute names */
138 @@ -493,7 +495,7 @@ bad_block:          ext2_error(sb, "ext2_xattr_set",
139                          * This must happen under buffer lock for
140                          * ext2_xattr_set2() to reliably detect modified block
141                          */
142 -                       mb_cache_entry_delete(EXT2_SB(sb)->s_mb_cache, hash,
143 +                       mb_cache_entry_delete(EA_BLOCK_CACHE(inode), hash,
144                                               bh->b_blocknr);
146                         /* keep the buffer locked while modifying it. */
147 @@ -627,7 +629,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
148         struct super_block *sb = inode->i_sb;
149         struct buffer_head *new_bh = NULL;
150         int error;
151 -       struct mb_cache *ext2_mb_cache = EXT2_SB(sb)->s_mb_cache;
152 +       struct mb_cache *ea_block_cache = EA_BLOCK_CACHE(inode);
154         if (header) {
155                 new_bh = ext2_xattr_cache_find(inode, header);
156 @@ -655,7 +657,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
157                            don't need to change the reference count. */
158                         new_bh = old_bh;
159                         get_bh(new_bh);
160 -                       ext2_xattr_cache_insert(ext2_mb_cache, new_bh);
161 +                       ext2_xattr_cache_insert(ea_block_cache, new_bh);
162                 } else {
163                         /* We need to allocate a new block */
164                         ext2_fsblk_t goal = ext2_group_first_block_no(sb,
165 @@ -676,7 +678,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
166                         memcpy(new_bh->b_data, header, new_bh->b_size);
167                         set_buffer_uptodate(new_bh);
168                         unlock_buffer(new_bh);
169 -                       ext2_xattr_cache_insert(ext2_mb_cache, new_bh);
170 +                       ext2_xattr_cache_insert(ea_block_cache, new_bh);
171                         
172                         ext2_xattr_update_super_block(sb);
173                 }
174 @@ -721,7 +723,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
175                          * This must happen under buffer lock for
176                          * ext2_xattr_set2() to reliably detect freed block
177                          */
178 -                       mb_cache_entry_delete(ext2_mb_cache, hash,
179 +                       mb_cache_entry_delete(ea_block_cache, hash,
180                                               old_bh->b_blocknr);
181                         /* Free the old block. */
182                         ea_bdebug(old_bh, "freeing");
183 @@ -795,7 +797,7 @@ ext2_xattr_delete_inode(struct inode *inode)
184                  * This must happen under buffer lock for ext2_xattr_set2() to
185                  * reliably detect freed block
186                  */
187 -               mb_cache_entry_delete(EXT2_SB(inode->i_sb)->s_mb_cache, hash,
188 +               mb_cache_entry_delete(EA_BLOCK_CACHE(inode), hash,
189                                       bh->b_blocknr);
190                 ext2_free_blocks(inode, EXT2_I(inode)->i_file_acl, 1);
191                 get_bh(bh);
192 @@ -897,13 +899,13 @@ ext2_xattr_cache_find(struct inode *inode, struct ext2_xattr_header *header)
194         __u32 hash = le32_to_cpu(header->h_hash);
195         struct mb_cache_entry *ce;
196 -       struct mb_cache *ext2_mb_cache = EXT2_SB(inode->i_sb)->s_mb_cache;
197 +       struct mb_cache *ea_block_cache = EA_BLOCK_CACHE(inode);
199         if (!header->h_hash)
200                 return NULL;  /* never share */
201         ea_idebug(inode, "looking for cached blocks [%x]", (int)hash);
202  again:
203 -       ce = mb_cache_entry_find_first(ext2_mb_cache, hash);
204 +       ce = mb_cache_entry_find_first(ea_block_cache, hash);
205         while (ce) {
206                 struct buffer_head *bh;
208 @@ -924,7 +926,7 @@ ext2_xattr_cache_find(struct inode *inode, struct ext2_xattr_header *header)
209                          * entry is still hashed is reliable.
210                          */
211                         if (hlist_bl_unhashed(&ce->e_hash_list)) {
212 -                               mb_cache_entry_put(ext2_mb_cache, ce);
213 +                               mb_cache_entry_put(ea_block_cache, ce);
214                                 unlock_buffer(bh);
215                                 brelse(bh);
216                                 goto again;
217 @@ -937,14 +939,14 @@ ext2_xattr_cache_find(struct inode *inode, struct ext2_xattr_header *header)
218                         } else if (!ext2_xattr_cmp(header, HDR(bh))) {
219                                 ea_bdebug(bh, "b_count=%d",
220                                           atomic_read(&(bh->b_count)));
221 -                               mb_cache_entry_touch(ext2_mb_cache, ce);
222 -                               mb_cache_entry_put(ext2_mb_cache, ce);
223 +                               mb_cache_entry_touch(ea_block_cache, ce);
224 +                               mb_cache_entry_put(ea_block_cache, ce);
225                                 return bh;
226                         }
227                         unlock_buffer(bh);
228                         brelse(bh);
229                 }
230 -               ce = mb_cache_entry_find_next(ext2_mb_cache, ce);
231 +               ce = mb_cache_entry_find_next(ea_block_cache, ce);
232         }
233         return NULL;
235 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
236 index 580fdb753f29..e4a75c643731 100644
237 --- a/fs/ext4/ext4.h
238 +++ b/fs/ext4/ext4.h
239 @@ -1516,7 +1516,7 @@ struct ext4_sb_info {
240         struct list_head s_es_list;     /* List of inodes with reclaimable extents */
241         long s_es_nr_inode;
242         struct ext4_es_stats s_es_stats;
243 -       struct mb_cache *s_mb_cache;
244 +       struct mb_cache *s_ea_block_cache;
245         spinlock_t s_es_lock ____cacheline_aligned_in_smp;
247         /* Ratelimit ext4 messages. */
248 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
249 index b02a23ec92ca..380389740575 100644
250 --- a/fs/ext4/super.c
251 +++ b/fs/ext4/super.c
252 @@ -927,9 +927,9 @@ static void ext4_put_super(struct super_block *sb)
253                 invalidate_bdev(sbi->journal_bdev);
254                 ext4_blkdev_remove(sbi);
255         }
256 -       if (sbi->s_mb_cache) {
257 -               ext4_xattr_destroy_cache(sbi->s_mb_cache);
258 -               sbi->s_mb_cache = NULL;
259 +       if (sbi->s_ea_block_cache) {
260 +               ext4_xattr_destroy_cache(sbi->s_ea_block_cache);
261 +               sbi->s_ea_block_cache = NULL;
262         }
263         if (sbi->s_mmp_tsk)
264                 kthread_stop(sbi->s_mmp_tsk);
265 @@ -4061,9 +4061,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
266         sbi->s_journal->j_commit_callback = ext4_journal_commit_callback;
268  no_journal:
269 -       sbi->s_mb_cache = ext4_xattr_create_cache();
270 -       if (!sbi->s_mb_cache) {
271 -               ext4_msg(sb, KERN_ERR, "Failed to create an mb_cache");
272 +       sbi->s_ea_block_cache = ext4_xattr_create_cache();
273 +       if (!sbi->s_ea_block_cache) {
274 +               ext4_msg(sb, KERN_ERR, "Failed to create ea_block_cache");
275                 goto failed_mount_wq;
276         }
278 @@ -4296,9 +4296,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
279         if (EXT4_SB(sb)->rsv_conversion_wq)
280                 destroy_workqueue(EXT4_SB(sb)->rsv_conversion_wq);
281  failed_mount_wq:
282 -       if (sbi->s_mb_cache) {
283 -               ext4_xattr_destroy_cache(sbi->s_mb_cache);
284 -               sbi->s_mb_cache = NULL;
285 +       if (sbi->s_ea_block_cache) {
286 +               ext4_xattr_destroy_cache(sbi->s_ea_block_cache);
287 +               sbi->s_ea_block_cache = NULL;
288         }
289         if (sbi->s_journal) {
290                 jbd2_journal_destroy(sbi->s_journal);
291 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
292 index fb437efa8688..fd73dbc92c21 100644
293 --- a/fs/ext4/xattr.c
294 +++ b/fs/ext4/xattr.c
295 @@ -72,10 +72,11 @@
296  # define ea_bdebug(bh, fmt, ...)       no_printk(fmt, ##__VA_ARGS__)
297  #endif
299 -static void ext4_xattr_cache_insert(struct mb_cache *, struct buffer_head *);
300 -static struct buffer_head *ext4_xattr_cache_find(struct inode *,
301 -                                                struct ext4_xattr_header *,
302 -                                                struct mb_cache_entry **);
303 +static void ext4_xattr_block_cache_insert(struct mb_cache *,
304 +                                         struct buffer_head *);
305 +static struct buffer_head *
306 +ext4_xattr_block_cache_find(struct inode *, struct ext4_xattr_header *,
307 +                           struct mb_cache_entry **);
308  static void ext4_xattr_rehash(struct ext4_xattr_header *,
309                               struct ext4_xattr_entry *);
311 @@ -104,8 +105,8 @@ const struct xattr_handler *ext4_xattr_handlers[] = {
312         NULL
313  };
315 -#define EXT4_GET_MB_CACHE(inode)       (((struct ext4_sb_info *) \
316 -                               inode->i_sb->s_fs_info)->s_mb_cache)
317 +#define EA_BLOCK_CACHE(inode)  (((struct ext4_sb_info *) \
318 +                               inode->i_sb->s_fs_info)->s_ea_block_cache)
320  #ifdef CONFIG_LOCKDEP
321  void ext4_xattr_inode_set_class(struct inode *ea_inode)
322 @@ -374,7 +375,7 @@ ext4_xattr_block_get(struct inode *inode, int name_index, const char *name,
323         struct ext4_xattr_entry *entry;
324         size_t size;
325         int error;
326 -       struct mb_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode);
327 +       struct mb_cache *ea_block_cache = EA_BLOCK_CACHE(inode);
329         ea_idebug(inode, "name=%d.%s, buffer=%p, buffer_size=%ld",
330                   name_index, name, buffer, (long)buffer_size);
331 @@ -395,7 +396,7 @@ ext4_xattr_block_get(struct inode *inode, int name_index, const char *name,
332                 error = -EFSCORRUPTED;
333                 goto cleanup;
334         }
335 -       ext4_xattr_cache_insert(ext4_mb_cache, bh);
336 +       ext4_xattr_block_cache_insert(ea_block_cache, bh);
337         entry = BFIRST(bh);
338         error = ext4_xattr_find_entry(&entry, name_index, name, 1);
339         if (error)
340 @@ -541,7 +542,6 @@ ext4_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size)
341         struct inode *inode = d_inode(dentry);
342         struct buffer_head *bh = NULL;
343         int error;
344 -       struct mb_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode);
346         ea_idebug(inode, "buffer=%p, buffer_size=%ld",
347                   buffer, (long)buffer_size);
348 @@ -563,7 +563,7 @@ ext4_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size)
349                 error = -EFSCORRUPTED;
350                 goto cleanup;
351         }
352 -       ext4_xattr_cache_insert(ext4_mb_cache, bh);
353 +       ext4_xattr_block_cache_insert(EA_BLOCK_CACHE(inode), bh);
354         error = ext4_xattr_list_entries(dentry, BFIRST(bh), buffer, buffer_size);
356  cleanup:
357 @@ -660,7 +660,7 @@ static void
358  ext4_xattr_release_block(handle_t *handle, struct inode *inode,
359                          struct buffer_head *bh)
361 -       struct mb_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode);
362 +       struct mb_cache *ea_block_cache = EA_BLOCK_CACHE(inode);
363         u32 hash, ref;
364         int error = 0;
366 @@ -678,7 +678,7 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode,
367                  * This must happen under buffer lock for
368                  * ext4_xattr_block_set() to reliably detect freed block
369                  */
370 -               mb_cache_entry_delete(ext4_mb_cache, hash, bh->b_blocknr);
371 +               mb_cache_entry_delete(ea_block_cache, hash, bh->b_blocknr);
372                 get_bh(bh);
373                 unlock_buffer(bh);
374                 ext4_free_blocks(handle, inode, bh, 0, 1,
375 @@ -690,11 +690,11 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode,
376                 if (ref == EXT4_XATTR_REFCOUNT_MAX - 1) {
377                         struct mb_cache_entry *ce;
379 -                       ce = mb_cache_entry_get(ext4_mb_cache, hash,
380 +                       ce = mb_cache_entry_get(ea_block_cache, hash,
381                                                 bh->b_blocknr);
382                         if (ce) {
383                                 ce->e_reusable = 1;
384 -                               mb_cache_entry_put(ext4_mb_cache, ce);
385 +                               mb_cache_entry_put(ea_block_cache, ce);
386                         }
387                 }
389 @@ -1096,7 +1096,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
390         struct ext4_xattr_search *s = &s_copy;
391         struct mb_cache_entry *ce = NULL;
392         int error = 0;
393 -       struct mb_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode);
394 +       struct mb_cache *ea_block_cache = EA_BLOCK_CACHE(inode);
396  #define header(x) ((struct ext4_xattr_header *)(x))
398 @@ -1115,7 +1115,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
399                          * ext4_xattr_block_set() to reliably detect modified
400                          * block
401                          */
402 -                       mb_cache_entry_delete(ext4_mb_cache, hash,
403 +                       mb_cache_entry_delete(ea_block_cache, hash,
404                                               bs->bh->b_blocknr);
405                         ea_bdebug(bs->bh, "modifying in-place");
406                         error = ext4_xattr_set_entry(i, s, handle, inode);
407 @@ -1123,8 +1123,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
408                                 if (!IS_LAST_ENTRY(s->first))
409                                         ext4_xattr_rehash(header(s->base),
410                                                           s->here);
411 -                               ext4_xattr_cache_insert(ext4_mb_cache,
412 -                                       bs->bh);
413 +                               ext4_xattr_block_cache_insert(ea_block_cache,
414 +                                                             bs->bh);
415                         }
416                         ext4_xattr_block_csum_set(inode, bs->bh);
417                         unlock_buffer(bs->bh);
418 @@ -1177,7 +1177,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
420  inserted:
421         if (!IS_LAST_ENTRY(s->first)) {
422 -               new_bh = ext4_xattr_cache_find(inode, header(s->base), &ce);
423 +               new_bh = ext4_xattr_block_cache_find(inode, header(s->base),
424 +                                                    &ce);
425                 if (new_bh) {
426                         /* We found an identical block in the cache. */
427                         if (new_bh == bs->bh)
428 @@ -1222,7 +1223,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
429                                                          EXT4_C2B(EXT4_SB(sb),
430                                                                   1));
431                                         brelse(new_bh);
432 -                                       mb_cache_entry_put(ext4_mb_cache, ce);
433 +                                       mb_cache_entry_put(ea_block_cache, ce);
434                                         ce = NULL;
435                                         new_bh = NULL;
436                                         goto inserted;
437 @@ -1241,8 +1242,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
438                                 if (error)
439                                         goto cleanup_dquot;
440                         }
441 -                       mb_cache_entry_touch(ext4_mb_cache, ce);
442 -                       mb_cache_entry_put(ext4_mb_cache, ce);
443 +                       mb_cache_entry_touch(ea_block_cache, ce);
444 +                       mb_cache_entry_put(ea_block_cache, ce);
445                         ce = NULL;
446                 } else if (bs->bh && s->base == bs->bh->b_data) {
447                         /* We were modifying this block in-place. */
448 @@ -1292,7 +1293,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
449                         ext4_xattr_block_csum_set(inode, new_bh);
450                         set_buffer_uptodate(new_bh);
451                         unlock_buffer(new_bh);
452 -                       ext4_xattr_cache_insert(ext4_mb_cache, new_bh);
453 +                       ext4_xattr_block_cache_insert(ea_block_cache, new_bh);
454                         error = ext4_handle_dirty_metadata(handle, inode,
455                                                            new_bh);
456                         if (error)
457 @@ -1310,7 +1311,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
459  cleanup:
460         if (ce)
461 -               mb_cache_entry_put(ext4_mb_cache, ce);
462 +               mb_cache_entry_put(ea_block_cache, ce);
463         brelse(new_bh);
464         if (!(bs->bh && s->base == bs->bh->b_data))
465                 kfree(s->base);
466 @@ -2150,15 +2151,16 @@ void ext4_xattr_inode_array_free(struct ext4_xattr_inode_array *ea_inode_array)
469  /*
470 - * ext4_xattr_cache_insert()
471 + * ext4_xattr_block_cache_insert()
472   *
473 - * Create a new entry in the extended attribute cache, and insert
474 + * Create a new entry in the extended attribute block cache, and insert
475   * it unless such an entry is already in the cache.
476   *
477   * Returns 0, or a negative error number on failure.
478   */
479  static void
480 -ext4_xattr_cache_insert(struct mb_cache *ext4_mb_cache, struct buffer_head *bh)
481 +ext4_xattr_block_cache_insert(struct mb_cache *ea_block_cache,
482 +                             struct buffer_head *bh)
484         struct ext4_xattr_header *header = BHDR(bh);
485         __u32 hash = le32_to_cpu(header->h_hash);
486 @@ -2166,7 +2168,7 @@ ext4_xattr_cache_insert(struct mb_cache *ext4_mb_cache, struct buffer_head *bh)
487                        EXT4_XATTR_REFCOUNT_MAX;
488         int error;
490 -       error = mb_cache_entry_create(ext4_mb_cache, GFP_NOFS, hash,
491 +       error = mb_cache_entry_create(ea_block_cache, GFP_NOFS, hash,
492                                       bh->b_blocknr, reusable);
493         if (error) {
494                 if (error == -EBUSY)
495 @@ -2216,7 +2218,7 @@ ext4_xattr_cmp(struct ext4_xattr_header *header1,
498  /*
499 - * ext4_xattr_cache_find()
500 + * ext4_xattr_block_cache_find()
501   *
502   * Find an identical extended attribute block.
503   *
504 @@ -2224,17 +2226,18 @@ ext4_xattr_cmp(struct ext4_xattr_header *header1,
505   * not found or an error occurred.
506   */
507  static struct buffer_head *
508 -ext4_xattr_cache_find(struct inode *inode, struct ext4_xattr_header *header,
509 -                     struct mb_cache_entry **pce)
510 +ext4_xattr_block_cache_find(struct inode *inode,
511 +                           struct ext4_xattr_header *header,
512 +                           struct mb_cache_entry **pce)
514         __u32 hash = le32_to_cpu(header->h_hash);
515         struct mb_cache_entry *ce;
516 -       struct mb_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode);
517 +       struct mb_cache *ea_block_cache = EA_BLOCK_CACHE(inode);
519         if (!header->h_hash)
520                 return NULL;  /* never share */
521         ea_idebug(inode, "looking for cached blocks [%x]", (int)hash);
522 -       ce = mb_cache_entry_find_first(ext4_mb_cache, hash);
523 +       ce = mb_cache_entry_find_first(ea_block_cache, hash);
524         while (ce) {
525                 struct buffer_head *bh;
527 @@ -2247,7 +2250,7 @@ ext4_xattr_cache_find(struct inode *inode, struct ext4_xattr_header *header,
528                         return bh;
529                 }
530                 brelse(bh);
531 -               ce = mb_cache_entry_find_next(ext4_mb_cache, ce);
532 +               ce = mb_cache_entry_find_next(ea_block_cache, ce);
533         }
534         return NULL;
536 -- 
537 2.13.1.611.g7e3b11ae1-goog