2010-01-29 20:54:47

by Christoph Lameter

[permalink] [raw]
Subject: Filesystem: Ext2 filesystem defrag

Support defragmentation for ext2 filesystem inodes

Reviewed-by: Rik van Riel <[email protected]>
Signed-off-by: Christoph Lameter <[email protected]>
Signed-off-by: Christoph Lameter <[email protected]>

---
fs/ext2/super.c | 9 +++++++++
1 file changed, 9 insertions(+)

Index: slab-2.6/fs/ext2/super.c
===================================================================
--- slab-2.6.orig/fs/ext2/super.c 2010-01-22 15:09:43.000000000 -0600
+++ slab-2.6/fs/ext2/super.c 2010-01-22 16:20:46.000000000 -0600
@@ -174,6 +174,12 @@ static void init_once(void *foo)
inode_init_once(&ei->vfs_inode);
}

+static void *ext2_get_inodes(struct kmem_cache *s, int nr, void **v)
+{
+ return fs_get_inodes(s, nr, v,
+ offsetof(struct ext2_inode_info, vfs_inode));
+}
+
static int init_inodecache(void)
{
ext2_inode_cachep = kmem_cache_create("ext2_inode_cache",
@@ -183,6 +189,9 @@ static int init_inodecache(void)
init_once);
if (ext2_inode_cachep == NULL)
return -ENOMEM;
+
+ kmem_cache_setup_defrag(ext2_inode_cachep,
+ ext2_get_inodes, kick_inodes);
return 0;
}


--