summaryrefslogtreecommitdiff
path: root/fs/jffs2/jffs2_1pass.c
diff options
context:
space:
mode:
authorIlya Yanok <yanok@emcraft.com>2008-11-13 19:49:36 +0300
committerWolfgang Denk <wd@denx.de>2008-12-09 23:40:01 +0100
commit142a80ffc3b537a9c45acd2444a42a77f147c602 (patch)
treecb22a30ea0d51db8d94a7740aa2e34c0fff0984f /fs/jffs2/jffs2_1pass.c
parent9b7076229ec6a958bd835ab70745f7676297ce82 (diff)
downloadu-boot-imx-142a80ffc3b537a9c45acd2444a42a77f147c602.zip
u-boot-imx-142a80ffc3b537a9c45acd2444a42a77f147c602.tar.gz
u-boot-imx-142a80ffc3b537a9c45acd2444a42a77f147c602.tar.bz2
jffs2: cache data_crc results
As we moved data_crc() invocation from jffs2_1pass_build_lists() to jffs2_1pass_read_inode() data_crc is going to be calculated on each inode access. This patch adds caching of data_crc() results. There is no significant improvement in speed (because of flash access caching added in previous patch I think, crc in RAM is really fast) but this patch impacts memory usage -- every b_node structure uses 12 bytes instead of 8. Signed-off-by: Alexey Neyman <avn@emcraft.com> Signed-off-by: Ilya Yanok <yanok@emcraft.com>
Diffstat (limited to 'fs/jffs2/jffs2_1pass.c')
-rw-r--r--fs/jffs2/jffs2_1pass.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 4e49a05..be7c1a1 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -765,7 +765,10 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char *dest)
put_fl_mem(jNode, pL->readbuf);
continue;
}
- if (!data_crc(jNode)) {
+ if (b->datacrc == CRC_UNKNOWN)
+ b->datacrc = data_crc(jNode) ?
+ CRC_OK : CRC_BAD;
+ if (b->datacrc == CRC_BAD) {
put_fl_mem(jNode, pL->readbuf);
continue;
}