Gitweb:
http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 5ae8a4155e3a4d19b2e9f46367d855ca998396fb
Parent: 068146012317eb0d34488c59bd36b9218b91eb1b
Author: Bob Peterson <bob(a)ganesha.peterson>
AuthorDate: Mon Jan 25 14:34:16 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Tue Jan 26 15:09:52 2010 -0600
fsck.gfs2: Free metadata list memory we don't need
This patch modifies function check_metatree so that it frees up
metadata from memory for heights it's no longer interested in.
This patches a memory leak.
rhbz#455300
---
gfs2/fsck/metawalk.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index a7871f1..da37f61 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -1300,6 +1300,21 @@ int check_metatree(struct gfs2_inode *ip, struct metawalk_fxns
*pass)
return error;
}
+ /* Free the metalist buffers from heights we don't need to check.
+ For the rest we'll free as we check them to save time.
+ metalist[0] will only have the dinode bh, so we can skip it. */
+ for (i = 1; i < height - 1; i++) {
+ list = &metalist[i];
+ while (!osi_list_empty(list)) {
+ bh = osi_list_entry(list->next,
+ struct gfs2_buffer_head, b_altlist);
+ if (bh == ip->i_bh)
+ osi_list_del(&bh->b_altlist);
+ else
+ brelse(bh);
+ }
+ }
+
/* check data blocks */
list = &metalist[height - 1];
if (ip->i_di.di_blocks > COMFORTABLE_BLKS)