aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2008-01-28 18:20:26 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2008-03-31 05:40:07 -0400
commit6bdd9be628fa5f4dd14eb89ebddc12840d684277 (patch)
tree7a995fa251a55af6f7b185810a24a7ebb5d00a33 /fs/gfs2
parent3ad62e87cd38817361e165cf4ad496ab76e19e81 (diff)
[GFS2] Allocate gfs2_rgrpd from slab memory
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>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/main.c10
-rw-r--r--fs/gfs2/rgrp.c4
-rw-r--r--fs/gfs2/util.c1
-rw-r--r--fs/gfs2/util.h1
4 files changed, 14 insertions, 2 deletions
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c
index 9c7765c12d62..053e2ebbbd50 100644
--- a/fs/gfs2/main.c
+++ b/fs/gfs2/main.c
@@ -89,6 +89,12 @@ static int __init init_gfs2_fs(void)
89 if (!gfs2_bufdata_cachep) 89 if (!gfs2_bufdata_cachep)
90 goto fail; 90 goto fail;
91 91
92 gfs2_rgrpd_cachep = kmem_cache_create("gfs2_rgrpd",
93 sizeof(struct gfs2_rgrpd),
94 0, 0, NULL);
95 if (!gfs2_rgrpd_cachep)
96 goto fail;
97
92 error = register_filesystem(&gfs2_fs_type); 98 error = register_filesystem(&gfs2_fs_type);
93 if (error) 99 if (error)
94 goto fail; 100 goto fail;
@@ -108,6 +114,9 @@ fail_unregister:
108fail: 114fail:
109 gfs2_glock_exit(); 115 gfs2_glock_exit();
110 116
117 if (gfs2_rgrpd_cachep)
118 kmem_cache_destroy(gfs2_rgrpd_cachep);
119
111 if (gfs2_bufdata_cachep) 120 if (gfs2_bufdata_cachep)
112 kmem_cache_destroy(gfs2_bufdata_cachep); 121 kmem_cache_destroy(gfs2_bufdata_cachep);
113 122
@@ -133,6 +142,7 @@ static void __exit exit_gfs2_fs(void)
133 unregister_filesystem(&gfs2_fs_type); 142 unregister_filesystem(&gfs2_fs_type);
134 unregister_filesystem(&gfs2meta_fs_type); 143 unregister_filesystem(&gfs2meta_fs_type);
135 144
145 kmem_cache_destroy(gfs2_rgrpd_cachep);
136 kmem_cache_destroy(gfs2_bufdata_cachep); 146 kmem_cache_destroy(gfs2_bufdata_cachep);
137 kmem_cache_destroy(gfs2_inode_cachep); 147 kmem_cache_destroy(gfs2_inode_cachep);
138 kmem_cache_destroy(gfs2_glock_cachep); 148 kmem_cache_destroy(gfs2_glock_cachep);
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 7b9d6f1d1527..dc7e83eed32d 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -353,7 +353,7 @@ static void clear_rgrpdi(struct gfs2_sbd *sdp)
353 } 353 }
354 354
355 kfree(rgd->rd_bits); 355 kfree(rgd->rd_bits);
356 kfree(rgd); 356 kmem_cache_free(gfs2_rgrpd_cachep, rgd);
357 } 357 }
358} 358}
359 359
@@ -516,7 +516,7 @@ static int read_rindex_entry(struct gfs2_inode *ip,
516 return error; 516 return error;
517 } 517 }
518 518
519 rgd = kzalloc(sizeof(struct gfs2_rgrpd), GFP_NOFS); 519 rgd = kmem_cache_zalloc(gfs2_rgrpd_cachep, GFP_NOFS);
520 error = -ENOMEM; 520 error = -ENOMEM;
521 if (!rgd) 521 if (!rgd)
522 return error; 522 return error;
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
index 424a0774eda8..fe9c28ef77b0 100644
--- a/fs/gfs2/util.c
+++ b/fs/gfs2/util.c
@@ -25,6 +25,7 @@
25struct kmem_cache *gfs2_glock_cachep __read_mostly; 25struct kmem_cache *gfs2_glock_cachep __read_mostly;
26struct kmem_cache *gfs2_inode_cachep __read_mostly; 26struct kmem_cache *gfs2_inode_cachep __read_mostly;
27struct kmem_cache *gfs2_bufdata_cachep __read_mostly; 27struct kmem_cache *gfs2_bufdata_cachep __read_mostly;
28struct kmem_cache *gfs2_rgrpd_cachep __read_mostly;
28 29
29void gfs2_assert_i(struct gfs2_sbd *sdp) 30void gfs2_assert_i(struct gfs2_sbd *sdp)
30{ 31{
diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
index 28938a46cf47..ac0c567ebc36 100644
--- a/fs/gfs2/util.h
+++ b/fs/gfs2/util.h
@@ -147,6 +147,7 @@ gfs2_io_error_bh_i((sdp), (bh), __FUNCTION__, __FILE__, __LINE__);
147extern struct kmem_cache *gfs2_glock_cachep; 147extern struct kmem_cache *gfs2_glock_cachep;
148extern struct kmem_cache *gfs2_inode_cachep; 148extern struct kmem_cache *gfs2_inode_cachep;
149extern struct kmem_cache *gfs2_bufdata_cachep; 149extern struct kmem_cache *gfs2_bufdata_cachep;
150extern struct kmem_cache *gfs2_rgrpd_cachep;
150 151
151static inline unsigned int gfs2_tune_get_i(struct gfs2_tune *gt, 152static inline unsigned int gfs2_tune_get_i(struct gfs2_tune *gt,
152 unsigned int *p) 153 unsigned int *p)