Commit 7cbc2add authored by Theodore Y. Ts'o's avatar Theodore Y. Ts'o Committed by Linus Torvalds

Port of the 0.8.50 xattr-mbcache patch to 2.5. (Shrinker API, hch cleanups)

(now uses struct block_device * to index devices, and uses hash.h for hash function)

This patch creates a meta block cache which is utilized by the ext3 and
ext2 extended attribute patch (patches 2 and 3, respectively).  This
cache allows directory blocks to be indexed by multiple keys.  In the
case of the extended attribute patches, it is used to look up blocks by
both the block number and by the hash of the extended attributes.  This
is extremely important to allow the sharing of acl's when stored as
extended attributes.  Otherwise every single file would require its own,
separate, one block overhead to store then ACL, even though there might
be a large number of files that have the same ACL.
parent 216114b9
...@@ -1406,6 +1406,12 @@ config ZISOFS_FS ...@@ -1406,6 +1406,12 @@ config ZISOFS_FS
depends on ZISOFS depends on ZISOFS
default ISO9660_FS default ISO9660_FS
# Meta block cache for Extended Attributes (ext2/ext3)
config FS_MBCACHE
tristate
depends on EXT2_FS_XATTR || EXT3_FS_XATTR
default m if EXT2_FS=m || EXT3_FS=m
default y if EXT2_FS=y || EXT3_FS=y
menu "Partition Types" menu "Partition Types"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# #
export-objs := open.o dcache.o buffer.o bio.o inode.o dquot.o mpage.o aio.o \ export-objs := open.o dcache.o buffer.o bio.o inode.o dquot.o mpage.o aio.o \
fcntl.o read_write.o dcookies.o fcblist.o fcntl.o read_write.o dcookies.o fcblist.o mbcache.o
obj-y := open.o read_write.o devices.o file_table.o buffer.o \ obj-y := open.o read_write.o devices.o file_table.o buffer.o \
bio.o super.o block_dev.o char_dev.o stat.o exec.o pipe.o \ bio.o super.o block_dev.o char_dev.o stat.o exec.o pipe.o \
...@@ -30,6 +30,8 @@ obj-y += binfmt_script.o ...@@ -30,6 +30,8 @@ obj-y += binfmt_script.o
obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o
obj-$(CONFIG_FS_MBCACHE) += mbcache.o
obj-$(CONFIG_QUOTA) += dquot.o obj-$(CONFIG_QUOTA) += dquot.o
obj-$(CONFIG_QFMT_V1) += quota_v1.o obj-$(CONFIG_QFMT_V1) += quota_v1.o
obj-$(CONFIG_QFMT_V2) += quota_v2.o obj-$(CONFIG_QFMT_V2) += quota_v2.o
......
This diff is collapsed.
/*
File: linux/mbcache.h
(C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
*/
/* Hardwire the number of additional indexes */
#define MB_CACHE_INDEXES_COUNT 1
struct mb_cache_entry;
struct mb_cache_op {
void (*free)(struct mb_cache_entry *);
};
struct mb_cache {
struct list_head c_cache_list;
const char *c_name;
struct mb_cache_op c_op;
atomic_t c_entry_count;
int c_bucket_bits;
#ifndef MB_CACHE_INDEXES_COUNT
int c_indexes_count;
#endif
kmem_cache_t *c_entry_cache;
struct list_head *c_block_hash;
struct list_head *c_indexes_hash[0];
};
struct mb_cache_entry_index {
struct list_head o_list;
unsigned int o_key;
};
struct mb_cache_entry {
struct list_head e_lru_list;
struct mb_cache *e_cache;
atomic_t e_used;
struct block_device *e_bdev;
sector_t e_block;
struct list_head e_block_list;
struct mb_cache_entry_index e_indexes[0];
};
/* Functions on caches */
struct mb_cache * mb_cache_create(const char *, struct mb_cache_op *, size_t,
int, int);
void mb_cache_shrink(struct mb_cache *, struct block_device *);
void mb_cache_destroy(struct mb_cache *);
/* Functions on cache entries */
struct mb_cache_entry *mb_cache_entry_alloc(struct mb_cache *);
int mb_cache_entry_insert(struct mb_cache_entry *, struct block_device *,
sector_t, unsigned int[]);
void mb_cache_entry_rehash(struct mb_cache_entry *, unsigned int[]);
void mb_cache_entry_release(struct mb_cache_entry *);
void mb_cache_entry_takeout(struct mb_cache_entry *);
void mb_cache_entry_free(struct mb_cache_entry *);
struct mb_cache_entry *mb_cache_entry_dup(struct mb_cache_entry *);
struct mb_cache_entry *mb_cache_entry_get(struct mb_cache *,
struct block_device *,
sector_t);
#if !defined(MB_CACHE_INDEXES_COUNT) || (MB_CACHE_INDEXES_COUNT > 0)
struct mb_cache_entry *mb_cache_entry_find_first(struct mb_cache *cache, int,
struct block_device *,
unsigned int);
struct mb_cache_entry *mb_cache_entry_find_next(struct mb_cache_entry *, int,
struct block_device *,
unsigned int);
#endif
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