[U-Boot] ext4 and caching

Eric Nelson eric at nelint.com
Wed Mar 16 19:42:55 CET 2016


	Hi all,

I've been seeing the same sort of issues repoted by Ionut
and as addressed by this patch:
	http://lists.denx.de/pipermail/u-boot/2014-January/171459.html

That patch was added in commit fc0fc50 and reverted in commit 715b56f.

It no longer applies cleanly, and when I tried to resurrect it,
I saw errors traversing directories and perhaps something went
wrong with my merge.

Ionut, do you have a current version of this patch?

When I looked a little further, I found that a read of a ~150 MiB
was around 30x slower than typical, and that the **same** 8 blocks
accounted for the majority of the reads.

In fact, these same blocks were read back-to-back.

The following is a quick picture of the output from a simple
printf in mmc_bread of the block number and count during a
load of the problem file.

~$ uniq -c < mmc_bread.log | sort -n
      1 mmc_bread: 0/1
      1 mmc_bread: 2293760/1
      1 mmc_bread: 2293762/2
      1 mmc_bread: 2293768/1
      1 mmc_bread: 2293768/1
      1 mmc_bread: 2293768/1
      1 mmc_bread: 2293768/1
      1 mmc_bread: 2295264/1
      1 mmc_bread: 2295270/1
      1 mmc_bread: 2295290/1
      1 mmc_bread: 2295645/1
      1 mmc_bread: 7536640/131072
      1 mmc_bread: 7667712/32768
      1 mmc_bread: 7700480/16384
      1 mmc_bread: 7729152/65536
      1 mmc_bread: 7798784/130722
      1 mmc_bread: 7929506/1
      1 mmc_init: 0, time 129
      2 mmc_bread: 0/1
      6 mmc_bread: 2359120/1
     10 mmc_bread: 2358752/1
     34 mmc_bread: 2358808/1
   2048 mmc_bread: 2557936/8
   4096 mmc_bread: 2557936/8
   8193 mmc_bread: 2557936/8
  16340 mmc_bread: 2557936/8
  16384 mmc_bread: 2557936/8

~$ sort < mmc_bread.log | uniq -c | sort -n | tail -n 1
  47061 mmc_bread: 2557936/8

In English, the 8 blocks starting at 2557936 are read
47061 times, and back to back in large (2k/4k/16k) bunches,
so a very simple **single** block cache of the last read
will fix the speed issue and I hacked something up to
verify that.

Is anybody else working on things in this area?

I think this is something that's probably easier to fix
at the block device level rather than within the ext4
filesystem code.

That said, the 2k/4k/16k bunches above may also indicate
a simpler fix in the ext4 code.

Please chime in with your thoughts.

Regards,


Eric Nelson


More information about the U-Boot mailing list