From patchwork Sun Apr 24 03:40:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baidu Boy X-Patchwork-Id: 92635 X-Patchwork-Delegate: dzu@denx.de 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 8142EB6FBD for ; Sun, 24 Apr 2011 13:41:14 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 39C132809E; Sun, 24 Apr 2011 05:41:13 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 0NzMb52gMs77; Sun, 24 Apr 2011 05:41:12 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BAFB4280A8; Sun, 24 Apr 2011 05:41:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 27663280A8 for ; Sun, 24 Apr 2011 05:41:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 sqOI9ULr72EV for ; Sun, 24 Apr 2011 05:41:09 +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 mail-pz0-f44.google.com (mail-pz0-f44.google.com [209.85.210.44]) by theia.denx.de (Postfix) with ESMTPS id 047A12809E for ; Sun, 24 Apr 2011 05:41:06 +0200 (CEST) Received: by pzk30 with SMTP id 30so921370pzk.3 for ; Sat, 23 Apr 2011 20:41:05 -0700 (PDT) Received: by 10.142.234.9 with SMTP id g9mr1600766wfh.101.1303616465423; Sat, 23 Apr 2011 20:41:05 -0700 (PDT) Received: from LENOVOE5CA6843 ([121.229.190.251]) by mx.google.com with ESMTPS id z10sm5963873wfj.12.2011.04.23.20.41.01 (version=SSLv3 cipher=OTHER); Sat, 23 Apr 2011 20:41:04 -0700 (PDT) From: "Baidu Liu" To: , Date: Sun, 24 Apr 2011 11:40:04 +0800 Message-ID: <002101cc0231$704847e0$6401a8c0@LENOVOE5CA6843> MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcwCMUxXIrp6uPZ1QwaBzcKWVFoi9w== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3664 Subject: [U-Boot] [PATCH 6/7] JFFS2: scanning performance improvement X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 1/ Sync with kernel. If the 256-(struct jffs2_unknown_node *) bytes are 0xff after the cleanmarker. We get the conclusion that the sector is empty. Signed-off-by: Baidu Liu --- fs/jffs2/jffs2_1pass.c | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c index 62ba250..bbfab2c 100644 --- a/fs/jffs2/jffs2_1pass.c +++ b/fs/jffs2/jffs2_1pass.c @@ -1596,16 +1596,14 @@ jffs2_1pass_build_lists(struct part_info * part) if (*(uint32_t *)(&buf[ofs-buf_ofs]) == 0xffffffff) { uint32_t inbuf_ofs; - uint32_t empty_start, scan_end; + uint32_t empty_start; empty_start = ofs; ofs += 4; - scan_end = min_t(uint32_t, EMPTY_SCAN_SIZE( - part->sector_size)/8, - buf_len); + more_empty: inbuf_ofs = ofs - buf_ofs; - while (inbuf_ofs < scan_end) { + while (inbuf_ofs < buf_len) { if (*(uint32_t *)(&buf[inbuf_ofs]) != 0xffffffff) goto scan_more; @@ -1615,6 +1613,15 @@ jffs2_1pass_build_lists(struct part_info * part) } /* Ran off end. */ + /* If we're only checking the beginning of a block with a cleanmarker, + bail now */ + if((buf_ofs == sector_ofs) && + (empty_start == sector_ofs +sizeof(struct jffs2_unknown_node))) { + printf("%d bytes at start of block seems clean... assuming all clean\n", + EMPTY_SCAN_SIZE(part->sector_size)); + break; + } + /* See how much more there is to read in this * eraseblock... */ @@ -1629,12 +1636,12 @@ jffs2_1pass_build_lists(struct part_info * part) */ break; } - scan_end = buf_len; get_fl_mem((u32)part->offset + ofs, buf_len, buf); buf_ofs = ofs; goto more_empty; } + if (node->magic != JFFS2_MAGIC_BITMASK || !hdr_crc(node)) { ofs += 4;