[PATCH 03/11] ocfs2: Less checks in ocfs2_rename() after error detection

SF Markus Elfring
2015-07-05T13:30:53Z

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 4 Jul 2015 15:30:18 +0200

Skip checks for a few variables in three error handling cases within
the ocfs2_rename() function by adjustment of a few jump targets
according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
fs/ocfs2/namei.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index a04d70b..04a61cb 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -1255,7 +1255,7 @@ static int ocfs2_rename(struct inode *old_dir,
status = ocfs2_rename_lock(osb);
if (status < 0) {
mlog_errno(status);
- goto bail;
+ goto basic_clean_up;
}
rename_lock = 1;

@@ -1265,13 +1265,13 @@ static int ocfs2_rename(struct inode *old_dir,
old_inode->i_ino);
if (status < 0) {
mlog_errno(status);
- goto bail;
+ goto rename_unlock;
} else if (status == 1) {
status = -EPERM;
trace_ocfs2_rename_not_permitted(
(unsigned long long)old_inode->i_ino,
(unsigned long long)new_dir->i_ino);
- goto bail;
+ goto rename_unlock;
}
}

@@ -1630,9 +1630,10 @@ static int ocfs2_rename(struct inode *old_dir,
ocfs2_dentry_move(old_dentry, new_dentry, old_dir, new_dir);
status = 0;
bail:
- if (rename_lock)
+ if (rename_lock) {
+rename_unlock:
ocfs2_rename_unlock(osb);
-
+ }
if (handle)
ocfs2_commit_trans(osb, handle);

@@ -1651,7 +1652,7 @@ bail:
mutex_unlock(&orphan_dir->i_mutex);
iput(orphan_dir);
}
-
+basic_clean_up:
if (new_inode)
sync_mapping_buffers(old_inode->i_mapping);

--
2.4.5