diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2009-12-08 07:12:13 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2010-03-01 09:07:37 -0500 |
commit | 009d851837ab26cab18adda6169a813f70b0b21b (patch) | |
tree | 073bc05e3a8c527bf9ce3332e2c2f6694484984d /fs/gfs2/meta_io.c | |
parent | 30ff056c42c665b9ea535d8515890857ae382540 (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/meta_io.c')
-rw-r--r-- | fs/gfs2/meta_io.c | 46 |
1 files changed, 6 insertions, 40 deletions
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index 6f68a5f18eb8..0bb12c80937a 100644 --- a/fs/gfs2/meta_io.c +++ b/fs/gfs2/meta_io.c | |||
@@ -93,49 +93,13 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb | |||
93 | return err; | 93 | return err; |
94 | } | 94 | } |
95 | 95 | ||
96 | static const struct address_space_operations aspace_aops = { | 96 | const struct address_space_operations gfs2_meta_aops = { |
97 | .writepage = gfs2_aspace_writepage, | 97 | .writepage = gfs2_aspace_writepage, |
98 | .releasepage = gfs2_releasepage, | 98 | .releasepage = gfs2_releasepage, |
99 | .sync_page = block_sync_page, | 99 | .sync_page = block_sync_page, |
100 | }; | 100 | }; |
101 | 101 | ||
102 | /** | 102 | /** |
103 | * gfs2_aspace_get - Create and initialize a struct inode structure | ||
104 | * @sdp: the filesystem the aspace is in | ||
105 | * | ||
106 | * Right now a struct inode is just a struct inode. Maybe Linux | ||
107 | * will supply a more lightweight address space construct (that works) | ||
108 | * in the future. | ||
109 | * | ||
110 | * Make sure pages/buffers in this aspace aren't in high memory. | ||
111 | * | ||
112 | * Returns: the aspace | ||
113 | */ | ||
114 | |||
115 | struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp) | ||
116 | { | ||
117 | struct inode *aspace; | ||
118 | struct gfs2_inode *ip; | ||
119 | |||
120 | aspace = new_inode(sdp->sd_vfs); | ||
121 | if (aspace) { | ||
122 | mapping_set_gfp_mask(aspace->i_mapping, GFP_NOFS); | ||
123 | aspace->i_mapping->a_ops = &aspace_aops; | ||
124 | aspace->i_size = MAX_LFS_FILESIZE; | ||
125 | ip = GFS2_I(aspace); | ||
126 | clear_bit(GIF_USER, &ip->i_flags); | ||
127 | insert_inode_hash(aspace); | ||
128 | } | ||
129 | return aspace; | ||
130 | } | ||
131 | |||
132 | void gfs2_aspace_put(struct inode *aspace) | ||
133 | { | ||
134 | remove_inode_hash(aspace); | ||
135 | iput(aspace); | ||
136 | } | ||
137 | |||
138 | /** | ||
139 | * gfs2_meta_sync - Sync all buffers associated with a glock | 103 | * gfs2_meta_sync - Sync all buffers associated with a glock |
140 | * @gl: The glock | 104 | * @gl: The glock |
141 | * | 105 | * |
@@ -143,7 +107,7 @@ void gfs2_aspace_put(struct inode *aspace) | |||
143 | 107 | ||
144 | void gfs2_meta_sync(struct gfs2_glock *gl) | 108 | void gfs2_meta_sync(struct gfs2_glock *gl) |
145 | { | 109 | { |
146 | struct address_space *mapping = gl->gl_aspace->i_mapping; | 110 | struct address_space *mapping = gfs2_glock2aspace(gl); |
147 | int error; | 111 | int error; |
148 | 112 | ||
149 | filemap_fdatawrite(mapping); | 113 | filemap_fdatawrite(mapping); |
@@ -164,7 +128,7 @@ void gfs2_meta_sync(struct gfs2_glock *gl) | |||
164 | 128 | ||
165 | struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create) | 129 | struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create) |
166 | { | 130 | { |
167 | struct address_space *mapping = gl->gl_aspace->i_mapping; | 131 | struct address_space *mapping = gfs2_glock2aspace(gl); |
168 | struct gfs2_sbd *sdp = gl->gl_sbd; | 132 | struct gfs2_sbd *sdp = gl->gl_sbd; |
169 | struct page *page; | 133 | struct page *page; |
170 | struct buffer_head *bh; | 134 | struct buffer_head *bh; |
@@ -344,8 +308,10 @@ void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh, | |||
344 | 308 | ||
345 | void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr, int meta) | 309 | void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr, int meta) |
346 | { | 310 | { |
347 | struct gfs2_sbd *sdp = GFS2_SB(bh->b_page->mapping->host); | 311 | struct address_space *mapping = bh->b_page->mapping; |
312 | struct gfs2_sbd *sdp = gfs2_mapping2sbd(mapping); | ||
348 | struct gfs2_bufdata *bd = bh->b_private; | 313 | struct gfs2_bufdata *bd = bh->b_private; |
314 | |||
349 | if (test_clear_buffer_pinned(bh)) { | 315 | if (test_clear_buffer_pinned(bh)) { |
350 | list_del_init(&bd->bd_le.le_list); | 316 | list_del_init(&bd->bd_le.le_list); |
351 | if (meta) { | 317 | if (meta) { |