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: <1469155491-15265-13-git-send-email-jsimmons@infradead.org>
Date:	Thu, 21 Jul 2016 22:44:05 -0400
From:	James Simmons <jsimmons@...radead.org>
To:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	devel@...verdev.osuosl.org,
	Andreas Dilger <andreas.dilger@...el.com>,
	Oleg Drokin <oleg.drokin@...el.com>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Lustre Development List <lustre-devel@...ts.lustre.org>,
	wang di <di.wang@...el.com>,
	James Simmons <jsimmons@...radead.org>
Subject: [PATCH 12/58] staging: lustre: llite: handle done flags differently in ll_dir_read

From: wang di <di.wang@...el.com>

Invert the done flag test to reduce the code indentation.
If done is true release the page and break out of the
while loop.

Signed-off-by: wang di <di.wang@...el.com>
Reviewed-on: http://review.whamcloud.com/10761
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4906
Reviewed-by: John L. Hammond <john.hammond@...el.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@...el.com>
Reviewed-by: Andreas Dilger <andreas.dilger@...el.com>
Reviewed-by: Oleg Drokin <oleg.drokin@...el.com>
Signed-off-by: James Simmons <jsimmons@...radead.org>
---
 drivers/staging/lustre/lustre/llite/dir.c |   59 +++++++++++++++--------------
 1 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index 48eacee..e4d3176 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -562,37 +562,38 @@ int ll_dir_read(struct inode *inode, struct md_op_data *op_data,
 					 namelen, ino, type);
 		}
 
-		if (!done) {
-			next = le64_to_cpu(dp->ldp_hash_end);
-			pos = next;
-			if (pos == MDS_DIR_END_OFF) {
-				/*
-				 * End of directory reached.
-				 */
-				done = 1;
-				ll_release_page(page, 0);
-			} else if (1 /* chain is exhausted*/) {
-				/*
-				 * Normal case: continue to the next
-				 * page.
-				 */
-				ll_release_page(page,
-						le32_to_cpu(dp->ldp_flags) &
-						LDF_COLLIDE);
-				next = pos;
-				page = ll_get_dir_page(inode, pos,
-						       &chain);
-			} else {
-				/*
-				 * go into overflow page.
-				 */
-				LASSERT(le32_to_cpu(dp->ldp_flags) &
-					LDF_COLLIDE);
-				ll_release_page(page, 1);
-			}
-		} else {
+		if (done) {
 			pos = hash;
 			ll_release_page(page, 0);
+			break;
+		}
+
+		next = le64_to_cpu(dp->ldp_hash_end);
+		pos = next;
+		if (pos == MDS_DIR_END_OFF) {
+			/*
+			 * End of directory reached.
+			 */
+			done = 1;
+			ll_release_page(page, 0);
+		} else if (1 /* chain is exhausted*/) {
+			/*
+			 * Normal case: continue to the next
+			 * page.
+			 */
+			ll_release_page(page,
+					le32_to_cpu(dp->ldp_flags) &
+					LDF_COLLIDE);
+			next = pos;
+			page = ll_get_dir_page(inode, pos,
+					       &chain);
+		} else {
+			/*
+			 * go into overflow page.
+			 */
+			LASSERT(le32_to_cpu(dp->ldp_flags) &
+				LDF_COLLIDE);
+			ll_release_page(page, 1);
 		}
 	}
 
-- 
1.7.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ