cluster: RHEL56 - fsck.gfs2: Free metadata list memory we don't need

Bob Peterson rpeterso at fedoraproject.org
Sat Apr 10 04:54:04 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=0827d8708cef94e2f063a8fd9071f468f7eeec54
Commit:        0827d8708cef94e2f063a8fd9071f468f7eeec54
Parent:        cd6e9217b85f13c85b250180cf5590526d697c61
Author:        Bob Peterson <bob at ganesha.peterson>
AuthorDate:    Mon Jan 25 14:34:16 2010 -0600
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Fri Apr 9 23:43:47 2010 -0500

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 9e87b86..6939437 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -1311,6 +1311,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)


More information about the cluster-commits mailing list