ext2fs: Fix optimization bug for doubly-indirect block pointers
authorAaron Pace <Aaron.Pace@alcatel-lucent.com>
Mon, 26 Jul 2010 20:24:44 +0000 (14:24 -0600)
committerWolfgang Denk <wd@denx.de>
Sat, 7 Aug 2010 20:44:08 +0000 (22:44 +0200)
Doubly-indirect block numbers are compared against the first-level
indirect block when checking for a cached copy.  This is causing the
doubly-indirect block to be re-read each time it is accessed.
Repairing this reduces load time for a 70M file from 72 seconds
to 38 seconds.

Signed-off-by: Aaron Pace <Aaron.Pace@alcatel-lucent.com>
fs/ext2/ext2fs.c

index 4b391d60a8fd0091f9e797401aca7b426c81a4c4..a88cf8704180261dc17559ca69d2ca3abbcbd203 100644 (file)
@@ -364,7 +364,7 @@ static int ext2fs_read_block (ext2fs_node_t node, int fileblock) {
                        indir2_size = blksz;
                }
                if ((__le32_to_cpu (indir1_block[rblock / perblock]) <<
-                    log2_blksz) != indir1_blkno) {
+                    log2_blksz) != indir2_blkno) {
                        status = ext2fs_devread (__le32_to_cpu(indir1_block[rblock / perblock]) << log2_blksz,
                                                 0, blksz,
                                                 (char *) indir2_block);