procfs: inode defragmentation support Hmmm... Do we really need this? Signed-off-by: Christoph Lameter --- fs/proc/inode.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) Index: slub/fs/proc/inode.c =================================================================== --- slub.orig/fs/proc/inode.c 2007-05-19 19:28:47.000000000 -0700 +++ slub/fs/proc/inode.c 2007-05-19 19:57:45.000000000 -0700 @@ -111,14 +111,25 @@ static void init_once(void * foo, struct inode_init_once(&ei->vfs_inode); } - + +static void *proc_get_inodes(struct kmem_cache *s, int nr, void **v) +{ + return fs_get_inodes(s, nr, v, + offsetof(struct proc_inode, vfs_inode)); +}; + +static struct kmem_cache_ops proc_kmem_cache_ops = { + .get = proc_get_inodes, + .kick = kick_inodes +}; + int __init proc_init_inodecache(void) { proc_inode_cachep = kmem_cache_create("proc_inode_cache", sizeof(struct proc_inode), 0, (SLAB_RECLAIM_ACCOUNT| SLAB_MEM_SPREAD), - init_once, NULL); + init_once, &proc_kmem_cache_ops); if (proc_inode_cachep == NULL) return -ENOMEM; return 0; @@ -130,12 +141,19 @@ static int proc_remount(struct super_blo return 0; } +static void proc_shrink_inodes(int nr_freed) +{ + if (nr_freed > 5) + kmem_cache_shrink(proc_inode_cachep); +} + static const struct super_operations proc_sops = { .alloc_inode = proc_alloc_inode, .destroy_inode = proc_destroy_inode, .read_inode = proc_read_inode, .drop_inode = generic_delete_inode, .delete_inode = proc_delete_inode, + .shrink_inodes = proc_shrink_inodes, .statfs = simple_statfs, .remount_fs = proc_remount, };