File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5234,8 +5234,8 @@ static int lfs_fs_gc_(lfs_t *lfs) {
52345234
52355235#ifndef LFS_READONLY
52365236#ifdef LFS_SHRINKNONRELOCATING
5237- static int lfs_shrink_checkblock (void * data , lfs_block_t block ) {
5238- lfs_size_t threshold = * ((lfs_size_t * ) data );
5237+ static int lfs_shrink_checkblock (void * data , lfs_block_t block ) {
5238+ lfs_size_t threshold = * ((lfs_size_t * ) data );
52395239 if (block >= threshold ) {
52405240 return LFS_ERR_NOTEMPTY ;
52415241 }
@@ -5256,10 +5256,11 @@ static int lfs_fs_grow_(lfs_t *lfs, lfs_size_t block_count) {
52565256 LFS_ASSERT (block_count >= lfs -> block_count );
52575257#endif
52585258#ifdef LFS_SHRINKNONRELOCATING
5259- lfs_block_t threshold = block_count ;
5260- err = lfs_fs_traverse_ (lfs , lfs_shrink_checkblock , & threshold , true);
5261- if (err ) {
5262- return err ;
5259+ if (block_count < lfs -> block_count ) {
5260+ err = lfs_fs_traverse_ (lfs , lfs_shrink_checkblock , & block_count , true);
5261+ if (err ) {
5262+ return err ;
5263+ }
52635264 }
52645265#endif
52655266
You can’t perform that action at this time.
0 commit comments