summaryrefslogtreecommitdiffstats
path: root/fs/ext2/xattr.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-02-22 22:35:22 -0500
committerTheodore Ts'o <tytso@mit.edu>2016-02-22 22:35:22 -0500
commit7a2508e1b657cfc7e1371550f88c7a7bc4288f32 (patch)
tree00ab4aa4fe9e7d471a01f4d67d70db2b8ac5caff /fs/ext2/xattr.c
parentf0c8b46238db9d51ef9ea0858259958d0c601cec (diff)
mbcache2: rename to mbcache
Since old mbcache code is gone, let's rename new code to mbcache since number 2 is now meaningless. This is just a mechanical replacement. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext2/xattr.c')
-rw-r--r--fs/ext2/xattr.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 7162b4869bc3..71d58c2d7a19 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -56,7 +56,7 @@
56#include <linux/buffer_head.h> 56#include <linux/buffer_head.h>
57#include <linux/init.h> 57#include <linux/init.h>
58#include <linux/slab.h> 58#include <linux/slab.h>
59#include <linux/mbcache2.h> 59#include <linux/mbcache.h>
60#include <linux/quotaops.h> 60#include <linux/quotaops.h>
61#include <linux/rwsem.h> 61#include <linux/rwsem.h>
62#include <linux/security.h> 62#include <linux/security.h>
@@ -90,7 +90,7 @@
90static int ext2_xattr_set2(struct inode *, struct buffer_head *, 90static int ext2_xattr_set2(struct inode *, struct buffer_head *,
91 struct ext2_xattr_header *); 91 struct ext2_xattr_header *);
92 92
93static int ext2_xattr_cache_insert(struct mb2_cache *, struct buffer_head *); 93static int ext2_xattr_cache_insert(struct mb_cache *, struct buffer_head *);
94static struct buffer_head *ext2_xattr_cache_find(struct inode *, 94static struct buffer_head *ext2_xattr_cache_find(struct inode *,
95 struct ext2_xattr_header *); 95 struct ext2_xattr_header *);
96static void ext2_xattr_rehash(struct ext2_xattr_header *, 96static void ext2_xattr_rehash(struct ext2_xattr_header *,
@@ -150,7 +150,7 @@ ext2_xattr_get(struct inode *inode, int name_index, const char *name,
150 size_t name_len, size; 150 size_t name_len, size;
151 char *end; 151 char *end;
152 int error; 152 int error;
153 struct mb2_cache *ext2_mb_cache = EXT2_SB(inode->i_sb)->s_mb_cache; 153 struct mb_cache *ext2_mb_cache = EXT2_SB(inode->i_sb)->s_mb_cache;
154 154
155 ea_idebug(inode, "name=%d.%s, buffer=%p, buffer_size=%ld", 155 ea_idebug(inode, "name=%d.%s, buffer=%p, buffer_size=%ld",
156 name_index, name, buffer, (long)buffer_size); 156 name_index, name, buffer, (long)buffer_size);
@@ -246,7 +246,7 @@ ext2_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
246 char *end; 246 char *end;
247 size_t rest = buffer_size; 247 size_t rest = buffer_size;
248 int error; 248 int error;
249 struct mb2_cache *ext2_mb_cache = EXT2_SB(inode->i_sb)->s_mb_cache; 249 struct mb_cache *ext2_mb_cache = EXT2_SB(inode->i_sb)->s_mb_cache;
250 250
251 ea_idebug(inode, "buffer=%p, buffer_size=%ld", 251 ea_idebug(inode, "buffer=%p, buffer_size=%ld",
252 buffer, (long)buffer_size); 252 buffer, (long)buffer_size);
@@ -493,8 +493,8 @@ bad_block: ext2_error(sb, "ext2_xattr_set",
493 * This must happen under buffer lock for 493 * This must happen under buffer lock for
494 * ext2_xattr_set2() to reliably detect modified block 494 * ext2_xattr_set2() to reliably detect modified block
495 */ 495 */
496 mb2_cache_entry_delete_block(EXT2_SB(sb)->s_mb_cache, 496 mb_cache_entry_delete_block(EXT2_SB(sb)->s_mb_cache,
497 hash, bh->b_blocknr); 497 hash, bh->b_blocknr);
498 498
499 /* keep the buffer locked while modifying it. */ 499 /* keep the buffer locked while modifying it. */
500 } else { 500 } else {
@@ -627,7 +627,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
627 struct super_block *sb = inode->i_sb; 627 struct super_block *sb = inode->i_sb;
628 struct buffer_head *new_bh = NULL; 628 struct buffer_head *new_bh = NULL;
629 int error; 629 int error;
630 struct mb2_cache *ext2_mb_cache = EXT2_SB(sb)->s_mb_cache; 630 struct mb_cache *ext2_mb_cache = EXT2_SB(sb)->s_mb_cache;
631 631
632 if (header) { 632 if (header) {
633 new_bh = ext2_xattr_cache_find(inode, header); 633 new_bh = ext2_xattr_cache_find(inode, header);
@@ -721,8 +721,8 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
721 * This must happen under buffer lock for 721 * This must happen under buffer lock for
722 * ext2_xattr_set2() to reliably detect freed block 722 * ext2_xattr_set2() to reliably detect freed block
723 */ 723 */
724 mb2_cache_entry_delete_block(ext2_mb_cache, 724 mb_cache_entry_delete_block(ext2_mb_cache,
725 hash, old_bh->b_blocknr); 725 hash, old_bh->b_blocknr);
726 /* Free the old block. */ 726 /* Free the old block. */
727 ea_bdebug(old_bh, "freeing"); 727 ea_bdebug(old_bh, "freeing");
728 ext2_free_blocks(inode, old_bh->b_blocknr, 1); 728 ext2_free_blocks(inode, old_bh->b_blocknr, 1);
@@ -786,8 +786,8 @@ ext2_xattr_delete_inode(struct inode *inode)
786 * This must happen under buffer lock for ext2_xattr_set2() to 786 * This must happen under buffer lock for ext2_xattr_set2() to
787 * reliably detect freed block 787 * reliably detect freed block
788 */ 788 */
789 mb2_cache_entry_delete_block(EXT2_SB(inode->i_sb)->s_mb_cache, 789 mb_cache_entry_delete_block(EXT2_SB(inode->i_sb)->s_mb_cache,
790 hash, bh->b_blocknr); 790 hash, bh->b_blocknr);
791 ext2_free_blocks(inode, EXT2_I(inode)->i_file_acl, 1); 791 ext2_free_blocks(inode, EXT2_I(inode)->i_file_acl, 1);
792 get_bh(bh); 792 get_bh(bh);
793 bforget(bh); 793 bforget(bh);
@@ -818,12 +818,12 @@ cleanup:
818 * Returns 0, or a negative error number on failure. 818 * Returns 0, or a negative error number on failure.
819 */ 819 */
820static int 820static int
821ext2_xattr_cache_insert(struct mb2_cache *cache, struct buffer_head *bh) 821ext2_xattr_cache_insert(struct mb_cache *cache, struct buffer_head *bh)
822{ 822{
823 __u32 hash = le32_to_cpu(HDR(bh)->h_hash); 823 __u32 hash = le32_to_cpu(HDR(bh)->h_hash);
824 int error; 824 int error;
825 825
826 error = mb2_cache_entry_create(cache, GFP_NOFS, hash, bh->b_blocknr); 826 error = mb_cache_entry_create(cache, GFP_NOFS, hash, bh->b_blocknr);
827 if (error) { 827 if (error) {
828 if (error == -EBUSY) { 828 if (error == -EBUSY) {
829 ea_bdebug(bh, "already in cache (%d cache entries)", 829 ea_bdebug(bh, "already in cache (%d cache entries)",
@@ -887,14 +887,14 @@ static struct buffer_head *
887ext2_xattr_cache_find(struct inode *inode, struct ext2_xattr_header *header) 887ext2_xattr_cache_find(struct inode *inode, struct ext2_xattr_header *header)
888{ 888{
889 __u32 hash = le32_to_cpu(header->h_hash); 889 __u32 hash = le32_to_cpu(header->h_hash);
890 struct mb2_cache_entry *ce; 890 struct mb_cache_entry *ce;
891 struct mb2_cache *ext2_mb_cache = EXT2_SB(inode->i_sb)->s_mb_cache; 891 struct mb_cache *ext2_mb_cache = EXT2_SB(inode->i_sb)->s_mb_cache;
892 892
893 if (!header->h_hash) 893 if (!header->h_hash)
894 return NULL; /* never share */ 894 return NULL; /* never share */
895 ea_idebug(inode, "looking for cached blocks [%x]", (int)hash); 895 ea_idebug(inode, "looking for cached blocks [%x]", (int)hash);
896again: 896again:
897 ce = mb2_cache_entry_find_first(ext2_mb_cache, hash); 897 ce = mb_cache_entry_find_first(ext2_mb_cache, hash);
898 while (ce) { 898 while (ce) {
899 struct buffer_head *bh; 899 struct buffer_head *bh;
900 900
@@ -915,7 +915,7 @@ again:
915 * entry is still hashed is reliable. 915 * entry is still hashed is reliable.
916 */ 916 */
917 if (hlist_bl_unhashed(&ce->e_hash_list)) { 917 if (hlist_bl_unhashed(&ce->e_hash_list)) {
918 mb2_cache_entry_put(ext2_mb_cache, ce); 918 mb_cache_entry_put(ext2_mb_cache, ce);
919 unlock_buffer(bh); 919 unlock_buffer(bh);
920 brelse(bh); 920 brelse(bh);
921 goto again; 921 goto again;
@@ -928,14 +928,14 @@ again:
928 } else if (!ext2_xattr_cmp(header, HDR(bh))) { 928 } else if (!ext2_xattr_cmp(header, HDR(bh))) {
929 ea_bdebug(bh, "b_count=%d", 929 ea_bdebug(bh, "b_count=%d",
930 atomic_read(&(bh->b_count))); 930 atomic_read(&(bh->b_count)));
931 mb2_cache_entry_touch(ext2_mb_cache, ce); 931 mb_cache_entry_touch(ext2_mb_cache, ce);
932 mb2_cache_entry_put(ext2_mb_cache, ce); 932 mb_cache_entry_put(ext2_mb_cache, ce);
933 return bh; 933 return bh;
934 } 934 }
935 unlock_buffer(bh); 935 unlock_buffer(bh);
936 brelse(bh); 936 brelse(bh);
937 } 937 }
938 ce = mb2_cache_entry_find_next(ext2_mb_cache, ce); 938 ce = mb_cache_entry_find_next(ext2_mb_cache, ce);
939 } 939 }
940 return NULL; 940 return NULL;
941} 941}
@@ -1010,13 +1010,13 @@ static void ext2_xattr_rehash(struct ext2_xattr_header *header,
1010 1010
1011#define HASH_BUCKET_BITS 10 1011#define HASH_BUCKET_BITS 10
1012 1012
1013struct mb2_cache *ext2_xattr_create_cache(void) 1013struct mb_cache *ext2_xattr_create_cache(void)
1014{ 1014{
1015 return mb2_cache_create(HASH_BUCKET_BITS); 1015 return mb_cache_create(HASH_BUCKET_BITS);
1016} 1016}
1017 1017
1018void ext2_xattr_destroy_cache(struct mb2_cache *cache) 1018void ext2_xattr_destroy_cache(struct mb_cache *cache)
1019{ 1019{
1020 if (cache) 1020 if (cache)
1021 mb2_cache_destroy(cache); 1021 mb_cache_destroy(cache);
1022} 1022}