Slab defragmentation: Support inode defragmentation for xfs Add slab defrag support. Signed-off-by: Christoph Lameter --- fs/xfs/linux-2.6/kmem.h | 7 +------ fs/xfs/linux-2.6/xfs_super.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 7 deletions(-) Index: linux-2.6.23-rc1/fs/xfs/linux-2.6/kmem.h =================================================================== --- linux-2.6.23-rc1.orig/fs/xfs/linux-2.6/kmem.h 2007-07-28 00:30:57.000000000 -0700 +++ linux-2.6.23-rc1/fs/xfs/linux-2.6/kmem.h 2007-07-28 00:32:16.000000000 -0700 @@ -79,13 +79,8 @@ kmem_zone_init(int size, char *zone_name static inline kmem_zone_t * kmem_zone_init_flags(int size, char *zone_name, unsigned long flags, - void (*construct)(void *, kmem_zone_t *, unsigned long)) + const struct kmem_cache_ops *ops) { - struct kmem_cache_ops *ops = - kmalloc(sizeof(struct kmem_cache_ops), GFP_KERNEL); - if (!ops) - return NULL; - return kmem_cache_create(zone_name, size, 0, flags, ops); } Index: linux-2.6.23-rc1/fs/xfs/linux-2.6/xfs_super.c =================================================================== --- linux-2.6.23-rc1.orig/fs/xfs/linux-2.6/xfs_super.c 2007-07-28 00:30:39.000000000 -0700 +++ linux-2.6.23-rc1/fs/xfs/linux-2.6/xfs_super.c 2007-07-28 00:31:50.000000000 -0700 @@ -363,13 +363,24 @@ xfs_fs_inode_init_once( inode_init_once(vn_to_inode((bhv_vnode_t *)vnode)); } +static void *xfs_get_inodes(struct kmem_cache *s, int nr, void **v) +{ + return fs_get_inodes(s, nr, v, offsetof(bhv_vnode_t, v_inode)); +}; + +static struct kmem_cache_ops xfs_kmem_cache_ops = { + .ctor = xfs_fs_inode_init_once, + .get = xfs_get_inodes, + .kick = kick_inodes +}; + STATIC int xfs_init_zones(void) { xfs_vnode_zone = kmem_zone_init_flags(sizeof(bhv_vnode_t), "xfs_vnode", KM_ZONE_HWALIGN | KM_ZONE_RECLAIM | KM_ZONE_SPREAD, - xfs_fs_inode_init_once); + &xfs_kmem_cache_ops); if (!xfs_vnode_zone) goto out;