summaryrefslogtreecommitdiff
path: root/fs/ext4/ext4_write.c
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2019-01-30 12:58:05 -0700
committerTom Rini <trini@konsulko.com>2019-04-09 15:34:15 -0400
commitd5aee659f217746395ff58adf3a863627ff02ec1 (patch)
tree2d2db84b18244673371c5478fbb365560cdb071a /fs/ext4/ext4_write.c
parent4c24dab391003b99b1e0784fd41fe756cb07039e (diff)
downloadu-boot-d5aee659f217746395ff58adf3a863627ff02ec1.tar.gz
fs: ext4: cache extent data
When a file contains extents, U-Boot currently reads extent-related data for each block in the file, even if that data is located in the same block each time. This significantly slows down loading of files that use extents. Implement a very dumb cache to prevent repeatedly reading the same block. Files with extents now load as fast as files without. Note: There are many cases where read_allocated_block() is called. This patch only addresses one of those places; all others still read redundant data in any case they did before. This is a minimal patch to fix the load command; other cases aren't fixed. Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'fs/ext4/ext4_write.c')
-rw-r--r--fs/ext4/ext4_write.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ext4/ext4_write.c b/fs/ext4/ext4_write.c
index 4eb77c327e..95ffa3dfad 100644
--- a/fs/ext4/ext4_write.c
+++ b/fs/ext4/ext4_write.c
@@ -479,7 +479,7 @@ static int ext4fs_delete_file(int inodeno)
/* release data blocks */
for (i = 0; i < no_blocks; i++) {
- blknr = read_allocated_block(&inode, i);
+ blknr = read_allocated_block(&inode, i, NULL);
if (blknr == 0)
continue;
if (blknr < 0)
@@ -695,7 +695,7 @@ void ext4fs_deinit(void)
ext4fs_read_inode(ext4fs_root, EXT2_JOURNAL_INO,
&inode_journal);
blknr = read_allocated_block(&inode_journal,
- EXT2_JOURNAL_SUPERBLOCK);
+ EXT2_JOURNAL_SUPERBLOCK, NULL);
ext4fs_devread((lbaint_t)blknr * fs->sect_perblk, 0, fs->blksz,
temp_buff);
jsb = (struct journal_superblock_t *)temp_buff;
@@ -776,7 +776,7 @@ static int ext4fs_write_file(struct ext2_inode *file_inode,
long int blknr;
int blockend = fs->blksz;
int skipfirst = 0;
- blknr = read_allocated_block(file_inode, i);
+ blknr = read_allocated_block(file_inode, i, NULL);
if (blknr <= 0)
return -1;