public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 5/5] ext4: optimize direntlen loops
Date: Tue, 23 Aug 2016 10:27:42 +0200	[thread overview]
Message-ID: <1471940862-6663-6-git-send-email-michael@walle.cc> (raw)
In-Reply-To: <1471940862-6663-1-git-send-email-michael@walle.cc>

direntlen is always >= 8. Therefore, the loop condition is always true.

Signed-off-by: Michael Walle <michael@walle.cc>
Suggested-by: Stefan Br?ns <stefan.bruens@rwth-aachen.de>
---
 fs/ext4/ext4_common.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
index 4a003cf..9430a3b 100644
--- a/fs/ext4/ext4_common.c
+++ b/fs/ext4/ext4_common.c
@@ -420,7 +420,7 @@ restart:
 		goto fail;
 	dir = (struct ext2_dirent *)root_first_block_buffer;
 	totalbytes = 0;
-	while (le16_to_cpu(dir->direntlen) > 0) {
+	while (true) {
 		/*
 		 * blocksize-totalbytes because last directory length
 		 * i.e. dir->direntlen is free availble space in the
@@ -560,7 +560,7 @@ static int search_dir(struct ext2_inode *parent_inode, char *dirname)
 		dir = (struct ext2_dirent *)block_buffer;
 		ptr = (char *)dir;
 		totalbytes = 0;
-		while (le16_to_cpu(dir->direntlen) >= 0) {
+		while (true) {
 			/*
 			 * blocksize-totalbytes because last directory
 			 * length i.e.,*dir->direntlen is free availble
@@ -806,7 +806,7 @@ static int check_filename(char *filename, unsigned int blknr)
 	dir = (struct ext2_dirent *)root_first_block_buffer;
 	ptr = (char *)dir;
 	totalbytes = 0;
-	while (le16_to_cpu(dir->direntlen) >= 0) {
+	while (true) {
 		/*
 		 * blocksize-totalbytes because last
 		 * directory length i.e., *dir->direntlen
-- 
2.1.4

  parent reply	other threads:[~2016-08-23  8:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-23  8:27 [U-Boot] [PATCH v2 0/5] ext4: endianess fixes Michael Walle
2016-08-23  8:27 ` [U-Boot] [PATCH v2 1/5] ext4: change structure fields to __le/__be types Michael Walle
2016-08-23  8:27 ` [U-Boot] [PATCH v2 2/5] ext4: use kernel names for byte swaps Michael Walle
2016-08-23  8:27 ` [U-Boot] [PATCH v2 3/5] ext4: fix endianess problems in ext4 write support Michael Walle
2016-08-23  8:27 ` [U-Boot] [PATCH v2 4/5] ext4: fix wrong usage of le32_to_cpu() Michael Walle
2016-08-23  8:27 ` Michael Walle [this message]
2016-08-28 20:55   ` [U-Boot] [PATCH v2 5/5] ext4: optimize direntlen loops Stefan Bruens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1471940862-6663-6-git-send-email-michael@walle.cc \
    --to=michael@walle.cc \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox