gfs2-utils: master - libgfs2: clean up some dead code in gfs2_writei

Andrew Price andyp at fedoraproject.org
Tue Sep 6 12:53:11 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=2aee8d01cc735178c56d6b0ca51e8b63468171e3
Commit:        2aee8d01cc735178c56d6b0ca51e8b63468171e3
Parent:        269f178ff858e4124c7bd6606a8ccfe41ea5358a
Author:        Andrew Price <anprice at redhat.com>
AuthorDate:    Thu Sep 1 14:25:01 2011 +0100
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Tue Sep 6 13:51:51 2011 +0100

libgfs2: clean up some dead code in gfs2_writei

This patch cleans up an error variable which was initialized to 0 and
then never changed, and a 'fail' section which could be replaced by a
return. It also removes the 'out' label which was only referenced from
the dead if-statement in the 'fail' section.

Signed-off-by: Andrew Price <anprice at redhat.com>
---
 gfs2/libgfs2/gfs1.c |   11 +----------
 1 files changed, 1 insertions(+), 10 deletions(-)

diff --git a/gfs2/libgfs2/gfs1.c b/gfs2/libgfs2/gfs1.c
index 2bd5282..4549959 100644
--- a/gfs2/libgfs2/gfs1.c
+++ b/gfs2/libgfs2/gfs1.c
@@ -181,11 +181,9 @@ int gfs1_writei(struct gfs2_inode *ip, char *buf, uint64_t offset,
 	int journaled = fs_is_jdata(ip);
 	const uint64_t start = offset;
 	int copied = 0;
-	int error = 0;
 
 	if (!size)
-		goto fail;  /*  Not really an error  */
-
+		return 0;
 
 	if (!ip->i_di.di_height && /* stuffed */
 	    ((start + size) > (sdp->bsize - sizeof(struct gfs_dinode))))
@@ -243,7 +241,6 @@ int gfs1_writei(struct gfs2_inode *ip, char *buf, uint64_t offset,
 		offset = (journaled) ? sizeof(struct gfs2_meta_header) : 0;
 	}
 
- out:
 	if (ip->i_di.di_size < start + copied) {
 		bmodified(ip->i_bh);
 		ip->i_di.di_size = start + copied;
@@ -253,12 +250,6 @@ int gfs1_writei(struct gfs2_inode *ip, char *buf, uint64_t offset,
 	gfs2_dinode_out(&ip->i_di, ip->i_bh);
 
 	return copied;
-
- fail:
-	if (copied)
-		goto out;
-
-	return error;
 }
 
 /* ------------------------------------------------------------------------ */


More information about the cluster-commits mailing list