[Cluster-devel] [Patch 18/44] fsck.gfs2: Find and clear duplicate references that are leaf blocks

Bob Peterson rpeterso at redhat.com
Thu Aug 11 21:06:08 UTC 2011


>From 50e59f2cd489e7b0200bb098f1c11c30977d5e28 Mon Sep 17 00:00:00 2001
From: Bob Peterson <rpeterso at redhat.com>
Date: Mon, 8 Aug 2011 16:44:47 -0500
Subject: [PATCH 18/44] fsck.gfs2: Find and clear duplicate references that
 are leaf blocks

Duplicate references that were in leaf blocks were never found nor
cleared.  This patch adds that capability.

rhbz#675723
---
 gfs2/fsck/pass1b.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index 9497c78..7c6ae3d 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -28,6 +28,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);
@@ -53,7 +54,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,
@@ -75,6 +76,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)
 {
@@ -253,6 +259,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)
@@ -395,7 +406,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,
-- 
1.7.4.4




More information about the Cluster-devel mailing list