[patch 12/21] Filesystem: Ext2 filesystem defrag

Christoph Lameter
2008-05-10T03:13:39Z

[-- Attachment #1: ext2-defrag --]
[-- Type: text/plain, Size: 1049 bytes --]

Support defragmentation for ext2 filesystem inodes

Reviewed-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/ext2/super.c | 9 +++++++++
1 file changed, 9 insertions(+)

Index: linux-2.6/fs/ext2/super.c
===================================================================
--- linux-2.6.orig/fs/ext2/super.c 2008-05-07 21:23:41.931409650 -0700
+++ linux-2.6/fs/ext2/super.c 2008-05-07 21:24:42.951410526 -0700
@@ -170,6 +170,12 @@ static void init_once(struct kmem_cache
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",
@@ -179,6 +185,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;
}

--