gfs2-utils: master - fsck.gfs2: Combine remove_inode_eattr with its only caller

Bob Peterson rpeterso at fedoraproject.org
Tue Sep 29 18:38:21 UTC 2015


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=7520428d1f78a538243b92226335ce9d1551633c
Commit:        7520428d1f78a538243b92226335ce9d1551633c
Parent:        6260b11af9222910550678f7c8933d4091870427
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Thu Sep 24 10:15:46 2015 -0500
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Tue Sep 29 13:23:44 2015 -0500

fsck.gfs2: Combine remove_inode_eattr with its only caller

Since remove_inode_eattr() is now only called from one place,
it is combined with its caller to make the code more readable
and less confusing: function ask_remove_inode_eattr.
---
 gfs2/fsck/pass1.c |   23 +++++++----------------
 1 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index a515a62..895d1d1 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -553,17 +553,6 @@ static int check_data(struct gfs2_inode *ip, uint64_t metablock,
 	return 0;
 }
 
-static int remove_inode_eattr(struct gfs2_inode *ip, struct block_count *bc)
-{
-	undo_reference(ip, ip->i_di.di_eattr, 0, bc);
-	ip->i_di.di_eattr = 0;
-	bc->ea_count = 0;
-	ip->i_di.di_blocks = 1 + bc->indir_count + bc->data_count;
-	ip->i_di.di_flags &= ~GFS2_DIF_EA_INDIRECT;
-	bmodified(ip->i_bh);
-	return 0;
-}
-
 static int ask_remove_inode_eattr(struct gfs2_inode *ip,
 				  struct block_count *bc)
 {
@@ -573,11 +562,13 @@ static int ask_remove_inode_eattr(struct gfs2_inode *ip,
 		   "errors.\n"), (unsigned long long)ip->i_di.di_num.no_addr,
 		 (unsigned long long)ip->i_di.di_num.no_addr);
 	if (query( _("Clear all Extended Attributes from the inode? (y/n) "))){
-		if (!remove_inode_eattr(ip, bc))
-			log_err( _("Extended attributes were removed.\n"));
-		else
-			log_err( _("Unable to remove inode eattr pointer; "
-				   "the error remains.\n"));
+		undo_reference(ip, ip->i_di.di_eattr, 0, bc);
+		ip->i_di.di_eattr = 0;
+		bc->ea_count = 0;
+		ip->i_di.di_blocks = 1 + bc->indir_count + bc->data_count;
+		ip->i_di.di_flags &= ~GFS2_DIF_EA_INDIRECT;
+		bmodified(ip->i_bh);
+		log_err( _("Extended attributes were removed.\n"));
 	} else {
 		log_err( _("Extended attributes were not removed.\n"));
 	}


More information about the cluster-commits mailing list