aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/super.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2009-12-08 07:12:13 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2010-03-01 09:07:37 -0500
commit009d851837ab26cab18adda6169a813f70b0b21b (patch)
tree073bc05e3a8c527bf9ce3332e2c2f6694484984d /fs/gfs2/super.c
parent30ff056c42c665b9ea535d8515890857ae382540 (diff)
GFS2: Metadata address space clean up
Since the start of GFS2, an "extra" inode has been used to store the metadata belonging to each inode. The only reason for using this inode was to have an extra address space, the other fields were unused. This means that the memory usage was rather inefficient. The reason for keeping each inode's metadata in a separate address space is that when glocks are requested on remote nodes, we need to be able to efficiently locate the data and metadata which relating to that glock (inode) in order to sync or sync and invalidate it (depending on the remotely requested lock mode). This patch adds a new type of glock, which has in addition to its normal fields, has an address space. This applies to all inode and rgrp glocks (but to no other glock types which remain as before). As a result, we no longer need to have the second inode. This results in three major improvements: 1. A saving of approx 25% of memory used in caching inodes 2. A removal of the circular dependency between inodes and glocks 3. No confusion between "normal" and "metadata" inodes in super.c Although the first of these is the more immediately apparent, the second is just as important as it now enables a number of clean ups at umount time. Those will be the subject of future patches. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/super.c')
-rw-r--r--fs/gfs2/super.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index b9dd3da22c0a..ad7bc2d25ac2 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -722,8 +722,7 @@ static int gfs2_write_inode(struct inode *inode, int sync)
722 int ret = 0; 722 int ret = 0;
723 723
724 /* Check this is a "normal" inode, etc */ 724 /* Check this is a "normal" inode, etc */
725 if (!test_bit(GIF_USER, &ip->i_flags) || 725 if (current->flags & PF_MEMALLOC)
726 (current->flags & PF_MEMALLOC))
727 return 0; 726 return 0;
728 ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); 727 ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
729 if (ret) 728 if (ret)
@@ -1194,7 +1193,7 @@ static void gfs2_drop_inode(struct inode *inode)
1194{ 1193{
1195 struct gfs2_inode *ip = GFS2_I(inode); 1194 struct gfs2_inode *ip = GFS2_I(inode);
1196 1195
1197 if (test_bit(GIF_USER, &ip->i_flags) && inode->i_nlink) { 1196 if (inode->i_nlink) {
1198 struct gfs2_glock *gl = ip->i_iopen_gh.gh_gl; 1197 struct gfs2_glock *gl = ip->i_iopen_gh.gh_gl;
1199 if (gl && test_bit(GLF_DEMOTE, &gl->gl_flags)) 1198 if (gl && test_bit(GLF_DEMOTE, &gl->gl_flags))
1200 clear_nlink(inode); 1199 clear_nlink(inode);
@@ -1212,18 +1211,12 @@ static void gfs2_clear_inode(struct inode *inode)
1212{ 1211{
1213 struct gfs2_inode *ip = GFS2_I(inode); 1212 struct gfs2_inode *ip = GFS2_I(inode);
1214 1213
1215 /* This tells us its a "real" inode and not one which only 1214 ip->i_gl->gl_object = NULL;
1216 * serves to contain an address space (see rgrp.c, meta_io.c) 1215 gfs2_glock_put(ip->i_gl);
1217 * which therefore doesn't have its own glocks. 1216 ip->i_gl = NULL;
1218 */ 1217 if (ip->i_iopen_gh.gh_gl) {
1219 if (test_bit(GIF_USER, &ip->i_flags)) { 1218 ip->i_iopen_gh.gh_gl->gl_object = NULL;
1220 ip->i_gl->gl_object = NULL; 1219 gfs2_glock_dq_uninit(&ip->i_iopen_gh);
1221 gfs2_glock_put(ip->i_gl);
1222 ip->i_gl = NULL;
1223 if (ip->i_iopen_gh.gh_gl) {
1224 ip->i_iopen_gh.gh_gl->gl_object = NULL;
1225 gfs2_glock_dq_uninit(&ip->i_iopen_gh);
1226 }
1227 } 1220 }
1228} 1221}
1229 1222
@@ -1358,9 +1351,6 @@ static void gfs2_delete_inode(struct inode *inode)
1358 struct gfs2_holder gh; 1351 struct gfs2_holder gh;
1359 int error; 1352 int error;
1360 1353
1361 if (!test_bit(GIF_USER, &ip->i_flags))
1362 goto out;
1363
1364 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); 1354 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
1365 if (unlikely(error)) { 1355 if (unlikely(error)) {
1366 gfs2_glock_dq_uninit(&ip->i_iopen_gh); 1356 gfs2_glock_dq_uninit(&ip->i_iopen_gh);