problem / observed effect
It seems that the page cache ignores block devices which are not opened. And worse: Reads from device mapper (DM) devices which use a cached device are not cached at all (unless opened).
I use this command (in repetition) for testing:
time dd if=/dev/sda11 of=/dev/null bs=50M count=1
sda11 is opened for reading (
exec 4</dev/sda11), mounted or part of a device mapper device (
echo "0 1427456 linear /dev/sda11 0" | dmsetup create cache1) then the cache works.
But if I create /dev/mapper/cache1 on top of sda11 neither the first read nor the second one comes from the cache (if it is not opened somehow).
The reason why I am doing this: I have an encrypted volume and booting my (KDE) system takes quite a while. I do some manual preparations before I open the encrypted volume thus I thought I might use this time for reading from the encrypted device (LVM) in order to speed up the KDE start. But for the mentioned caching problem this is of no use.
Is there any trick to read from the LV in a way that the later created DM crypto device reads from it through the (filled) cache?