mirror of
				https://github.com/Zygo/bees.git
				synced 2025-11-04 04:00:36 +01:00 
			
		
		
		
	bees: clean up #if 0 ... fsync ... #endif code
Remove some dead code because dedup-related deadlocks have not been observed since Linux kernel v4.11. Preserve rationale of remaining #if 0 block (why we do write/rename instead of write/fsync/rename) so that people don't try to replace the "missing" fsync() there. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
		@@ -173,13 +173,6 @@ BeesContext::dedup(const BeesRangePair &brp)
 | 
				
			|||||||
	brp.first.fd(shared_from_this());
 | 
						brp.first.fd(shared_from_this());
 | 
				
			||||||
	brp.second.fd(shared_from_this());
 | 
						brp.second.fd(shared_from_this());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if 0
 | 
					 | 
				
			||||||
	// This avoids some sort of kernel race condition;
 | 
					 | 
				
			||||||
	// however, it also doubles our dedup times.
 | 
					 | 
				
			||||||
	// Is avoiding a crash every few weeks worth it?
 | 
					 | 
				
			||||||
	bees_sync(brp.first.fd());
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	BEESTOOLONG("dedup " << brp);
 | 
						BEESTOOLONG("dedup " << brp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BeesAddress first_addr(brp.first.fd(), brp.first.begin());
 | 
						BeesAddress first_addr(brp.first.fd(), brp.first.begin());
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -416,6 +416,12 @@ BeesStringFile::write(string contents)
 | 
				
			|||||||
		// This triggers too many btrfs bugs.  I wish I was kidding.
 | 
							// This triggers too many btrfs bugs.  I wish I was kidding.
 | 
				
			||||||
		// Forget snapshots, balance, compression, and dedup:
 | 
							// Forget snapshots, balance, compression, and dedup:
 | 
				
			||||||
		// the system call you have to fear on btrfs is fsync().
 | 
							// the system call you have to fear on btrfs is fsync().
 | 
				
			||||||
 | 
							// Also note that when bees renames a temporary over an
 | 
				
			||||||
 | 
							// existing file, it flushes the temporary, so we get
 | 
				
			||||||
 | 
							// the right behavior if we just do nothing here
 | 
				
			||||||
 | 
							// (except when the file is first created; however,
 | 
				
			||||||
 | 
							// in that case the result is the same as if the file
 | 
				
			||||||
 | 
							// did not exist, was empty, or was filled with garbage).
 | 
				
			||||||
		BEESNOTE("fsyncing " << tmpname << " in " << name_fd(m_dir_fd));
 | 
							BEESNOTE("fsyncing " << tmpname << " in " << name_fd(m_dir_fd));
 | 
				
			||||||
		DIE_IF_NON_ZERO(fsync(ofd));
 | 
							DIE_IF_NON_ZERO(fsync(ofd));
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user