From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko Schocher invitel Date: Tue, 30 Jun 2015 11:16:29 +0200 Subject: [U-Boot] [PATCH 7/8] JFFS2: Use CLEANMARKER to reduce scanning time In-Reply-To: <1435554149-18042-8-git-send-email-mark.tomlinson@alliedtelesis.co.nz> References: <1435554149-18042-1-git-send-email-mark.tomlinson@alliedtelesis.co.nz> <1435554149-18042-8-git-send-email-mark.tomlinson@alliedtelesis.co.nz> Message-ID: <55925E6D.40508@invitel.hu> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Mark, Am 29.06.2015 um 07:02 schrieb Mark Tomlinson: > If a sector has a CLEANMARKER at the beginning, it indicates that the > entire sector has been erased. Therefore, if this is found, we can skip the > entire block. This was not being done before this patch. > > The code now does the same as the kernel does when encountering a > CLEANMARKER. It still checks that the next few words are FFFFFFFF, and if > so, the block is assumed to be empty, and so is skipped. > > Signed-off-by: Mark Tomlinson > --- > > fs/jffs2/jffs2_1pass.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) Beside of your comment style Reviewed-by: Heiko Schocher bye, Heiko > > diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c > index d78fb06..26a748f 100644 > --- a/fs/jffs2/jffs2_1pass.c > +++ b/fs/jffs2/jffs2_1pass.c > @@ -1520,6 +1520,8 @@ jffs2_1pass_build_lists(struct part_info * part) > uint32_t sumlen; > int ret; > #endif > + /* Indicates a sector with a CLEANMARKER was found */ > + int clean_sector = 0; > > /* Set buf_size to maximum length */ > buf_size = DEFAULT_EMPTY_SCAN_SIZE; > @@ -1643,6 +1645,13 @@ jffs2_1pass_build_lists(struct part_info * part) > ofs += 4; > } > /* Ran off end. */ > + /* If this sector had a clean marker at the > + * beginning, and immediately following this > + * have been a bunch of FF bytes, treat the > + * entire sector as empty. > + */ > + if (clean_sector) > + break; > > /* See how much more there is to read in this > * eraseblock... > @@ -1664,6 +1673,10 @@ jffs2_1pass_build_lists(struct part_info * part) > buf_ofs = ofs; > goto more_empty; > } > + /* Found something not erased in the sector, so reset > + * the 'clean_sector' flag. > + */ > + clean_sector = 0; > if (node->magic != JFFS2_MAGIC_BITMASK || > !hdr_crc(node)) { > ofs += 4; > @@ -1745,6 +1758,15 @@ jffs2_1pass_build_lists(struct part_info * part) > "%d != %zu\n", > node->totlen, > sizeof(struct jffs2_unknown_node)); > + if ((node->totlen == > + sizeof(struct jffs2_unknown_node)) && > + (ofs == sector_ofs)) { > + /* Found a CLEANMARKER at the beginning > + * of the sector. It's in the correct > + * place with correct size and CRC. > + */ > + clean_sector = 1; > + } > break; > case JFFS2_NODETYPE_PADDING: > if (node->totlen < sizeof(struct jffs2_unknown_node)) >