From 8e5ebf8421f59756a596da2bd3ba19ec856f48b9 Mon Sep 17 00:00:00 2001 From: xieyangrun Date: Sat, 12 Sep 2020 16:32:48 +0800 Subject: [PATCH] https://github.com/geniusgogo/littlefs/commit/b5d27acbf965d5149e76407b04c2660ddcd0167e#diff-f760583e42c2270e40b514c73089180a --- dfs_lfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dfs_lfs.c b/dfs_lfs.c index 0a035b79..e121065d 100644 --- a/dfs_lfs.c +++ b/dfs_lfs.c @@ -236,7 +236,7 @@ static void _lfs_load_config(struct lfs_config* lfs_cfg, struct rt_mtd_nor_devic lfs_cfg->cache_size = LFS_CACHE_SIZE; lfs_cfg->block_cycles = LFS_BLOCK_CYCLES; - lfs_cfg->block_count = mtd_nor->block_end - mtd_nor->block_start; + lfs_cfg->block_count = (mtd_nor->block_end - mtd_nor->block_start) * mtd_nor->block_size / lfs_cfg->block_size; lfs_cfg->lookahead_size = 32 * ((lfs_cfg->block_count + 31) / 32); if (lfs_cfg->lookahead_size > LFS_LOOKAHEAD_MAX) @@ -524,7 +524,7 @@ static int _dfs_lfs_rename(struct dfs_filesystem* dfs, const char* from, const c RT_ASSERT(dfs != RT_NULL); RT_ASSERT(dfs->data != RT_NULL); - + lfs_dfs_lock(); dfs_lfs = (dfs_lfs_t*)dfs->data;