Support inode defragmentation for sockets

Signed-off-by: Christoph Lameter <[EMAIL PROTECTED]>
---
 net/socket.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index ec07703..89fc7a5 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -264,6 +264,12 @@ static void init_once(void *foo, struct kmem_cache 
*cachep, unsigned long flags)
        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",
@@ -275,6 +281,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.2.4

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to