[U-Boot] [RFC PATCH 0/2] simple cache layer for block devices

Eric Nelson eric at nelint.com
Wed Mar 16 22:40:22 CET 2016


Here's an example of a very simple cache for block devices that 
will prevent duplicate back-to-back reads from the same block
device.

By itself, this is sufficient to speed reads of certain files from
ext4 by 30x as described in this thread.

The areas I think could benefit most from some level of block cache
in U-Boot are:
	- reads from partition tables
	- directory searches

Having more than one cache entry is probably better for both of
those, but I'd like to get some feedback first.

The implementation explicitly prevents reads of more than
8 blocks to prevent slowing down the most speed-critical operations
(reading files) and I'm not sure this is the right choice of size.

The small size limit also prevents the overhead in the interface to
cache_block_fill() from being a problem. A more robust approach would
allow the cache to take over previously allocated blocks, but this
would also be more invasive, since some cacheable blocks are currently
allocated on the stack.

Eric Nelson (2):
  add block device cache
  mmc: add support for block device cache

 drivers/block/Makefile      |  1 +
 drivers/block/cache_block.c | 76 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/mmc/mmc.c           | 10 +++++-
 drivers/mmc/mmc_write.c     |  7 +++++
 include/part.h              | 65 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 158 insertions(+), 1 deletion(-)
 create mode 100644 drivers/block/cache_block.c

-- 
2.6.2



More information about the U-Boot mailing list