gfs2-utils: master - gfs2_edit savemeta doesn't save all leaf blocks for large dirs

Bob Peterson rpeterso at fedoraproject.org
Wed Feb 23 13:28:26 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=4a727917ff403b6f386c992d1e071e3f1a795893
Commit:        4a727917ff403b6f386c992d1e071e3f1a795893
Parent:        4e79f08f455038bdfb962f941676b7d5d8c21ef8
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Wed Feb 23 07:13:31 2011 -0600
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Wed Feb 23 07:13:31 2011 -0600

gfs2_edit savemeta doesn't save all leaf blocks for large dirs

This patch changes the gfs2_edit "savemeta" option so that it
processes exhash directories the same way that fsck.gfs2 does,
namely, it does a read of the hash table and saves all the
leaf blocks from that.  Before it was trying to traverse the
blocks, but that only works for medium-size exhash directories.

rhbz#679565
---
 gfs2/edit/savemeta.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 666a452..844da8c 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -398,10 +398,21 @@ static void save_inode_data(int out_fd)
 		}
 	}
 	/* Process directory exhash inodes */
-	if (S_ISDIR(inode->i_di.di_mode)) {
-		if (inode->i_di.di_flags & GFS2_DIF_EXHASH) {
-			save_indirect_blocks(out_fd, cur_list, metabh,
-					     height, 0);
+	if (S_ISDIR(inode->i_di.di_mode) &&
+	    inode->i_di.di_flags & GFS2_DIF_EXHASH) {
+		uint64_t  leaf_no, old_leaf = -1;
+		int li;
+
+		for (li = 0; li < (1 << inode->i_di.di_depth); li++) {
+			gfs2_get_leaf_nr(inode, li, &leaf_no);
+			if (leaf_no == old_leaf ||
+			    gfs2_check_range(&sbd, leaf_no) != 0)
+				continue;
+			old_leaf = leaf_no;
+			mybh = bread(&sbd, leaf_no);
+			if (gfs2_check_meta(mybh, GFS2_METATYPE_LF) == 0)
+				save_block(sbd.device_fd, out_fd, leaf_no);
+			brelse(mybh);
 		}
 	}
 	if (inode->i_di.di_eattr) { /* if this inode has extended attributes */


More information about the cluster-commits mailing list