]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[GFS2] Allocate gfs2_rgrpd from slab memory
authorBob Peterson <rpeterso@redhat.com>
Mon, 28 Jan 2008 23:20:26 +0000 (17:20 -0600)
committerSteven Whitehouse <swhiteho@redhat.com>
Mon, 31 Mar 2008 09:40:07 +0000 (10:40 +0100)
This patch moves the gfs2_rgrpd structure to its own slab
memory.  This makes it easier to control and monitor, and
yields less memory fragmentation.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/main.c
fs/gfs2/rgrp.c
fs/gfs2/util.c
fs/gfs2/util.h

index 9c7765c12d62eeac6443d853cf6bde4584019690..053e2ebbbd502f9a70ba00704ac96150be3e2ff1 100644 (file)
@@ -89,6 +89,12 @@ static int __init init_gfs2_fs(void)
        if (!gfs2_bufdata_cachep)
                goto fail;
 
+       gfs2_rgrpd_cachep = kmem_cache_create("gfs2_rgrpd",
+                                             sizeof(struct gfs2_rgrpd),
+                                             0, 0, NULL);
+       if (!gfs2_rgrpd_cachep)
+               goto fail;
+
        error = register_filesystem(&gfs2_fs_type);
        if (error)
                goto fail;
@@ -108,6 +114,9 @@ fail_unregister:
 fail:
        gfs2_glock_exit();
 
+       if (gfs2_rgrpd_cachep)
+               kmem_cache_destroy(gfs2_rgrpd_cachep);
+
        if (gfs2_bufdata_cachep)
                kmem_cache_destroy(gfs2_bufdata_cachep);
 
@@ -133,6 +142,7 @@ static void __exit exit_gfs2_fs(void)
        unregister_filesystem(&gfs2_fs_type);
        unregister_filesystem(&gfs2meta_fs_type);
 
+       kmem_cache_destroy(gfs2_rgrpd_cachep);
        kmem_cache_destroy(gfs2_bufdata_cachep);
        kmem_cache_destroy(gfs2_inode_cachep);
        kmem_cache_destroy(gfs2_glock_cachep);
index 7b9d6f1d15273c351884e5ad1d7f720b0521db99..dc7e83eed32d50a3f1e0ea92d12eab7231e59a78 100644 (file)
@@ -353,7 +353,7 @@ static void clear_rgrpdi(struct gfs2_sbd *sdp)
                }
 
                kfree(rgd->rd_bits);
-               kfree(rgd);
+               kmem_cache_free(gfs2_rgrpd_cachep, rgd);
        }
 }
 
@@ -516,7 +516,7 @@ static int read_rindex_entry(struct gfs2_inode *ip,
                return error;
        }
 
-       rgd = kzalloc(sizeof(struct gfs2_rgrpd), GFP_NOFS);
+       rgd = kmem_cache_zalloc(gfs2_rgrpd_cachep, GFP_NOFS);
        error = -ENOMEM;
        if (!rgd)
                return error;
index 424a0774eda81268b1daf3eff28ae82a636c6ad8..fe9c28ef77b059eb9620613826ff48839c5931be 100644 (file)
@@ -25,6 +25,7 @@
 struct kmem_cache *gfs2_glock_cachep __read_mostly;
 struct kmem_cache *gfs2_inode_cachep __read_mostly;
 struct kmem_cache *gfs2_bufdata_cachep __read_mostly;
+struct kmem_cache *gfs2_rgrpd_cachep __read_mostly;
 
 void gfs2_assert_i(struct gfs2_sbd *sdp)
 {
index 28938a46cf4785c63544ff4bea34aa5ef6052b32..ac0c567ebc36cb5bc362ed697f2179707502df21 100644 (file)
@@ -147,6 +147,7 @@ gfs2_io_error_bh_i((sdp), (bh), __FUNCTION__, __FILE__, __LINE__);
 extern struct kmem_cache *gfs2_glock_cachep;
 extern struct kmem_cache *gfs2_inode_cachep;
 extern struct kmem_cache *gfs2_bufdata_cachep;
+extern struct kmem_cache *gfs2_rgrpd_cachep;
 
 static inline unsigned int gfs2_tune_get_i(struct gfs2_tune *gt,
                                           unsigned int *p)