mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 16:14:16 +01:00 
			
		
		
		
	Fixed incorrect modulus in lfs_alloc_reset
Modulus of the offset by block_size was clearly a typo, and should be block_count. Interesting to note that later moduluses during alloc calculations prevents this from breaking anything, but as gtaska notes it could skew the wear-leveling distribution. Found by guiserle and gtaska
This commit is contained in:
		
							
								
								
									
										2
									
								
								lfs.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								lfs.c
									
									
									
									
									
								
							| @@ -459,7 +459,7 @@ static void lfs_alloc_ack(lfs_t *lfs) { | |||||||
| // Invalidate the lookahead buffer. This is done during mounting and | // Invalidate the lookahead buffer. This is done during mounting and | ||||||
| // failed traversals | // failed traversals | ||||||
| static void lfs_alloc_reset(lfs_t *lfs) { | static void lfs_alloc_reset(lfs_t *lfs) { | ||||||
|     lfs->free.off = lfs->seed % lfs->cfg->block_size; |     lfs->free.off = lfs->seed % lfs->cfg->block_count; | ||||||
|     lfs->free.size = 0; |     lfs->free.size = 0; | ||||||
|     lfs->free.i = 0; |     lfs->free.i = 0; | ||||||
|     lfs_alloc_ack(lfs); |     lfs_alloc_ack(lfs); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user