From patchwork Tue Aug 23 08:27:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 661740 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3sJNsP2629z9s2k for ; Tue, 23 Aug 2016 18:29:45 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=walle.cc header.i=@walle.cc header.b=SqU3hjKz; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 26101A7537; Tue, 23 Aug 2016 10:29:25 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0hKYNbY0_PdZ; Tue, 23 Aug 2016 10:29:25 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C00FFA752A; Tue, 23 Aug 2016 10:29:16 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DEB344BA3B for ; Tue, 23 Aug 2016 10:29:06 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oE-7p03assJx for ; Tue, 23 Aug 2016 10:29:06 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from ssl.serverraum.org (ssl.serverraum.org [213.133.101.245]) by theia.denx.de (Postfix) with ESMTPS id 7AA924B68A for ; Tue, 23 Aug 2016 10:29:03 +0200 (CEST) Received: from mwalle01.kse.adk.loc (unknown [194.25.174.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 8185822486; Tue, 23 Aug 2016 10:29:01 +0200 (CEST) Authentication-Results: ssl.serverraum.org; dmarc=none header.from=walle.cc DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1471940941; bh=9DUYOO7ETHV6PdWN8kYobb+gVQ9nbZfaM02zsnMzCw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SqU3hjKz3wLJRV30rdPZZ7skq+3dU7S/mdWaCfXoL30D2Sa7nhh1gS2oaAAPsBHlc AQsg2zN+RM8UToRb/juOUJL8LbD3MOKl/4roM83DPSwQkHdaUxEe+IS49fIln69HpR aU2cykqp3OrozHLWYh9muBke6FaCS+Hck0pm+QMQ= From: Michael Walle To: Tom Rini Date: Tue, 23 Aug 2016 10:27:42 +0200 Message-Id: <1471940862-6663-6-git-send-email-michael@walle.cc> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1471940862-6663-1-git-send-email-michael@walle.cc> References: <1471940862-6663-1-git-send-email-michael@walle.cc> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at web X-Virus-Status: Clean X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on web.serverraum.org Cc: u-boot@lists.denx.de, thomas.schaefer@kontron.com Subject: [U-Boot] [PATCH v2 5/5] ext4: optimize direntlen loops X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" direntlen is always >= 8. Therefore, the loop condition is always true. Signed-off-by: Michael Walle Suggested-by: Stefan BrĂ¼ns --- 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