diff --git a/.travis.yml b/.travis.yml index d673c15..c17af8b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,10 +12,9 @@ script: - make test QUIET=1 # run tests with a few different configurations - - CFLAGS="-DLFS_READ_SIZE=1 -DLFS_PROG_SIZE=1" make test QUIET=1 - - CFLAGS="-DLFS_READ_SIZE=512 -DLFS_PROG_SIZE=512" make test QUIET=1 - - CFLAGS="-DLFS_BLOCK_COUNT=1023" make test QUIET=1 - - CFLAGS="-DLFS_LOOKAHEAD=2048" make test QUIET=1 + - CFLAGS="-DLFS_READ_SIZE=1 -DLFS_PROG_SIZE=1" make test QUIET=1 + - CFLAGS="-DLFS_READ_SIZE=512 -DLFS_PROG_SIZE=512" make test QUIET=1 + - CFLAGS="-DLFS_BLOCK_COUNT=1023 -DLFS_LOOKAHEAD=2048" make test QUIET=1 # self-host with littlefs-fuse for fuzz test - make -C littlefs-fuse diff --git a/lfs.c b/lfs.c index ea116d2..2d0e331 100644 --- a/lfs.c +++ b/lfs.c @@ -2040,8 +2040,8 @@ int lfs_mount(lfs_t *lfs, const struct lfs_config *cfg) { } // setup free lookahead - lfs->free.begin = -lfs->cfg->lookahead; - lfs->free.off = lfs->cfg->lookahead; + lfs->free.begin = -lfs_min(lfs->cfg->lookahead, lfs->cfg->block_count); + lfs->free.off = -lfs->free.begin; lfs->free.end = lfs->free.begin + lfs->free.off + lfs->cfg->block_count; // load superblock