Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 35adedb8830cf948b43b86231991124b > files > 161

gfs2-utils-0.1.62-39.el5.src.rpm

commit 7409a612d3dcca9b4e24ab32c07e2f2e6ffeb7a3
Author: Bob Peterson <rpeterso@redhat.com>
Date:   Mon Aug 8 16:44:47 2011 -0500

    fsck.gfs2: fsck.gfs2: Find and clear duplicate leaf blocks refs
    
    Duplicate references that were in leaf blocks were never found nor
    cleared.  This patch adds that capability.
    
    rhbz#877150

diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index d7232d3..8610956 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -41,6 +41,7 @@ struct dup_handler {
 	int ref_count;
 };
 
+static int check_leaf(struct gfs2_inode *ip, uint64_t block, void *private);
 static int check_metalist(struct gfs2_inode *ip, uint64_t block,
 			  struct gfs2_buffer_head **bh, int h, void *private);
 static int check_data(struct gfs2_inode *ip, uint64_t block, void *private);
@@ -66,7 +67,7 @@ static int find_dentry(struct gfs2_inode *ip, struct gfs2_dirent *de,
 
 struct metawalk_fxns find_refs = {
 	.private = NULL,
-	.check_leaf = NULL,
+	.check_leaf = check_leaf,
 	.check_metalist = check_metalist,
 	.check_data = check_data,
 	.check_eattr_indir = check_eattr_indir,
@@ -88,6 +89,11 @@ struct metawalk_fxns find_dirents = {
 	.check_eattr_extentry = NULL,
 };
 
+static int check_leaf(struct gfs2_inode *ip, uint64_t block, void *private)
+{
+	return add_duplicate_ref(ip, block, ref_as_meta, 1, INODE_VALID);
+}
+
 static int check_metalist(struct gfs2_inode *ip, uint64_t block,
 			  struct gfs2_buffer_head **bh, int h, void *private)
 {
@@ -266,6 +272,11 @@ static int clear_dup_data(struct gfs2_inode *ip, uint64_t block, void *private)
 	return clear_dup_metalist(ip, block, NULL, 0, private);
 }
 
+static int clear_leaf(struct gfs2_inode *ip, uint64_t block, void *private)
+{
+	return clear_dup_metalist(ip, block, NULL, 0, private);
+}
+
 static int clear_dup_eattr_indir(struct gfs2_inode *ip, uint64_t block,
 				 uint64_t parent, struct gfs2_buffer_head **bh,
 				 void *private)
@@ -408,7 +419,7 @@ static int clear_a_reference(struct gfs2_sbd *sdp, struct duptree *b,
 	osi_list_t *tmp, *x;
 	struct metawalk_fxns clear_dup_fxns = {
 		.private = NULL,
-		.check_leaf = NULL,
+		.check_leaf = clear_leaf,
 		.check_metalist = clear_dup_metalist,
 		.check_data = clear_dup_data,
 		.check_eattr_indir = clear_dup_eattr_indir,