cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [fsck.gfs2 PATCH 1 of 2] fsck.gfs2: Change duptree structure to have generic flags
Date: Wed, 1 Jul 2015 10:50:59 -0400 (EDT)	[thread overview]
Message-ID: <754914149.28856474.1435762259777.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1801707002.28854843.1435762178016.JavaMail.zimbra@redhat.com>

Hi,

This is part 1 of a 2-patch set for fsck.gfs2.

This patch does not change any functionality. It merely changes the
specialized first_ref_found flag to a flag within a multi-flag var.

Regards,

Bob Peterson
Red Hat File Systems

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
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++;



           reply	other threads:[~2015-07-01 14:50 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1801707002.28854843.1435762178016.JavaMail.zimbra@redhat.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=754914149.28856474.1435762259777.JavaMail.zimbra@redhat.com \
    --to=rpeterso@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).