Cleaned up block allocator

Removed scanning for stride
- Adds complexity with questionable benefit
- Can be added as an optimization later

Fixed handling around device boundaries and where lookahead may not be a
factor of the device size (consider small devices with only a few
blocks)

Added support for configuration with optional dynamic memory as found in
the caching configuration
This commit is contained in:
Christopher Haster
2017-04-22 14:56:12 -05:00
parent 7050922623
commit aa872657d2
4 changed files with 92 additions and 95 deletions

View File

@@ -70,6 +70,10 @@ uintmax_t res;
#define LFS_BLOCK_COUNT 1024
#endif
#ifndef LFS_LOOKAHEAD
#define LFS_LOOKAHEAD 128
#endif
const struct lfs_config cfg = {{
.context = &bd,
.read = &lfs_emubd_read,
@@ -81,6 +85,7 @@ const struct lfs_config cfg = {{
.prog_size = LFS_PROG_SIZE,
.block_size = LFS_BLOCK_SIZE,
.block_count = LFS_BLOCK_COUNT,
.lookahead = LFS_LOOKAHEAD,
}};