Skip to contentSkip to conversation

ocfs2: remove goto statement in ocfs2_check_dir_for_entry()

PATCH RESEND In review Daeseok Youn 2 participants 2 messages Feb 27, 2015 – Mar 19, 2015 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 4/4 ocfs2: remove goto statement in ocfs2_check_dir_for_entry()

---
RESEND: this patch is rebased by 1/4.

 fs/ocfs2/dir.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)
fs/ocfs2/dir.c +5 -8
index c63f2b6..b3ab2a6 100644
@@ -2043,22 +2043,19 @@ int ocfs2_check_dir_for_entry(struct inode *dir,
 			      const char *name,
 			      int namelen)
 {
-	int ret;
+	int ret = 0;
 	struct ocfs2_dir_lookup_result lookup = { NULL, };
 
 	trace_ocfs2_check_dir_for_entry(
 		(unsigned long long)OCFS2_I(dir)->ip_blkno, namelen, name);
 
-	ret = -EEXIST;
-	if (ocfs2_find_entry(name, namelen, dir, &lookup) == 0)
-		goto bail;
+	if (ocfs2_find_entry(name, namelen, dir, &lookup) == 0) {
+		ret = -EEXIST;
+		mlog_errno(ret);
+	}
 
-	ret = 0;
-bail:
 	ocfs2_free_dir_lookup_result(&lookup);
 
-	if (ret)
-		mlog_errno(ret);
 	return ret;
 }
 
Signature · 1 line
1.7.1
Reviewed-by on v1 4/4
#1 lore raw
Quoted 1 line · Daeseok Youn
Quoted 39 lines

---
RESEND: this patch is rebased by 1/4.

 fs/ocfs2/dir.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)
fs/ocfs2/dir.c +5 -8
index c63f2b6..b3ab2a6 100644
@@ -2043,22 +2043,19 @@ int ocfs2_check_dir_for_entry(struct inode *dir,
 			      const char *name,
 			      int namelen)
 {
-	int ret;
+	int ret = 0;
 	struct ocfs2_dir_lookup_result lookup = { NULL, };
 
 	trace_ocfs2_check_dir_for_entry(
 		(unsigned long long)OCFS2_I(dir)->ip_blkno, namelen, name);
 
-	ret = -EEXIST;
-	if (ocfs2_find_entry(name, namelen, dir, &lookup) == 0)
-		goto bail;
+	if (ocfs2_find_entry(name, namelen, dir, &lookup) == 0) {
+		ret = -EEXIST;
+		mlog_errno(ret);
+	}
 
-	ret = 0;
-bail:
 	ocfs2_free_dir_lookup_result(&lookup);
 
-	if (ret)
-		mlog_errno(ret);
 	return ret;
 }