mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 08:42:40 +01:00 
			
		
		
		
	Merge pull request #490 from littlefs-project/fix-alloc-eviction
Fix allocation-eviction issue when erase state is multiple of block_cycles+1
This commit is contained in:
		
							
								
								
									
										8
									
								
								lfs.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								lfs.c
									
									
									
									
									
								
							| @@ -1460,8 +1460,12 @@ static int lfs_dir_alloc(lfs_t *lfs, lfs_mdir_t *dir) { | |||||||
|         return err; |         return err; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // make sure we don't immediately evict |     // to make sure we don't immediately evict, align the new revision count | ||||||
|     dir->rev += dir->rev & 1; |     // to our block_cycles modulus, see lfs_dir_compact for why our modulus | ||||||
|  |     // is tweaked this way | ||||||
|  |     if (lfs->cfg->block_cycles > 0) { | ||||||
|  |         dir->rev = lfs_alignup(dir->rev, ((lfs->cfg->block_cycles+1)|1)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     // set defaults |     // set defaults | ||||||
|     dir->off = sizeof(dir->rev); |     dir->off = sizeof(dir->rev); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user