cluster: STABLE3 - Eliminate bad_block linked block list

Bob Peterson rpeterso at fedoraproject.org
Tue Jan 26 21:18:49 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=c7f8a0e194283bdd54d180cceda3377561ab0787
Commit:        c7f8a0e194283bdd54d180cceda3377561ab0787
Parent:        cdb69478a8101a710a3a52ffb5412f4376e39437
Author:        Bob Peterson <bob at ganesha.peterson>
AuthorDate:    Wed Nov 25 14:32:56 2009 -0600
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Tue Jan 26 14:39:26 2010 -0600

Eliminate bad_block linked block list

This patch eliminates the special linked list designated for bad
blocks in fsck.gfs2 in lieu of a bad block designation in the
block list bitmap.

rhbz#455300
---
 gfs2/fsck/pass2.c         |    6 +++---
 gfs2/fsck/pass3.c         |    2 +-
 gfs2/fsck/pass4.c         |    2 +-
 gfs2/libgfs2/block_list.c |   13 +------------
 gfs2/libgfs2/libgfs2.h    |    7 ++-----
 5 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 55944b6..15b7594 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -246,7 +246,7 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
 		return -1;
 	}
 	/* Get the status of the directory inode */
-	if(q.bad_block) {
+	if(q.block_type == gfs2_bad_block) {
 		/* This entry's inode has bad blocks in it */
 
 		/* Handle bad blocks */
@@ -591,7 +591,7 @@ static int check_system_dir(struct gfs2_inode *sysinode, const char *dirname,
 		}
 	}
 	pass2_fxns.private = (void *) &ds;
-	if(ds.q.bad_block) {
+	if(ds.q.block_type == gfs2_bad_block) {
 		/* First check that the directory's metatree is valid */
 		if(check_metatree(sysinode, &pass2_fxns)) {
 			stack;
@@ -751,7 +751,7 @@ int pass2(struct gfs2_sbd *sbp)
 
 		memset(&ds, 0, sizeof(ds));
 		pass2_fxns.private = (void *) &ds;
-		if(ds.q.bad_block) {
+		if(ds.q.block_type == gfs2_bad_block) {
 			/* First check that the directory's metatree
 			 * is valid */
 			ip = fsck_load_inode(sbp, i);
diff --git a/gfs2/fsck/pass3.c b/gfs2/fsck/pass3.c
index 9bb7cb4..d119915 100644
--- a/gfs2/fsck/pass3.c
+++ b/gfs2/fsck/pass3.c
@@ -217,7 +217,7 @@ int pass3(struct gfs2_sbd *sbp)
 					stack;
 					return FSCK_ERROR;
 				}
-				if(q.bad_block) {
+				if(q.block_type == gfs2_bad_block) {
 					log_err( _("Found unlinked directory containing bad block\n"));
 					errors_found++;
 					if(query(&opts,
diff --git a/gfs2/fsck/pass4.c b/gfs2/fsck/pass4.c
index 7ece88a..09a11a6 100644
--- a/gfs2/fsck/pass4.c
+++ b/gfs2/fsck/pass4.c
@@ -64,7 +64,7 @@ static int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) {
 				stack;
 				return -1;
 			}
-			if(q.bad_block) {
+			if(q.block_type == gfs2_bad_block) {
 				log_err( _("Unlinked inode %llu (0x%llx) contains"
 					"bad blocks\n"),
 					(unsigned long long)ii->inode,
diff --git a/gfs2/libgfs2/block_list.c b/gfs2/libgfs2/block_list.c
index 75e2747..39de646 100644
--- a/gfs2/libgfs2/block_list.c
+++ b/gfs2/libgfs2/block_list.c
@@ -164,7 +164,6 @@ struct gfs2_block_list *gfs2_block_list_create(struct gfs2_sbd *sdp,
 		free(il);
 		il = NULL;
 	}
-	osi_list_init(&sdp->bad_blocks.list);
 	osi_list_init(&sdp->dup_blocks.list);
 	osi_list_init(&sdp->eattr_blocks.list);
 	return il;
@@ -281,9 +280,7 @@ int gfs2_block_mark(struct gfs2_sbd *sdp, struct gfs2_block_list *il,
 {
 	int err = 0;
 
-	if(mark == gfs2_bad_block)
-		gfs2_special_set(&sdp->bad_blocks, block);
-	else if(mark == gfs2_dup_block)
+	if(mark == gfs2_dup_block)
 		gfs2_dup_set(&sdp->dup_blocks, block);
 	else if(mark == gfs2_eattr_block)
 		gfs2_special_set(&sdp->eattr_blocks, block);
@@ -303,9 +300,6 @@ int gfs2_block_unmark(struct gfs2_sbd *sdp, struct gfs2_block_list *il,
 	case gfs2_dup_block:
 		gfs2_dup_clear(&sdp->dup_blocks, block);
 		break;
-	case gfs2_bad_block:
-		gfs2_special_clear(&sdp->bad_blocks, block);
-		break;
 	case gfs2_eattr_block:
 		gfs2_special_clear(&sdp->eattr_blocks, block);
 		break;
@@ -324,7 +318,6 @@ int gfs2_block_clear(struct gfs2_sbd *sdp, struct gfs2_block_list *il,
 	int err = 0;
 
 	gfs2_dup_clear(&sdp->dup_blocks, block);
-	gfs2_special_clear(&sdp->bad_blocks, block);
 	gfs2_special_clear(&sdp->eattr_blocks, block);
 	err = gfs2_bitmap_clear(&il->list.gbmap, block);
 	return err;
@@ -346,11 +339,8 @@ int gfs2_block_check(struct gfs2_sbd *sdp, struct gfs2_block_list *il,
 {
 	int err = 0;
 
-	val->bad_block = 0;
 	val->dup_block = 0;
 	val->eattr_block = 0;
-	if (blockfind(&sdp->bad_blocks, block))
-		val->bad_block = 1;
 	if (dupfind(&sdp->dup_blocks, block))
 		val->dup_block = 1;
 	if (blockfind(&sdp->eattr_blocks, block))
@@ -367,7 +357,6 @@ void *gfs2_block_list_destroy(struct gfs2_sbd *sdp, struct gfs2_block_list *il)
 		free(il);
 		il = NULL;
 	}
-	gfs2_special_free(&sdp->bad_blocks);
 	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 e1a984f..b1fe8ea 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -249,7 +249,6 @@ struct gfs2_sbd {
 	unsigned int writes;
 	int metafs_fd;
 	char metafs_path[PATH_MAX]; /* where metafs is mounted */
-	struct special_blocks bad_blocks;
 	struct dup_blocks dup_blocks;
 	struct special_blocks eattr_blocks;
 };
@@ -310,7 +309,7 @@ struct gfs2_bmap {
 #define JOURNAL_BLK     (0xB)  /*   1011 */
 #define OTHER_META      (0xC)  /*   1100 */
 #define EATTR_META      (0xD)  /*   1101 */
-#define UNUSED1         (0xE)  /*   1110 */
+#define BAD_BLOCK       (0xE)  /*   1110 */
 #define INVALID_META    (0xF)  /*   1111 */
 
 /* Must be kept in sync with mark_to_bitmap array in block_list.c */
@@ -329,16 +328,14 @@ enum gfs2_mark_block {
 	gfs2_journal_blk = JOURNAL_BLK,
 	gfs2_meta_other = OTHER_META,
 	gfs2_meta_eattr = EATTR_META,
-	gfs2_meta_unused = UNUSED1,
+	gfs2_bad_block = BAD_BLOCK, /* Contains at least one bad block */
 	gfs2_meta_inval = INVALID_META,
-	gfs2_bad_block,      /* Contains at least one bad block */
 	gfs2_dup_block,      /* Contains at least one duplicate block */
 	gfs2_eattr_block,    /* Contains an eattr */
 };
 
 struct gfs2_block_query {
         uint8_t block_type;
-        uint8_t bad_block;
         uint8_t dup_block;
         uint8_t eattr_block;
 };


More information about the cluster-commits mailing list