Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 9383e745e23602bc45f9c92184feea59 > files > 11

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

commit b486ce1bf1519f42a252a0b49ea177a1c87b4593
Author: Bob Peterson <bob@ganesha.peterson>
Date:   Wed Jan 20 09:47:30 2010 -0600

    Move duplicate code from libgfs2 to fsck.gfs2
    
    This patch removes the duplicate block management from
    libgfs2 and puts it into the only code that used it: fsck.gfs2.
    This has several advantages for performance and readability.
    Since it no longer has to worry about duplicates, the blockmap
    code in libgfs2 can do less work in places where fsck.gfs2
    doesn't care one way or another if the block is a duplicate.
    Conversely, the places in fsck.gfs2 that only care if the
    block is a duplicate are also simplified because they don't
    have to do the additional blockmap code that went along.
    This also paves the way for future code simplification.
    
    rhbz#455300

diff --git a/gfs2/fsck/eattr.c b/gfs2/fsck/eattr.c
index 68829d2..cc9fec4 100644
--- a/gfs2/fsck/eattr.c
+++ b/gfs2/fsck/eattr.c
@@ -17,17 +17,12 @@
 
 #include "libgfs2.h"
 #include "fsck.h"
+#include "eattr.h"
+#include "metawalk.h"
 
 static int clear_blk_nodup(struct gfs2_sbd *sbp, uint64_t block)
 {
-	struct gfs2_block_query q;
-
-	if(gfs2_block_check(sbp, bl, block, &q)) {
-		stack;
-		return -1;
-	}
-
-	if(q.dup_block) {
+	if(is_duplicate(block)) {
 		log_debug( _("Not clearing block with marked as a duplicate\n"));
 		return 1;
 	}
diff --git a/gfs2/fsck/fsck.h b/gfs2/fsck/fsck.h
index b46df92..37fe632 100644
--- a/gfs2/fsck/fsck.h
+++ b/gfs2/fsck/fsck.h
@@ -71,6 +71,12 @@ enum rgindex_trust_level { /* how far can we trust our RG index? */
 			  gfs2_grow or something.  Count the RGs by hand. */
 };
 
+struct dup_blks {
+	osi_list_t list;
+	uint64_t block_no;
+	osi_list_t ref_inode_list;
+};
+
 extern struct gfs2_inode *fsck_load_inode(struct gfs2_sbd *sbp, uint64_t block);
 extern struct gfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp,
 				  struct gfs2_buffer_head *bh);
@@ -105,5 +111,6 @@ extern int skip_this_pass, fsck_abort;
 extern int errors_found, errors_corrected;
 extern uint64_t last_data_block;
 extern uint64_t first_data_block;
+extern struct dup_blks dup_blocks;
 
 #endif /* _FSCK_H */
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 0c0990f..7aad96e 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -72,6 +72,19 @@ static int block_mounters(struct gfs2_sbd *sbp, int block_em)
 	return 0;
 }
 
+static void gfs2_dup_free(void)
+{
+	struct dup_blks *f;
+
+	while(!osi_list_empty(&dup_blocks.list)) {
+		f = osi_list_entry(dup_blocks.list.next, struct dup_blks,
+				   list);
+		while (!osi_list_empty(&f->ref_inode_list))
+			osi_list_del(&f->ref_inode_list);
+		osi_list_del(&f->list);
+		free(f);
+	}
+}
 
 /*
  * empty_super_block - free all structures in the super block
@@ -104,8 +117,10 @@ static void empty_super_block(struct gfs2_sbd *sdp)
 		}
 	}
 
-	if (bl)
+	if (bl) {
 		gfs2_bmap_destroy(sdp, bl);
+		gfs2_dup_free();
+	}
 }
 
 
@@ -396,6 +411,7 @@ static int init_system_inodes(struct gfs2_sbd *sdp)
 		log_crit( _("Please increase your swap space by that amount and run gfs2_fsck again.\n"));
 		goto fail;
 	}
+	osi_list_init(&dup_blocks.list);
 	return 0;
  fail:
 	empty_super_block(sdp);
diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c
index 6d19146..8d1f8e8 100644
--- a/gfs2/fsck/main.c
+++ b/gfs2/fsck/main.c
@@ -42,6 +42,7 @@ uint64_t last_data_block;
 uint64_t first_data_block;
 const char *prog_name = "gfs2_fsck"; /* needed by libgfs2 */
 int preen = 0, force_check = 0;
+struct dup_blks dup_blocks;
 
 /* This function is for libgfs2's sake.                                      */
 void print_it(const char *label, const char *fmt, const char *fmt2, ...)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index e5d33b1..38e9cc5 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -29,6 +29,20 @@
 
 #define COMFORTABLE_BLKS 5242880 /* 20GB in 4K blocks */
 
+struct dup_blks *dupfind(uint64_t num)
+{
+	osi_list_t *head = &dup_blocks.list;
+	osi_list_t *tmp;
+	struct dup_blks *b;
+
+	for (tmp = head->next; tmp != head; tmp = tmp->next) {
+		b = osi_list_entry(tmp, struct dup_blks, list);
+		if (b->block_no == num)
+			return b;
+	}
+	return NULL;
+}
+
 static struct gfs2_inode *get_system_inode(struct gfs2_sbd *sbp,
 					   uint64_t block)
 {
@@ -1196,7 +1210,7 @@ int delete_blocks(struct gfs2_inode *ip, uint64_t block,
 	if (gfs2_check_range(ip->i_sbd, block) == 0) {
 		if (gfs2_block_check(ip->i_sbd, bl, block, &q))
 			return 0;
-		if (!q.dup_block) {
+		if(!is_duplicate(block)) {
 			log_info( _("Deleting %s block %lld (0x%llx) as part "
 				    "of inode %lld (0x%llx)\n"), btype,
 				  (unsigned long long)block,
diff --git a/gfs2/fsck/metawalk.h b/gfs2/fsck/metawalk.h
index 2b83229..0744ae6 100644
--- a/gfs2/fsck/metawalk.h
+++ b/gfs2/fsck/metawalk.h
@@ -37,6 +37,9 @@ int delete_eattr_indir(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
 		       struct gfs2_buffer_head **bh, void *private);
 int delete_eattr_leaf(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
 		      struct gfs2_buffer_head **bh, void *private);
+struct dup_blks *dupfind(uint64_t num);
+
+#define is_duplicate(dblock) ((dupfind(dblock)) ? 1 : 0)
 
 /* metawalk_fxns: function pointers to check various parts of the fs
  *
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 341a10b..134476b 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -118,7 +118,7 @@ static int check_metalist(struct gfs2_inode *ip, uint64_t block,
 	if(q.block_type != gfs2_block_free) {
 		log_err( _("Found duplicate block referenced as metadata in "
 			   "indirect block - was marked %d\n"), q.block_type);
-		gfs2_block_mark(ip->i_sbd, bl, block, gfs2_dup_block);
+		gfs2_dup_set(block);
 		found_dup = 1;
 	}
 	nbh = bread(ip->i_sbd, block);
@@ -174,7 +174,7 @@ static int check_data(struct gfs2_inode *ip, uint64_t block, void *private)
 		log_err( _("Found duplicate block referenced as data at %"
 			   PRIu64 " (0x%"PRIx64 ")\n"), block, block);
 		if (q.block_type != gfs2_meta_inval) {
-			gfs2_block_mark(ip->i_sbd, bl, block, gfs2_dup_block);
+			gfs2_dup_set(block);
 			/* If the prev ref was as data, this is likely a data
 			   block, so keep the block count for both refs. */
 			if (q.block_type == gfs2_block_used)
@@ -192,11 +192,11 @@ static int check_data(struct gfs2_inode *ip, uint64_t block, void *private)
 		   marked as duplicate, but also as a data block. */
 		error = 1;
 		gfs2_block_unmark(ip->i_sbd, bl, block, gfs2_meta_inval);
-		gfs2_block_mark(ip->i_sbd, bl, block, gfs2_dup_block);
+		gfs2_dup_set(block);
 	}
 	log_debug( _("Marking block %llu (0x%llx) as data block\n"),
 		   (unsigned long long)block, (unsigned long long)block);
-	gfs2_block_mark(ip->i_sbd, bl, block, gfs2_block_used);
+	gfs2_blockmap_set(ip->i_sbd, bl, block, gfs2_block_used);
 
 	/* This is also confusing, so I'll clarify.  There are two bitmaps:
 	   (1) The gfs2_bmap that fsck uses to keep track of what block
@@ -259,12 +259,12 @@ static int ask_remove_inode_eattr(struct gfs2_inode *ip,
 	if (query( _("Clear all Extended Attributes from the "
 		     "inode? (y/n) "))) {
 		struct gfs2_block_query q;
-
 		if(gfs2_block_check(ip->i_sbd, bl, ip->i_di.di_eattr, &q)) {
 			stack;
 			return -1;
 		}
-		if (!remove_inode_eattr(ip, bc, q.dup_block))
+		if (!remove_inode_eattr(ip, bc,
+					is_duplicate(ip->i_di.di_eattr)))
 			log_err( _("Extended attributes were removed.\n"));
 		else
 			log_err( _("Unable to remove inode eattr pointer; "
@@ -347,8 +347,7 @@ static int check_eattr_indir(struct gfs2_inode *ip, uint64_t indirect,
 			if (!clear_eas(ip, bc, indirect, 1,
 				       _("Bad indirect Extended Attribute "
 					 "duplicate found"))) {
-				gfs2_block_mark(sdp, bl, indirect,
-						gfs2_dup_block);
+				gfs2_dup_set(indirect);
 				bc->ea_count++;
 			}
 			return 1;
@@ -366,7 +365,7 @@ static int check_eattr_indir(struct gfs2_inode *ip, uint64_t indirect,
 			 (unsigned long long)ip->i_di.di_num.no_addr,
 			 (unsigned long long)indirect,
 			 (unsigned long long)indirect);
-		gfs2_block_mark(sdp, bl, indirect, gfs2_dup_block);
+		gfs2_dup_set(indirect);
 		bc->ea_count++;
 		ret = 1;
 	} else {
@@ -442,7 +441,7 @@ static int check_leaf_block(struct gfs2_inode *ip, uint64_t block, int btype,
 		log_debug( _("Duplicate block found at #%lld (0x%llx).\n"),
 			   (unsigned long long)block,
 			   (unsigned long long)block);
-		gfs2_block_mark(sdp, bl, block, gfs2_dup_block);
+		gfs2_dup_set(block);
 		bc->ea_count++;
 		brelse(leaf_bh);
 		return 1;
@@ -590,7 +589,7 @@ static int clear_metalist(struct gfs2_inode *ip, uint64_t block,
 		stack;
 		return -1;
 	}
-	if(!q.dup_block) {
+	if(!is_duplicate(block)) {
 		gfs2_blockmap_set(ip->i_sbd, bl, block, gfs2_block_free);
 		return 0;
 	}
@@ -605,7 +604,7 @@ static int clear_data(struct gfs2_inode *ip, uint64_t block, void *private)
 		stack;
 		return -1;
 	}
-	if(!q.dup_block) {
+	if(!is_duplicate(block)) {
 		gfs2_blockmap_set(ip->i_sbd, bl, block, gfs2_block_free);
 		return 0;
 	}
@@ -625,7 +624,7 @@ static int clear_leaf(struct gfs2_inode *ip, uint64_t block,
 		stack;
 		return -1;
 	}
-	if(!q.dup_block) {
+	if(!is_duplicate(block)) {
 		log_crit( _("Setting leaf #%" PRIu64 " (0x%" PRIx64 ") invalid\n"),
 				 block, block);
 		if(gfs2_blockmap_set(ip->i_sbd, bl, block, gfs2_block_free)) {
@@ -706,11 +705,7 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
 	if(q.block_type != gfs2_block_free) {
 		log_err( _("Found duplicate block referenced as an inode at "
 			   "#%" PRIu64 " (0x%" PRIx64 ")\n"), block, block);
-		if(gfs2_block_mark(sdp, bl, block, gfs2_dup_block)) {
-			stack;
-			fsck_inode_put(&ip);
-			return -1;
-		}
+		gfs2_dup_set(block);
 		fsck_inode_put(&ip);
 		return 0;
 	}
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index c9fa04f..5c6abb7 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -42,7 +42,7 @@ struct fxn_info {
 };
 
 struct dup_handler {
-	struct dup_blocks *b;
+	struct dup_blks *b;
 	struct inode_with_dups *id;
 	int ref_inode_count;
 	int ref_count;
@@ -128,12 +128,12 @@ static int find_dentry(struct gfs2_inode *ip, struct gfs2_dirent *de,
 		       uint16_t *count, void *priv)
 {
 	osi_list_t *tmp1, *tmp2;
-	struct dup_blocks *b;
+	struct dup_blks *b;
 	struct inode_with_dups *id;
 	struct gfs2_leaf leaf;
 
-	osi_list_foreach(tmp1, &ip->i_sbd->dup_blocks.list) {
-		b = osi_list_entry(tmp1, struct dup_blocks, list);
+	osi_list_foreach(tmp1, &dup_blocks.list) {
+		b = osi_list_entry(tmp1, struct dup_blks, list);
 		osi_list_foreach(tmp2, &b->ref_inode_list) {
 			id = osi_list_entry(tmp2, struct inode_with_dups,
 					    list);
@@ -328,7 +328,7 @@ static int clear_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_data_ptr,
 }
 
 /* Finds all references to duplicate blocks in the metadata */
-static int find_block_ref(struct gfs2_sbd *sbp, uint64_t inode, struct dup_blocks *b)
+static int find_block_ref(struct gfs2_sbd *sbp, uint64_t inode, struct dup_blks *b)
 {
 	struct gfs2_inode *ip;
 	struct fxn_info myfi = {b->block_no, 0, 1};
@@ -382,7 +382,7 @@ static int find_block_ref(struct gfs2_sbd *sbp, uint64_t inode, struct dup_block
 	return 0;
 }
 
-static int handle_dup_blk(struct gfs2_sbd *sbp, struct dup_blocks *b)
+static int handle_dup_blk(struct gfs2_sbd *sbp, struct dup_blks *b)
 {
 	osi_list_t *tmp;
 	struct inode_with_dups *id;
@@ -507,7 +507,7 @@ static int handle_dup_blk(struct gfs2_sbd *sbp, struct dup_blocks *b)
  * use in pass2 */
 int pass1b(struct gfs2_sbd *sbp)
 {
-	struct dup_blocks *b;
+	struct dup_blks *b;
 	uint64_t i;
 	struct gfs2_block_query q;
 	osi_list_t *tmp = NULL, *x;
@@ -518,7 +518,7 @@ int pass1b(struct gfs2_sbd *sbp)
 	log_info( _("Looking for duplicate blocks...\n"));
 
 	/* If there were no dups in the bitmap, we don't need to do anymore */
-	if(osi_list_empty(&sbp->dup_blocks.list)) {
+	if(osi_list_empty(&dup_blocks.list)) {
 		log_info( _("No duplicate blocks found\n"));
 		return FSCK_OK;
 	}
@@ -546,8 +546,8 @@ int pass1b(struct gfs2_sbd *sbp)
 		   (q.block_type == gfs2_inode_chr) ||
 		   (q.block_type == gfs2_inode_fifo) ||
 		   (q.block_type == gfs2_inode_sock)) {
-			osi_list_foreach_safe(tmp, &sbp->dup_blocks.list, x) {
-				b = osi_list_entry(tmp, struct dup_blocks,
+			osi_list_foreach_safe(tmp, &dup_blocks.list, x) {
+				b = osi_list_entry(tmp, struct dup_blks,
 						   list);
 				if(find_block_ref(sbp, i, b)) {
 					stack;
@@ -565,8 +565,8 @@ int pass1b(struct gfs2_sbd *sbp)
 	 * it later */
 	log_info( _("Handling duplicate blocks\n"));
 out:
-        osi_list_foreach_safe(tmp, &sbp->dup_blocks.list, x) {
-                b = osi_list_entry(tmp, struct dup_blocks, list);
+        osi_list_foreach_safe(tmp, &dup_blocks.list, x) {
+                b = osi_list_entry(tmp, struct dup_blks, list);
 		if (!skip_this_pass && !rc) /* no error & not asked to skip the rest */
 			handle_dup_blk(sbp, b);
 	}
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index b1eefed..2cfe12d 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -676,7 +676,7 @@ int pass2(struct gfs2_sbd *sbp)
 	int filename_len;
 	char tmp_name[256];
 	int error = 0;
-	struct dup_blocks *b;
+	struct dup_blks *b;
 
 	/* Check all the system directory inodes. */
 	if (check_system_dir(sbp->md.jiinode, "jindex", build_jindex)) {
@@ -822,9 +822,9 @@ int pass2(struct gfs2_sbd *sbp)
 	   deleting it from both inodes referencing it. Note: The other
 	   returns from this function are premature exits of the program
 	   and gfs2_block_list_destroy should get rid of the list for us. */
-	while (!osi_list_empty(&sbp->dup_blocks.list)) {
-		b = osi_list_entry(sbp->dup_blocks.list.next,
-				   struct dup_blocks, list);
+	while (!osi_list_empty(&dup_blocks.list)) {
+		b = osi_list_entry(dup_blocks.list.next,
+				   struct dup_blks, list);
 		osi_list_del(&b->list);
 		free(b);
 	}
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
index 3d3707c..48de4bd 100644
--- a/gfs2/fsck/util.c
+++ b/gfs2/fsck/util.c
@@ -25,6 +25,7 @@
 
 #include "libgfs2.h"
 #include "fs_bits.h"
+#include "metawalk.h"
 #include "util.h"
 
 /**
@@ -195,3 +196,19 @@ int fsck_query(const char *format, ...)
 	opts.query = FALSE;
 	return ret;
 }
+
+void gfs2_dup_set(uint64_t block)
+{
+	struct dup_blks *b;
+
+	if (dupfind(block))
+		return;
+	b = malloc(sizeof(struct dup_blks));
+	if (b) {
+		memset(b, 0, sizeof(*b));
+		b->block_no = block;
+		osi_list_init(&b->ref_inode_list);
+		osi_list_add(&b->list, &dup_blocks.list);
+	}
+	return;
+}
diff --git a/gfs2/fsck/util.h b/gfs2/fsck/util.h
index ffbe975..3f9e921 100644
--- a/gfs2/fsck/util.h
+++ b/gfs2/fsck/util.h
@@ -24,5 +24,6 @@ struct di_info *search_list(osi_list_t *list, uint64_t addr);
 void big_file_comfort(struct gfs2_inode *ip, uint64_t blks_checked);
 void warm_fuzzy_stuff(uint64_t block);
 const char *block_type_string(struct gfs2_block_query *q);
+void gfs2_dup_set(uint64_t block);
 
 #endif /* __UTIL_H__ */
diff --git a/gfs2/libgfs2/block_list.c b/gfs2/libgfs2/block_list.c
index 44435ff..e9287d1 100644
--- a/gfs2/libgfs2/block_list.c
+++ b/gfs2/libgfs2/block_list.c
@@ -20,15 +20,6 @@
 
 #include "libgfs2.h"
 
-/* Must be kept in sync with mark_block enum in block_list.h */
-/* FIXME: Fragile */
-static int mark_to_gbmap[16] = {
-	FREE, BLOCK_IN_USE, DIR_INDIR_BLK, DIR_INODE, FILE_INODE,
-	LNK_INODE, BLK_INODE, CHR_INODE, FIFO_INODE, SOCK_INODE,
-	DIR_LEAF_INODE, JOURNAL_BLK, OTHER_META, EATTR_META,
-	BAD_BLOCK, INVALID_META
-};
-
 static int gfs2_blockmap_create(struct gfs2_bmap *bmap, uint64_t size)
 {
 	bmap->size = size;
@@ -70,7 +61,6 @@ struct gfs2_bmap *gfs2_bmap_create(struct gfs2_sbd *sdp, uint64_t size,
 		free(il);
 		il = NULL;
 	}
-	osi_list_init(&sdp->dup_blocks.list);
 	osi_list_init(&sdp->eattr_blocks.list);
 	return il;
 }
@@ -87,19 +77,6 @@ void gfs2_special_free(struct special_blocks *blist)
 	}
 }
 
-static void gfs2_dup_free(struct dup_blocks *blist)
-{
-	struct dup_blocks *f;
-
-	while(!osi_list_empty(&blist->list)) {
-		f = osi_list_entry(blist->list.next, struct dup_blocks, list);
-		while (!osi_list_empty(&f->ref_inode_list))
-			osi_list_del(&f->ref_inode_list);
-		osi_list_del(&f->list);
-		free(f);
-	}
-}
-
 struct special_blocks *blockfind(struct special_blocks *blist, uint64_t num)
 {
 	osi_list_t *head = &blist->list;
@@ -114,20 +91,6 @@ struct special_blocks *blockfind(struct special_blocks *blist, uint64_t num)
 	return NULL;
 }
 
-static struct dup_blocks *dupfind(struct dup_blocks *blist, uint64_t num)
-{
-	osi_list_t *head = &blist->list;
-	osi_list_t *tmp;
-	struct dup_blocks *b;
-
-	for (tmp = head->next; tmp != head; tmp = tmp->next) {
-		b = osi_list_entry(tmp, struct dup_blocks, list);
-		if (b->block_no == num)
-			return b;
-	}
-	return NULL;
-}
-
 void gfs2_special_set(struct special_blocks *blocklist, uint64_t block)
 {
 	struct special_blocks *b;
@@ -143,33 +106,6 @@ void gfs2_special_set(struct special_blocks *blocklist, uint64_t block)
 	return;
 }
 
-static void gfs2_dup_set(struct dup_blocks *blocklist, uint64_t block)
-{
-	struct dup_blocks *b;
-
-	if (dupfind(blocklist, block))
-		return;
-	b = malloc(sizeof(struct dup_blocks));
-	if (b) {
-		memset(b, 0, sizeof(*b));
-		b->block_no = block;
-		osi_list_init(&b->ref_inode_list);
-		osi_list_add(&b->list, &blocklist->list);
-	}
-	return;
-}
-
-static void gfs2_dup_clear(struct dup_blocks *blocklist, uint64_t block)
-{
-	struct dup_blocks *b;
-
-	b = dupfind(blocklist, block);
-	if (b) {
-		osi_list_del(&b->list);
-		free(b);
-	}
-}
-
 void gfs2_special_clear(struct special_blocks *blocklist, uint64_t block)
 {
 	struct special_blocks *b;
@@ -181,39 +117,20 @@ void gfs2_special_clear(struct special_blocks *blocklist, uint64_t block)
 	}
 }
 
-int gfs2_block_mark(struct gfs2_sbd *sdp, struct gfs2_bmap *il,
-		    uint64_t block, enum gfs2_mark_block mark)
-{
-	int err = 0;
-
-	if(mark == gfs2_dup_block)
-		gfs2_dup_set(&sdp->dup_blocks, block);
-	else
-		err = gfs2_blockmap_set(sdp, il, block, mark_to_gbmap[mark]);
-	return err;
-}
-
 /* gfs2_block_unmark clears ONE mark for the given block */
 int gfs2_block_unmark(struct gfs2_sbd *sdp, struct gfs2_bmap *bmap,
 		      uint64_t block, enum gfs2_mark_block mark)
 {
-	int err = 0;
-
-	if (mark == gfs2_dup_block)
-		gfs2_dup_clear(&sdp->dup_blocks, block);
-	else {
-		static unsigned char *byte;
-		static uint64_t b;
+	static unsigned char *byte;
+	static uint64_t b;
 
-		if(block > bmap->size)
-			return -1;
+	if(block > bmap->size)
+		return -1;
 
-		byte = bmap->map + BLOCKMAP_SIZE4(block);
-		b = BLOCKMAP_BYTE_OFFSET4(block);
-		*byte &= ~(BLOCKMAP_MASK4 << b);
-		return 0;
-	}
-	return err;
+	byte = bmap->map + BLOCKMAP_SIZE4(block);
+	b = BLOCKMAP_BYTE_OFFSET4(block);
+	*byte &= ~(BLOCKMAP_MASK4 << b);
+	return 0;
 }
 
 int gfs2_blockmap_set(struct gfs2_sbd *sdp, struct gfs2_bmap *bmap,
@@ -241,7 +158,6 @@ int gfs2_block_check(struct gfs2_sbd *sdp, struct gfs2_bmap *il,
 	if(block >= il->size)
 		return -1;
 
-	val->dup_block = (dupfind(&sdp->dup_blocks, block) ? 1 : 0);
 	byte = il->map + BLOCKMAP_SIZE4(block);
 	b = BLOCKMAP_BYTE_OFFSET4(block);
 	val->block_type = (*byte & (BLOCKMAP_MASK4 << b )) >> b;
@@ -255,7 +171,6 @@ void *gfs2_bmap_destroy(struct gfs2_sbd *sdp, struct gfs2_bmap *il)
 		free(il);
 		il = NULL;
 	}
-	gfs2_dup_free(&sdp->dup_blocks);
 	gfs2_special_free(&sdp->eattr_blocks);
 	return il;
 }
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 41759a8..5ac92d1 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -113,12 +113,6 @@ struct gfs2_buffer_head {
 	struct gfs2_sbd *sdp;
 };
 
-struct dup_blocks {
-	osi_list_t list;
-	uint64_t block_no;
-	osi_list_t ref_inode_list;
-};
-
 struct special_blocks {
 	osi_list_t list;
 	uint64_t block;
@@ -237,7 +231,6 @@ struct gfs2_sbd {
 	unsigned int writes;
 	int metafs_fd;
 	char metafs_path[PATH_MAX]; /* where metafs is mounted */
-	struct dup_blocks dup_blocks;
 	struct special_blocks eattr_blocks;
 };
 
@@ -305,12 +298,10 @@ enum gfs2_mark_block {
 	gfs2_meta_eattr = EATTR_META,
 	gfs2_bad_block = BAD_BLOCK, /* Contains at least one bad block */
 	gfs2_meta_inval = INVALID_META,
-	gfs2_dup_block,      /* Contains at least one duplicate block */
 };
 
 struct gfs2_block_query {
         uint8_t block_type;
-        uint8_t dup_block;
 };
 
 extern struct gfs2_bmap *gfs2_bmap_create(struct gfs2_sbd *sdp, uint64_t size,
@@ -322,8 +313,6 @@ extern int gfs2_blockmap_set(struct gfs2_sbd *sdp, struct gfs2_bmap *il,
 			  uint64_t block, enum gfs2_mark_block mark);
 extern void gfs2_special_clear(struct special_blocks *blocklist,
 			       uint64_t block);
-extern int gfs2_block_mark(struct gfs2_sbd *sdp, struct gfs2_bmap *il,
-			   uint64_t block, enum gfs2_mark_block mark);
 /* gfs2_block_unmark clears ONE mark for the given block */
 extern int gfs2_block_unmark(struct gfs2_sbd *sdp, struct gfs2_bmap *il,
 			     uint64_t block, enum gfs2_mark_block m);