lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5599328E.5010905@users.sourceforge.net>
Date:	Sun, 05 Jul 2015 15:35:10 +0200
From:	SF Markus Elfring <elfring@...rs.sourceforge.net>
To:	Joel Becker <jlbec@...lplan.org>, Mark Fasheh <mfasheh@...e.com>,
	ocfs2-devel@....oracle.com
CC:	LKML <linux-kernel@...r.kernel.org>,
	kernel-janitors@...r.kernel.org,
	Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH 06/11] ocfs2: Two checks less in ocfs2_local_alloc_slide_window()

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

* Return directly from the ocfs2_local_alloc_slide_window() function
  if a call of the ocfs2_local_alloc_reserve_for_window() function failed
  at the beginning.

* Rename jump labels according to the Linux coding style convention.

* Drop an unnecessary initialisation for the variable "handle" then.

* Delete a call of the mlog_errno() function at the end.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 fs/ocfs2/localalloc.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index a614037..16579ed 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -1248,7 +1248,7 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
 	int status = 0;
 	struct buffer_head *main_bm_bh = NULL;
 	struct inode *main_bm_inode = NULL;
-	handle_t *handle = NULL;
+	handle_t *handle;
 	struct ocfs2_dinode *alloc;
 	struct ocfs2_dinode *alloc_copy = NULL;
 	struct ocfs2_alloc_context *ac = NULL;
@@ -1263,15 +1263,14 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
 	if (status < 0) {
 		if (status != -ENOSPC)
 			mlog_errno(status);
-		goto bail;
+		return status;
 	}
 
 	handle = ocfs2_start_trans(osb, OCFS2_WINDOW_MOVE_CREDITS);
 	if (IS_ERR(handle)) {
 		status = PTR_ERR(handle);
-		handle = NULL;
 		mlog_errno(status);
-		goto bail;
+		goto clean_up_main;
 	}
 
 	alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
@@ -1285,7 +1284,7 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
 	if (!alloc_copy) {
 		status = -ENOMEM;
 		mlog_errno(status);
-		goto bail;
+		goto commit;
 	}
 	memcpy(alloc_copy, alloc, osb->local_alloc_bh->b_size);
 
@@ -1295,7 +1294,7 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
 					 OCFS2_JOURNAL_ACCESS_WRITE);
 	if (status < 0) {
 		mlog_errno(status);
-		goto bail;
+		goto commit;
 	}
 
 	ocfs2_clear_local_alloc(alloc);
@@ -1305,31 +1304,27 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
 					  main_bm_inode, main_bm_bh);
 	if (status < 0) {
 		mlog_errno(status);
-		goto bail;
+		goto commit;
 	}
 
 	status = ocfs2_local_alloc_new_window(osb, handle, ac);
 	if (status < 0) {
 		if (status != -ENOSPC)
 			mlog_errno(status);
-		goto bail;
+		goto commit;
 	}
 
 	atomic_inc(&osb->alloc_stats.moves);
 
-bail:
-	if (handle)
-		ocfs2_commit_trans(osb, handle);
-
+commit:
+	ocfs2_commit_trans(osb, handle);
+clean_up_main:
 	brelse(main_bm_bh);
 	iput(main_bm_inode);
 	kfree(alloc_copy);
 
 	if (ac)
 		ocfs2_free_alloc_context(ac);
-
-	if (status)
-		mlog_errno(status);
 	return status;
 }
 
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ