[U-Boot] [PATCH 0/3] Add cache for block devices

Eric Nelson eric at nelint.com
Sun Mar 27 21:00:12 CEST 2016


Patch 1 is the block cache implementation.

Patches 2 and 3 update the mmc and sata commands to use the new
blk_dread/dwrite/derase routines and can be applied separately.

Notable changes since the V2 RFC patch set include:
	- renaming of files and routines to use "blkcache" rather
	than "cache_block" to make things consistent with the
	command name.

	- implemented through the blk_dread/dwrite/derase routines
	in blk.h instead of drivers/mmc.

	- added detection of device (re)initialization in disk/part.c

	- changed the default max blocks/entry and entries to
	2 and 32 respectively based on further testing.

	- changed to sub-command implementation as suggested by
	Stephen Warren.

	- changed interface to cache_find per Stephen's suggestion

I tested with and without DM and compile-tested with CONFIG_BLK
enabled, but only on MMC and USB devices.

As a teaser, here are some performance numbers loading a 5MiB file
from SD card.

With cache:
	=> blkc max 2 32                            
	changed to max of 32 entries of 2 blocks each
	=> load mmc 0:2 10008000 /usr/lib/libGAL.so
	5042083 bytes read in 251 ms (19.2 MiB/s)

Without cache:
	=> blkc max 0 0                            
	changed to max of 0 entries of 0 blocks each
	=> load mmc 0:2 10008000 /usr/lib/libGAL.so
	5042083 bytes read in 4638 ms (1 MiB/s)

Eric Nelson (3):
  drivers: block: add block device cache
  mmc: force mmc command to go through block layer
  sata: force sata reads and writes to go through block layer

 cmd/mmc.c                  |   7 +-
 cmd/sata.c                 |   6 +-
 disk/part.c                |   2 +
 drivers/block/Kconfig      |  20 ++++
 drivers/block/Makefile     |   1 +
 drivers/block/blk-uclass.c |  13 +-
 drivers/block/blkcache.c   | 293 +++++++++++++++++++++++++++++++++++++++++++++
 include/blk.h              |  79 +++++++++++-
 8 files changed, 414 insertions(+), 7 deletions(-)
 create mode 100644 drivers/block/blkcache.c

-- 
2.6.2



More information about the U-Boot mailing list