mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 16:14:16 +01:00 
			
		
		
		
	The idea is pretty simple: The revision count for each metadata block only really needs 3 distinct states. The additional bit-width of the revision count is available for other information. In this case, we can sum all revision counts in the filesystem to encode state that can be updated for free during any metadata block update. The obvious state to store first is if the filesystem is in a bad state that requires a deorphan step. The allows us to sidestep the expensive O(n^2) operation for the O(n) sum in the much more common case. This patch adds the following rule: If the sum of all revision count is odd, the filesystem was caught mid-operation and must be deorphaned.
		
			
				
	
	
	
		
			62 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			62 KiB