gfs2-utils: master - fsck.gfs2: Change duptree structure to have generic flags

Bob Peterson rpeterso at fedoraproject.org
Thu Jul 2 17:59:27 UTC 2015


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=b90dbab5aa516f356cca24739564e2c4e3c0c815
Commit:        b90dbab5aa516f356cca24739564e2c4e3c0c815
Parent:        335552bcf1345d9083690e1ef892fa856ac1e59e
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Fri Jun 26 12:18:59 2015 -0500
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Wed Jul 1 09:47:27 2015 -0500

fsck.gfs2: Change duptree structure to have generic flags

This patch does not change any functionality. It merely changes the
specialized first_ref_found flag to a flag within a multi-flag var.
---
 gfs2/fsck/fsck.h |    4 +++-
 gfs2/fsck/util.c |    9 ++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/gfs2/fsck/fsck.h b/gfs2/fsck/fsck.h
index 09db668..78e8ad4 100644
--- a/gfs2/fsck/fsck.h
+++ b/gfs2/fsck/fsck.h
@@ -57,9 +57,11 @@ struct dir_status {
 	uint32_t entry_count;
 };
 
+#define DUPFLAG_REF1_FOUND 1 /* Has the original reference been found? */
+
 struct duptree {
 	struct osi_node node;
-	int first_ref_found; /* Has the original reference been found? */
+	int dup_flags;
 	int refs;
 	uint64_t block;
 	osi_list_t ref_inode_list; /* list of inodes referencing a dup block */
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
index efdd132..4022fee 100644
--- a/gfs2/fsck/util.c
+++ b/gfs2/fsck/util.c
@@ -261,7 +261,6 @@ static struct duptree *gfs2_dup_set(uint64_t dblock, int create)
 	dt->block = dblock;
 	dt->refs = 1; /* reference 1 is actually the reference we need to
 			 discover in pass1b. */
-	dt->first_ref_found = 0;
 	osi_list_init(&dt->ref_inode_list);
 	osi_list_init(&dt->ref_invinode_list);
 	osi_link_node(&dt->node, parent, newn);
@@ -326,7 +325,7 @@ int add_duplicate_ref(struct gfs2_inode *ip, uint64_t block,
 	/* If we found the duplicate reference but we've already discovered
 	   the first reference (in pass1b) and the other references in pass1,
 	   we don't need to count it, so just return. */
-	if (dt->first_ref_found)
+	if (dt->dup_flags & DUPFLAG_REF1_FOUND)
 		return meta_is_good;
 
 	/* Check for a previous reference to this duplicate */
@@ -338,7 +337,7 @@ int add_duplicate_ref(struct gfs2_inode *ip, uint64_t block,
 	   that case, we don't want to be confused and consider this second
 	   reference the same as the first. If we do, we'll never be able to
 	   resolve it. The first reference can't be the second reference. */
-	if (id && first && !dt->first_ref_found) {
+	if (id && first && !(dt->dup_flags & DUPFLAG_REF1_FOUND)) {
 		log_info(_("Original reference to block %llu (0x%llx) was "
 			   "previously found to be bad and deleted.\n"),
 			 (unsigned long long)block,
@@ -347,7 +346,7 @@ int add_duplicate_ref(struct gfs2_inode *ip, uint64_t block,
 			   "(0x%llx) the first reference.\n"),
 			 (unsigned long long)ip->i_di.di_num.no_addr,
 			 (unsigned long long)ip->i_di.di_num.no_addr);
-		dt->first_ref_found = 1;
+		dt->dup_flags |= DUPFLAG_REF1_FOUND;
 		return meta_is_good;
 	}
 
@@ -356,7 +355,7 @@ int add_duplicate_ref(struct gfs2_inode *ip, uint64_t block,
 	   reference, we don't want to increment the reference count because
 	   it's already accounted for. */
 	if (first) {
-		dt->first_ref_found = 1;
+		dt->dup_flags |= DUPFLAG_REF1_FOUND;
 		dups_found_first++; /* We found another first ref. */
 	} else {
 		dt->refs++;


More information about the cluster-commits mailing list