summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>2015-07-01 16:38:28 +1200
committerTom Rini <trini@konsulko.com>2015-08-12 20:47:32 -0400
commit54a883840be500cbcda4903118dd571e4532e83f (patch)
tree69c06c7ebbcaac2d4ee75d7e2ab313b76512643b /fs
parent081adef7e61be60c1328098cd19cb5aa6ceda21f (diff)
downloadblackbird-obmc-uboot-54a883840be500cbcda4903118dd571e4532e83f.tar.gz
blackbird-obmc-uboot-54a883840be500cbcda4903118dd571e4532e83f.zip
JFFS2: Use CLEANMARKER to reduce scanning time
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 <mark.tomlinson@alliedtelesis.co.nz>
Diffstat (limited to 'fs')
-rw-r--r--fs/jffs2/jffs2_1pass.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index c55d472047..432579239d 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -1528,6 +1528,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;
@@ -1652,6 +1654,14 @@ 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...
@@ -1673,6 +1683,11 @@ 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;
@@ -1754,6 +1769,16 @@ 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))
OpenPOWER on IntegriCloud