Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue with immediate exhaustion and small unaligned storage
This was a small hole in the logic that handles initializing the lookahead buffer. To imitate exhaustion (so the block allocator will trigger a scan), the lookahead buffer is rewound a full lookahead and set up to look like it is exhausted. However, unlike normal allocation, this rewind was not kept aligned to a multiple of the scan size, which is limited by both the lookahead buffer and the total storage size. This bug went unnoticed for so long because it only causes problems when the block device is both: 1. Not aligned to the lookahead buffer (not a power of 2) 2. Smaller than the lookahead buffer While this seems like a strange corner case for a block device, this turned out to be very common for internal flash, especially when a handleful of blocks are reserved for code.
- Loading branch information