Commit 7a2508e1 authored by Jan Kara's avatar Jan Kara Committed by Theodore Ts'o

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: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent f0c8b462
...@@ -41,7 +41,7 @@ obj-$(CONFIG_COMPAT_BINFMT_ELF) += compat_binfmt_elf.o ...@@ -41,7 +41,7 @@ obj-$(CONFIG_COMPAT_BINFMT_ELF) += compat_binfmt_elf.o
obj-$(CONFIG_BINFMT_ELF_FDPIC) += binfmt_elf_fdpic.o obj-$(CONFIG_BINFMT_ELF_FDPIC) += binfmt_elf_fdpic.o
obj-$(CONFIG_BINFMT_FLAT) += binfmt_flat.o obj-$(CONFIG_BINFMT_FLAT) += binfmt_flat.o
obj-$(CONFIG_FS_MBCACHE) += mbcache2.o obj-$(CONFIG_FS_MBCACHE) += mbcache.o
obj-$(CONFIG_FS_POSIX_ACL) += posix_acl.o obj-$(CONFIG_FS_POSIX_ACL) += posix_acl.o
obj-$(CONFIG_NFS_COMMON) += nfs_common/ obj-$(CONFIG_NFS_COMMON) += nfs_common/
obj-$(CONFIG_COREDUMP) += coredump.o obj-$(CONFIG_COREDUMP) += coredump.o
......
...@@ -61,7 +61,7 @@ struct ext2_block_alloc_info { ...@@ -61,7 +61,7 @@ struct ext2_block_alloc_info {
#define rsv_start rsv_window._rsv_start #define rsv_start rsv_window._rsv_start
#define rsv_end rsv_window._rsv_end #define rsv_end rsv_window._rsv_end
struct mb2_cache; struct mb_cache;
/* /*
* second extended-fs super-block data in memory * second extended-fs super-block data in memory
...@@ -113,7 +113,7 @@ struct ext2_sb_info { ...@@ -113,7 +113,7 @@ struct ext2_sb_info {
* of the mount options. * of the mount options.
*/ */
spinlock_t s_lock; spinlock_t s_lock;
struct mb2_cache *s_mb_cache; struct mb_cache *s_mb_cache;
}; };
static inline spinlock_t * static inline spinlock_t *
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/mbcache2.h> #include <linux/mbcache.h>
#include <linux/quotaops.h> #include <linux/quotaops.h>
#include <linux/rwsem.h> #include <linux/rwsem.h>
#include <linux/security.h> #include <linux/security.h>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
static int ext2_xattr_set2(struct inode *, struct buffer_head *, static int ext2_xattr_set2(struct inode *, struct buffer_head *,
struct ext2_xattr_header *); struct ext2_xattr_header *);
static int ext2_xattr_cache_insert(struct mb2_cache *, struct buffer_head *); static int ext2_xattr_cache_insert(struct mb_cache *, struct buffer_head *);
static struct buffer_head *ext2_xattr_cache_find(struct inode *, static struct buffer_head *ext2_xattr_cache_find(struct inode *,
struct ext2_xattr_header *); struct ext2_xattr_header *);
static void ext2_xattr_rehash(struct ext2_xattr_header *, static 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,7 +150,7 @@ ext2_xattr_get(struct inode *inode, int name_index, const char *name,
size_t name_len, size; size_t name_len, size;
char *end; char *end;
int error; int error;
struct mb2_cache *ext2_mb_cache = EXT2_SB(inode->i_sb)->s_mb_cache; struct mb_cache *ext2_mb_cache = EXT2_SB(inode->i_sb)->s_mb_cache;
ea_idebug(inode, "name=%d.%s, buffer=%p, buffer_size=%ld", ea_idebug(inode, "name=%d.%s, buffer=%p, buffer_size=%ld",
name_index, name, buffer, (long)buffer_size); name_index, name, buffer, (long)buffer_size);
...@@ -246,7 +246,7 @@ ext2_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size) ...@@ -246,7 +246,7 @@ ext2_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
char *end; char *end;
size_t rest = buffer_size; size_t rest = buffer_size;
int error; int error;
struct mb2_cache *ext2_mb_cache = EXT2_SB(inode->i_sb)->s_mb_cache; struct mb_cache *ext2_mb_cache = EXT2_SB(inode->i_sb)->s_mb_cache;
ea_idebug(inode, "buffer=%p, buffer_size=%ld", ea_idebug(inode, "buffer=%p, buffer_size=%ld",
buffer, (long)buffer_size); buffer, (long)buffer_size);
...@@ -493,8 +493,8 @@ bad_block: ext2_error(sb, "ext2_xattr_set", ...@@ -493,8 +493,8 @@ bad_block: ext2_error(sb, "ext2_xattr_set",
* This must happen under buffer lock for * This must happen under buffer lock for
* ext2_xattr_set2() to reliably detect modified block * ext2_xattr_set2() to reliably detect modified block
*/ */
mb2_cache_entry_delete_block(EXT2_SB(sb)->s_mb_cache, mb_cache_entry_delete_block(EXT2_SB(sb)->s_mb_cache,
hash, bh->b_blocknr); hash, bh->b_blocknr);
/* keep the buffer locked while modifying it. */ /* keep the buffer locked while modifying it. */
} else { } else {
...@@ -627,7 +627,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh, ...@@ -627,7 +627,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct buffer_head *new_bh = NULL; struct buffer_head *new_bh = NULL;
int error; int error;
struct mb2_cache *ext2_mb_cache = EXT2_SB(sb)->s_mb_cache; struct mb_cache *ext2_mb_cache = EXT2_SB(sb)->s_mb_cache;
if (header) { if (header) {
new_bh = ext2_xattr_cache_find(inode, header); new_bh = ext2_xattr_cache_find(inode, header);
...@@ -721,8 +721,8 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh, ...@@ -721,8 +721,8 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
* This must happen under buffer lock for * This must happen under buffer lock for
* ext2_xattr_set2() to reliably detect freed block * ext2_xattr_set2() to reliably detect freed block
*/ */
mb2_cache_entry_delete_block(ext2_mb_cache, mb_cache_entry_delete_block(ext2_mb_cache,
hash, old_bh->b_blocknr); hash, old_bh->b_blocknr);
/* Free the old block. */ /* Free the old block. */
ea_bdebug(old_bh, "freeing"); ea_bdebug(old_bh, "freeing");
ext2_free_blocks(inode, old_bh->b_blocknr, 1); ext2_free_blocks(inode, old_bh->b_blocknr, 1);
...@@ -786,8 +786,8 @@ ext2_xattr_delete_inode(struct inode *inode) ...@@ -786,8 +786,8 @@ ext2_xattr_delete_inode(struct inode *inode)
* This must happen under buffer lock for ext2_xattr_set2() to * This must happen under buffer lock for ext2_xattr_set2() to
* reliably detect freed block * reliably detect freed block
*/ */
mb2_cache_entry_delete_block(EXT2_SB(inode->i_sb)->s_mb_cache, mb_cache_entry_delete_block(EXT2_SB(inode->i_sb)->s_mb_cache,
hash, bh->b_blocknr); hash, bh->b_blocknr);
ext2_free_blocks(inode, EXT2_I(inode)->i_file_acl, 1); ext2_free_blocks(inode, EXT2_I(inode)->i_file_acl, 1);
get_bh(bh); get_bh(bh);
bforget(bh); bforget(bh);
...@@ -818,12 +818,12 @@ ext2_xattr_delete_inode(struct inode *inode) ...@@ -818,12 +818,12 @@ ext2_xattr_delete_inode(struct inode *inode)
* Returns 0, or a negative error number on failure. * Returns 0, or a negative error number on failure.
*/ */
static int static int
ext2_xattr_cache_insert(struct mb2_cache *cache, struct buffer_head *bh) ext2_xattr_cache_insert(struct mb_cache *cache, struct buffer_head *bh)
{ {
__u32 hash = le32_to_cpu(HDR(bh)->h_hash); __u32 hash = le32_to_cpu(HDR(bh)->h_hash);
int error; int error;
error = mb2_cache_entry_create(cache, GFP_NOFS, hash, bh->b_blocknr); error = mb_cache_entry_create(cache, GFP_NOFS, hash, bh->b_blocknr);
if (error) { if (error) {
if (error == -EBUSY) { if (error == -EBUSY) {
ea_bdebug(bh, "already in cache (%d cache entries)", ea_bdebug(bh, "already in cache (%d cache entries)",
...@@ -887,14 +887,14 @@ static struct buffer_head * ...@@ -887,14 +887,14 @@ static struct buffer_head *
ext2_xattr_cache_find(struct inode *inode, struct ext2_xattr_header *header) ext2_xattr_cache_find(struct inode *inode, struct ext2_xattr_header *header)
{ {
__u32 hash = le32_to_cpu(header->h_hash); __u32 hash = le32_to_cpu(header->h_hash);
struct mb2_cache_entry *ce; struct mb_cache_entry *ce;
struct mb2_cache *ext2_mb_cache = EXT2_SB(inode->i_sb)->s_mb_cache; struct mb_cache *ext2_mb_cache = EXT2_SB(inode->i_sb)->s_mb_cache;
if (!header->h_hash) if (!header->h_hash)
return NULL; /* never share */ return NULL; /* never share */
ea_idebug(inode, "looking for cached blocks [%x]", (int)hash); ea_idebug(inode, "looking for cached blocks [%x]", (int)hash);
again: again:
ce = mb2_cache_entry_find_first(ext2_mb_cache, hash); ce = mb_cache_entry_find_first(ext2_mb_cache, hash);
while (ce) { while (ce) {
struct buffer_head *bh; struct buffer_head *bh;
...@@ -915,7 +915,7 @@ ext2_xattr_cache_find(struct inode *inode, struct ext2_xattr_header *header) ...@@ -915,7 +915,7 @@ ext2_xattr_cache_find(struct inode *inode, struct ext2_xattr_header *header)
* entry is still hashed is reliable. * entry is still hashed is reliable.
*/ */
if (hlist_bl_unhashed(&ce->e_hash_list)) { if (hlist_bl_unhashed(&ce->e_hash_list)) {
mb2_cache_entry_put(ext2_mb_cache, ce); mb_cache_entry_put(ext2_mb_cache, ce);
unlock_buffer(bh); unlock_buffer(bh);
brelse(bh); brelse(bh);
goto again; goto again;
...@@ -928,14 +928,14 @@ ext2_xattr_cache_find(struct inode *inode, struct ext2_xattr_header *header) ...@@ -928,14 +928,14 @@ ext2_xattr_cache_find(struct inode *inode, struct ext2_xattr_header *header)
} else if (!ext2_xattr_cmp(header, HDR(bh))) { } else if (!ext2_xattr_cmp(header, HDR(bh))) {
ea_bdebug(bh, "b_count=%d", ea_bdebug(bh, "b_count=%d",
atomic_read(&(bh->b_count))); atomic_read(&(bh->b_count)));
mb2_cache_entry_touch(ext2_mb_cache, ce); mb_cache_entry_touch(ext2_mb_cache, ce);
mb2_cache_entry_put(ext2_mb_cache, ce); mb_cache_entry_put(ext2_mb_cache, ce);
return bh; return bh;
} }
unlock_buffer(bh); unlock_buffer(bh);
brelse(bh); brelse(bh);
} }
ce = mb2_cache_entry_find_next(ext2_mb_cache, ce); ce = mb_cache_entry_find_next(ext2_mb_cache, ce);
} }
return NULL; return NULL;
} }
...@@ -1010,13 +1010,13 @@ static void ext2_xattr_rehash(struct ext2_xattr_header *header, ...@@ -1010,13 +1010,13 @@ static void ext2_xattr_rehash(struct ext2_xattr_header *header,
#define HASH_BUCKET_BITS 10 #define HASH_BUCKET_BITS 10
struct mb2_cache *ext2_xattr_create_cache(void) struct mb_cache *ext2_xattr_create_cache(void)
{ {
return mb2_cache_create(HASH_BUCKET_BITS); return mb_cache_create(HASH_BUCKET_BITS);
} }
void ext2_xattr_destroy_cache(struct mb2_cache *cache) void ext2_xattr_destroy_cache(struct mb_cache *cache)
{ {
if (cache) if (cache)
mb2_cache_destroy(cache); mb_cache_destroy(cache);
} }
...@@ -53,7 +53,7 @@ struct ext2_xattr_entry { ...@@ -53,7 +53,7 @@ struct ext2_xattr_entry {
#define EXT2_XATTR_SIZE(size) \ #define EXT2_XATTR_SIZE(size) \
(((size) + EXT2_XATTR_ROUND) & ~EXT2_XATTR_ROUND) (((size) + EXT2_XATTR_ROUND) & ~EXT2_XATTR_ROUND)
struct mb2_cache; struct mb_cache;
# ifdef CONFIG_EXT2_FS_XATTR # ifdef CONFIG_EXT2_FS_XATTR
...@@ -68,8 +68,8 @@ extern int ext2_xattr_set(struct inode *, int, const char *, const void *, size_ ...@@ -68,8 +68,8 @@ extern int ext2_xattr_set(struct inode *, int, const char *, const void *, size_
extern void ext2_xattr_delete_inode(struct inode *); extern void ext2_xattr_delete_inode(struct inode *);
extern struct mb2_cache *ext2_xattr_create_cache(void); extern struct mb_cache *ext2_xattr_create_cache(void);
extern void ext2_xattr_destroy_cache(struct mb2_cache *cache); extern void ext2_xattr_destroy_cache(struct mb_cache *cache);
extern const struct xattr_handler *ext2_xattr_handlers[]; extern const struct xattr_handler *ext2_xattr_handlers[];
...@@ -94,7 +94,7 @@ ext2_xattr_delete_inode(struct inode *inode) ...@@ -94,7 +94,7 @@ ext2_xattr_delete_inode(struct inode *inode)
{ {
} }
static inline void ext2_xattr_destroy_cache(struct mb2_cache *cache) static inline void ext2_xattr_destroy_cache(struct mb_cache *cache)
{ {
} }
......
...@@ -1468,7 +1468,7 @@ struct ext4_sb_info { ...@@ -1468,7 +1468,7 @@ struct ext4_sb_info {
struct list_head s_es_list; /* List of inodes with reclaimable extents */ struct list_head s_es_list; /* List of inodes with reclaimable extents */
long s_es_nr_inode; long s_es_nr_inode;
struct ext4_es_stats s_es_stats; struct ext4_es_stats s_es_stats;
struct mb2_cache *s_mb_cache; struct mb_cache *s_mb_cache;
spinlock_t s_es_lock ____cacheline_aligned_in_smp; spinlock_t s_es_lock ____cacheline_aligned_in_smp;
/* Ratelimit ext4 messages. */ /* Ratelimit ext4 messages. */
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/mbcache2.h> #include <linux/mbcache.h>
#include <linux/quotaops.h> #include <linux/quotaops.h>
#include "ext4_jbd2.h" #include "ext4_jbd2.h"
#include "ext4.h" #include "ext4.h"
...@@ -78,10 +78,10 @@ ...@@ -78,10 +78,10 @@
# define ea_bdebug(bh, fmt, ...) no_printk(fmt, ##__VA_ARGS__) # define ea_bdebug(bh, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
#endif #endif
static void ext4_xattr_cache_insert(struct mb2_cache *, struct buffer_head *); static void ext4_xattr_cache_insert(struct mb_cache *, struct buffer_head *);
static struct buffer_head *ext4_xattr_cache_find(struct inode *, static struct buffer_head *ext4_xattr_cache_find(struct inode *,
struct ext4_xattr_header *, struct ext4_xattr_header *,
struct mb2_cache_entry **); struct mb_cache_entry **);
static void ext4_xattr_rehash(struct ext4_xattr_header *, static void ext4_xattr_rehash(struct ext4_xattr_header *,
struct ext4_xattr_entry *); struct ext4_xattr_entry *);
static int ext4_xattr_list(struct dentry *dentry, char *buffer, static int ext4_xattr_list(struct dentry *dentry, char *buffer,
...@@ -276,7 +276,7 @@ ext4_xattr_block_get(struct inode *inode, int name_index, const char *name, ...@@ -276,7 +276,7 @@ ext4_xattr_block_get(struct inode *inode, int name_index, const char *name,
struct ext4_xattr_entry *entry; struct ext4_xattr_entry *entry;
size_t size; size_t size;
int error; int error;
struct mb2_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode); struct mb_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode);
ea_idebug(inode, "name=%d.%s, buffer=%p, buffer_size=%ld", ea_idebug(inode, "name=%d.%s, buffer=%p, buffer_size=%ld",
name_index, name, buffer, (long)buffer_size); name_index, name, buffer, (long)buffer_size);
...@@ -428,7 +428,7 @@ ext4_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size) ...@@ -428,7 +428,7 @@ ext4_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size)
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
int error; int error;
struct mb2_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode); struct mb_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode);
ea_idebug(inode, "buffer=%p, buffer_size=%ld", ea_idebug(inode, "buffer=%p, buffer_size=%ld",
buffer, (long)buffer_size); buffer, (long)buffer_size);
...@@ -561,8 +561,8 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode, ...@@ -561,8 +561,8 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode,
* This must happen under buffer lock for * This must happen under buffer lock for
* ext4_xattr_block_set() to reliably detect freed block * ext4_xattr_block_set() to reliably detect freed block
*/ */
mb2_cache_entry_delete_block(EXT4_GET_MB_CACHE(inode), hash, mb_cache_entry_delete_block(EXT4_GET_MB_CACHE(inode), hash,
bh->b_blocknr); bh->b_blocknr);
get_bh(bh); get_bh(bh);
unlock_buffer(bh); unlock_buffer(bh);
ext4_free_blocks(handle, inode, bh, 0, 1, ext4_free_blocks(handle, inode, bh, 0, 1,
...@@ -782,9 +782,9 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, ...@@ -782,9 +782,9 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct buffer_head *new_bh = NULL; struct buffer_head *new_bh = NULL;
struct ext4_xattr_search *s = &bs->s; struct ext4_xattr_search *s = &bs->s;
struct mb2_cache_entry *ce = NULL; struct mb_cache_entry *ce = NULL;
int error = 0; int error = 0;
struct mb2_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode); struct mb_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode);
#define header(x) ((struct ext4_xattr_header *)(x)) #define header(x) ((struct ext4_xattr_header *)(x))
...@@ -805,8 +805,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, ...@@ -805,8 +805,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
* ext4_xattr_block_set() to reliably detect modified * ext4_xattr_block_set() to reliably detect modified
* block * block
*/ */
mb2_cache_entry_delete_block(ext4_mb_cache, hash, mb_cache_entry_delete_block(ext4_mb_cache, hash,
bs->bh->b_blocknr); bs->bh->b_blocknr);
ea_bdebug(bs->bh, "modifying in-place"); ea_bdebug(bs->bh, "modifying in-place");
error = ext4_xattr_set_entry(i, s); error = ext4_xattr_set_entry(i, s);
if (!error) { if (!error) {
...@@ -904,7 +904,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, ...@@ -904,7 +904,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
EXT4_C2B(EXT4_SB(sb), EXT4_C2B(EXT4_SB(sb),
1)); 1));
brelse(new_bh); brelse(new_bh);
mb2_cache_entry_put(ext4_mb_cache, ce); mb_cache_entry_put(ext4_mb_cache, ce);
ce = NULL; ce = NULL;
new_bh = NULL; new_bh = NULL;
goto inserted; goto inserted;
...@@ -919,8 +919,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, ...@@ -919,8 +919,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
if (error) if (error)
goto cleanup_dquot; goto cleanup_dquot;
} }
mb2_cache_entry_touch(ext4_mb_cache, ce); mb_cache_entry_touch(ext4_mb_cache, ce);
mb2_cache_entry_put(ext4_mb_cache, ce); mb_cache_entry_put(ext4_mb_cache, ce);
ce = NULL; ce = NULL;
} else if (bs->bh && s->base == bs->bh->b_data) { } else if (bs->bh && s->base == bs->bh->b_data) {
/* We were modifying this block in-place. */ /* We were modifying this block in-place. */
...@@ -985,7 +985,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, ...@@ -985,7 +985,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
cleanup: cleanup:
if (ce) if (ce)
mb2_cache_entry_put(ext4_mb_cache, ce); mb_cache_entry_put(ext4_mb_cache, ce);
brelse(new_bh); brelse(new_bh);
if (!(bs->bh && s->base == bs->bh->b_data)) if (!(bs->bh && s->base == bs->bh->b_data))
kfree(s->base); kfree(s->base);
...@@ -1546,13 +1546,13 @@ ext4_xattr_delete_inode(handle_t *handle, struct inode *inode) ...@@ -1546,13 +1546,13 @@ ext4_xattr_delete_inode(handle_t *handle, struct inode *inode)
* Returns 0, or a negative error number on failure. * Returns 0, or a negative error number on failure.
*/ */
static void static void
ext4_xattr_cache_insert(struct mb2_cache *ext4_mb_cache, struct buffer_head *bh) ext4_xattr_cache_insert(struct mb_cache *ext4_mb_cache, struct buffer_head *bh)
{ {
__u32 hash = le32_to_cpu(BHDR(bh)->h_hash); __u32 hash = le32_to_cpu(BHDR(bh)->h_hash);
int error; int error;
error = mb2_cache_entry_create(ext4_mb_cache, GFP_NOFS, hash, error = mb_cache_entry_create(ext4_mb_cache, GFP_NOFS, hash,
bh->b_blocknr); bh->b_blocknr);
if (error) { if (error) {
if (error == -EBUSY) if (error == -EBUSY)
ea_bdebug(bh, "already in cache"); ea_bdebug(bh, "already in cache");
...@@ -1610,16 +1610,16 @@ ext4_xattr_cmp(struct ext4_xattr_header *header1, ...@@ -1610,16 +1610,16 @@ ext4_xattr_cmp(struct ext4_xattr_header *header1,
*/ */
static struct buffer_head * static struct buffer_head *
ext4_xattr_cache_find(struct inode *inode, struct ext4_xattr_header *header, ext4_xattr_cache_find(struct inode *inode, struct ext4_xattr_header *header,
struct mb2_cache_entry **pce) struct mb_cache_entry **pce)
{ {
__u32 hash = le32_to_cpu(header->h_hash); __u32 hash = le32_to_cpu(header->h_hash);
struct mb2_cache_entry *ce; struct mb_cache_entry *ce;
struct mb2_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode); struct mb_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode);
if (!header->h_hash) if (!header->h_hash)
return NULL; /* never share */ return NULL; /* never share */
ea_idebug(inode, "looking for cached blocks [%x]", (int)hash); ea_idebug(inode, "looking for cached blocks [%x]", (int)hash);
ce = mb2_cache_entry_find_first(ext4_mb_cache, hash); ce = mb_cache_entry_find_first(ext4_mb_cache, hash);
while (ce) { while (ce) {
struct buffer_head *bh; struct buffer_head *bh;
...@@ -1638,7 +1638,7 @@ ext4_xattr_cache_find(struct inode *inode, struct ext4_xattr_header *header, ...@@ -1638,7 +1638,7 @@ ext4_xattr_cache_find(struct inode *inode, struct ext4_xattr_header *header,
return bh; return bh;
} }
brelse(bh); brelse(bh);
ce = mb2_cache_entry_find_next(ext4_mb_cache, ce); ce = mb_cache_entry_find_next(ext4_mb_cache, ce);
} }
return NULL; return NULL;
} }
...@@ -1713,15 +1713,15 @@ static void ext4_xattr_rehash(struct ext4_xattr_header *header, ...@@ -1713,15 +1713,15 @@ static void ext4_xattr_rehash(struct ext4_xattr_header *header,
#define HASH_BUCKET_BITS 10 #define HASH_BUCKET_BITS 10
struct mb2_cache * struct mb_cache *
ext4_xattr_create_cache(void) ext4_xattr_create_cache(void)
{ {
return mb2_cache_create(HASH_BUCKET_BITS); return mb_cache_create(HASH_BUCKET_BITS);
} }
void ext4_xattr_destroy_cache(struct mb2_cache *cache) void ext4_xattr_destroy_cache(struct mb_cache *cache)
{ {
if (cache) if (cache)
mb2_cache_destroy(cache); mb_cache_destroy(cache);
} }
...@@ -123,8 +123,8 @@ extern int ext4_xattr_ibody_inline_set(handle_t *handle, struct inode *inode, ...@@ -123,8 +123,8 @@ extern int ext4_xattr_ibody_inline_set(handle_t *handle, struct inode *inode,
struct ext4_xattr_info *i, struct ext4_xattr_info *i,
struct ext4_xattr_ibody_find *is); struct ext4_xattr_ibody_find *is);
extern struct mb2_cache *ext4_xattr_create_cache(void); extern struct mb_cache *ext4_xattr_create_cache(void);
extern void ext4_xattr_destroy_cache(struct mb2_cache *); extern void ext4_xattr_destroy_cache(struct mb_cache *);
#ifdef CONFIG_EXT4_FS_SECURITY #ifdef CONFIG_EXT4_FS_SECURITY
extern int ext4_init_security(handle_t *handle, struct inode *inode, extern int ext4_init_security(handle_t *handle, struct inode *inode,
......
This diff is collapsed.
#ifndef _LINUX_MB2CACHE_H #ifndef _LINUX_MBCACHE_H
#define _LINUX_MB2CACHE_H #define _LINUX_MBCACHE_H
#include <linux/hash.h> #include <linux/hash.h>
#include <linux/list_bl.h> #include <linux/list_bl.h>
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
#include <linux/atomic.h> #include <linux/atomic.h>
#include <linux/fs.h> #include <linux/fs.h>
struct mb2_cache; struct mb_cache;
struct mb2_cache_entry { struct mb_cache_entry {
/* List of entries in cache - protected by cache->c_list_lock */ /* List of entries in cache - protected by cache->c_list_lock */
struct list_head e_list; struct list_head e_list;
/* Hash table list - protected by bitlock in e_hash_list_head */ /* Hash table list - protected by bitlock in e_hash_list_head */
...@@ -26,28 +26,28 @@ struct mb2_cache_entry { ...@@ -26,28 +26,28 @@ struct mb2_cache_entry {
unsigned long _e_hash_list_head; unsigned long _e_hash_list_head;
}; };
struct mb2_cache *mb2_cache_create(int bucket_bits); struct mb_cache *mb_cache_create(int bucket_bits);
void mb2_cache_destroy(struct mb2_cache *cache); void mb_cache_destroy(struct mb_cache *cache);
int mb2_cache_entry_create(struct mb2_cache *cache, gfp_t mask, u32 key, int mb_cache_entry_create(struct mb_cache *cache, gfp_t mask, u32 key,
sector_t block); sector_t block);
void __mb2_cache_entry_free(struct mb2_cache_entry *entry); void __mb_cache_entry_free(struct mb_cache_entry *entry);
static inline int mb2_cache_entry_put(struct mb2_cache *cache, static inline int mb_cache_entry_put(struct mb_cache *cache,
struct mb2_cache_entry *entry) struct mb_cache_entry *entry)
{ {
if (!atomic_dec_and_test(&entry->e_refcnt)) if (!atomic_dec_and_test(&entry->e_refcnt))
return 0; return 0;
__mb2_cache_entry_free(entry); __mb_cache_entry_free(entry);
return 1; return 1;
} }
void mb2_cache_entry_delete_block(struct mb2_cache *cache, u32 key, void mb_cache_entry_delete_block(struct mb_cache *cache, u32 key,
sector_t block); sector_t block);
struct mb2_cache_entry *mb2_cache_entry_find_first(struct mb2_cache *cache, struct mb_cache_entry *mb_cache_entry_find_first(struct mb_cache *cache,
u32 key); u32 key);
struct mb2_cache_entry *mb2_cache_entry_find_next(struct mb2_cache *cache, struct mb_cache_entry *mb_cache_entry_find_next(struct mb_cache *cache,
struct mb2_cache_entry *entry); struct mb_cache_entry *entry);
void mb2_cache_entry_touch(struct mb2_cache *cache, void mb_cache_entry_touch(struct mb_cache *cache,
struct mb2_cache_entry *entry); struct mb_cache_entry *entry);
#endif /* _LINUX_MB2CACHE_H */ #endif /* _LINUX_MBCACHE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment