[PATCH 08/11] ocfs2: Less checks in ocfs2_load_local_alloc()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 4 Jul 2015 22:06:32 +0200

* Skip checks for the variable "status" in a few cases within
  the ocfs2_load_local_alloc() function by adjustment of two jump targets
  according to the Linux coding style convention.

* Drop unnecessary initialisations for the variables "alloc"
  and "inode" then.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
 fs/ocfs2/localalloc.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index e6d5074..08f812b 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -284,14 +284,14 @@ bail:
 int ocfs2_load_local_alloc(struct ocfs2_super *osb)
 {
 	int status = 0;
-	struct ocfs2_dinode *alloc = NULL;
+	struct ocfs2_dinode *alloc;
 	struct buffer_head *alloc_bh = NULL;
 	u32 num_used;
-	struct inode *inode = NULL;
+	struct inode *inode;
 	struct ocfs2_local_alloc *la;
 
-	if (osb->local_alloc_bits == 0)
-		goto bail;
+	if (osb->local_alloc_bits)
+		goto trace_bits;
 
 	if (osb->local_alloc_bits >= osb->bitmap_cpg) {
 		mlog(ML_NOTICE, "Requested local alloc window %d is larger "
@@ -308,14 +308,14 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
 	if (!inode) {
 		status = -EINVAL;
 		mlog_errno(status);
-		goto bail;
+		goto trace_bits;
 	}
 
 	status = ocfs2_read_inode_block_full(inode, &alloc_bh,
 					     OCFS2_BH_IGNORE_CACHE);
 	if (status < 0) {
 		mlog_errno(status);
-		goto bail;
+		goto put_inode;
 	}
 
 	alloc = (struct ocfs2_dinode *) alloc_bh->b_data;
@@ -326,6 +326,7 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
 		mlog(ML_ERROR, "Invalid local alloc inode, %llu\n",
 		     (unsigned long long)OCFS2_I(inode)->ip_blkno);
 		status = -EINVAL;
+		mlog_errno(status);
 		goto bail;
 	}
 
@@ -334,6 +335,7 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
 		mlog(ML_ERROR, "Local alloc size is invalid (la_size = %u)\n",
 		     le16_to_cpu(la->la_size));
 		status = -EINVAL;
+		mlog_errno(status);
 		goto bail;
 	}
 
@@ -358,11 +360,10 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
 bail:
 	if (status < 0)
 		brelse(alloc_bh);
+put_inode:
 	iput(inode);
+trace_bits:
 	trace_ocfs2_load_local_alloc(osb->local_alloc_bits);
-
-	if (status)
-		mlog_errno(status);
 	return status;
 }
 
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux