From 6ab9ae62cd07db3003fdbb269a8d332db255c86b Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Thu, 9 Aug 2007 07:51:49 -0700 Subject: [PATCH] FS: Socket inode defragmentation Support inode defragmentation for sockets Reviewed-by: Rik van Riel Signed-off-by: Christoph Lameter --- net/socket.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/net/socket.c b/net/socket.c index 9d3fbfb..205f450 100644 --- a/net/socket.c +++ b/net/socket.c @@ -269,6 +269,12 @@ static void init_once(struct kmem_cache *cachep, void *foo) inode_init_once(&ei->vfs_inode); } +static void *sock_get_inodes(struct kmem_cache *s, int nr, void **v) +{ + return fs_get_inodes(s, nr, v, + offsetof(struct socket_alloc, vfs_inode)); +} + static int init_inodecache(void) { sock_inode_cachep = kmem_cache_create("sock_inode_cache", @@ -280,6 +286,8 @@ static int init_inodecache(void) init_once); if (sock_inode_cachep == NULL) return -ENOMEM; + kmem_cache_setup_defrag(sock_inode_cachep, + sock_get_inodes, kick_inodes); return 0; } -- 1.5.4.4