diff options
author | Stephen Warren | 2019-01-30 12:58:05 -0700 |
---|---|---|
committer | Tom Rini | 2019-04-09 15:34:15 -0400 |
commit | d5aee659f217746395ff58adf3a863627ff02ec1 (patch) | |
tree | 2d2db84b18244673371c5478fbb365560cdb071a /include/ext4fs.h | |
parent | 4c24dab391003b99b1e0784fd41fe756cb07039e (diff) |
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 'include/ext4fs.h')
-rw-r--r-- | include/ext4fs.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/include/ext4fs.h b/include/ext4fs.h index 24210113411..4b5de6e7b63 100644 --- a/include/ext4fs.h +++ b/include/ext4fs.h @@ -117,6 +117,12 @@ struct ext_filesystem { struct blk_desc *dev_desc; }; +struct ext_block_cache { + char *buf; + lbaint_t block; + int size; +}; + extern struct ext2_data *ext4fs_root; extern struct ext2fs_node *ext4fs_file; @@ -146,11 +152,15 @@ int ext4fs_size(const char *filename, loff_t *size); void ext4fs_free_node(struct ext2fs_node *node, struct ext2fs_node *currroot); int ext4fs_devread(lbaint_t sector, int byte_offset, int byte_len, char *buf); void ext4fs_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info); -long int read_allocated_block(struct ext2_inode *inode, int fileblock); +long int read_allocated_block(struct ext2_inode *inode, int fileblock, + struct ext_block_cache *cache); int ext4fs_probe(struct blk_desc *fs_dev_desc, disk_partition_t *fs_partition); int ext4_read_file(const char *filename, void *buf, loff_t offset, loff_t len, loff_t *actread); int ext4_read_superblock(char *buffer); int ext4fs_uuid(char *uuid_str); +void ext_cache_init(struct ext_block_cache *cache); +void ext_cache_fini(struct ext_block_cache *cache); +int ext_cache_read(struct ext_block_cache *cache, lbaint_t block, int size); #endif |