loader: bcache read ahead block count should take account the large sectors
The loader bcache is implementing simple read-ahead to boost the cache. The bcache is built based on 512B block sizes, and the read ahead is attempting to read number of cache blocks, based on amount of the free bcache space.
However, there are devices using larger sector sizes than 512B, most obviously the CD media is based on 2k sectors. This means the read-ahead can not be just random
number of blocks, but we should use value suitable also for use with larger sectors, as for example, with CD devices, we should read multiple of 2KB. Since the sector size from disk interface is not too reliable, i guess we can just use "good enough" value, so the implementation is rounding down the read ahead block count to be multiple of 16.
This means we have covered sector sizes to 8k.
In addition, the update does implement the end of cache marker, to help to detect the possible memory corruption - I have not seen it happening so far, but it does not hurt to have the detection mechanism in place.
Updated by Electric Monk over 6 years ago
- Status changed from In Progress to Closed
- % Done changed from 90 to 100
commit 07542513a22e67a23ccdd5f4a1de31070776900a Author: Toomas Soome <firstname.lastname@example.org> Date: 2017-02-14T17:32:21.000Z 7769 loader: bcache read ahead block count should take account the large sectors Reviewed by: Robert Mustacchi <email@example.com> Reviewed by: Gordon Ross <firstname.lastname@example.org> Approved by: Hans Rosenfeld <email@example.com>