]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
jffs2: cache data_crc results
authorIlya Yanok <yanok@emcraft.com>
Thu, 13 Nov 2008 16:49:36 +0000 (19:49 +0300)
committerWolfgang Denk <wd@denx.de>
Tue, 9 Dec 2008 22:40:01 +0000 (23:40 +0100)
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>
fs/jffs2/jffs2_1pass.c
fs/jffs2/jffs2_private.h

index 4e49a056694ec6b14a71eaadd0713e5ce3a0021b..be7c1a190b51a1c9aba5001886158fafae74df39 100644 (file)
@@ -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;
                                }
index 3633deaaf83cc2b26e8e72c179e7a42dfa3ec192..658b32521904c98eb0460f9760495402fd4a345d 100644 (file)
@@ -7,6 +7,7 @@
 struct b_node {
        u32 offset;
        struct b_node *next;
+       enum { CRC_UNKNOWN = 0, CRC_OK, CRC_BAD } datacrc;
 };
 
 struct b_list {