gfs2-utils: master - Eliminate bad_block linked block list

Bob Peterson rpeterso at fedoraproject.org
Tue Jan 26 21:08:22 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=bf8e2b40ca9fb6905ee8eb4d8567942a26eb57e5
Commit:        bf8e2b40ca9fb6905ee8eb4d8567942a26eb57e5
Parent:        9d2b80c4bf3ad8dc935673ca36e5ef681d7fd5c5
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 15:09:39 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 4f1f301..a7ac70e 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -248,7 +248,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 */
@@ -593,7 +593,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;
@@ -753,7 +753,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 4112024..27d0594 100644
--- a/gfs2/fsck/pass3.c
+++ b/gfs2/fsck/pass3.c
@@ -219,7 +219,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 95b6e9d..5714a73 100644
--- a/gfs2/fsck/pass4.c
+++ b/gfs2/fsck/pass4.c
@@ -66,7 +66,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 028f473..39c16d6 100644
--- a/gfs2/libgfs2/block_list.c
+++ b/gfs2/libgfs2/block_list.c
@@ -166,7 +166,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;
@@ -283,9 +282,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);
@@ -305,9 +302,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;
@@ -326,7 +320,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;
@@ -348,11 +341,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))
@@ -369,7 +359,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