Gitweb:
http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 684770304edb7a23cc1d49a27553ba7d0035ec5a
Parent: 43632210b4fc2121005cb8ca5bbe1d10cdc97da6
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 14:39:32 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 4a6651f..4ab2603 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -1298,6 +1298,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)