lkml.org 
[lkml]   [2015]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 08/11] ocfs2: Less checks in ocfs2_load_local_alloc()
From: Markus Elfring <elfring@users.sourceforge.net>
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@users.sourceforge.net>
---
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


\
 
 \ /
  Last update: 2015-07-05 16:01    [W:0.649 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site