File 1-blocksize.patch of Package rdiff-backup

diff -Nur rdiff-backup-1.2.8-orif//rdiff_backup/Rdiff.py rdiff-backup-1.2.8//rdiff_backup/Rdiff.py
--- rdiff-backup-1.2.8-orif//rdiff_backup/Rdiff.py	2009-03-16 15:36:21.000000000 +0100
+++ rdiff-backup-1.2.8//rdiff_backup/Rdiff.py	2015-12-20 07:06:27.000000000 +0100
@@ -26,8 +26,8 @@
 def get_signature(rp, blocksize = None):
 	"""Take signature of rpin file and return in file object"""
 	if not blocksize: blocksize = find_blocksize(rp.getsize())
-	log.Log("Getting signature of %s with blocksize %s" %
-			(rp.get_indexpath(), blocksize), 7)
+	log.Log("Getting signature of %s with blocksize %s, filesize=%s" %
+			(rp.get_indexpath(), blocksize, rp.getsize()), 7)
 	return librsync.SigFile(rp.open("rb"), blocksize)
 
 def find_blocksize(file_len):
@@ -39,8 +39,13 @@
 
 	"""
 	if file_len < 4096: return 64 # set minimum of 64 bytes
-	else: # Use square root, rounding to nearest 16
+	elif file_len < 1024*1024*1024: 
+		# Use square root, rounding to nearest 16 for files less than 1GB
 		return long(pow(file_len, 0.5)/16)*16
+	else:  
+		# Use a blocksize-multiple for files >1 GB (this is great for RAID), 
+		# and align to 16 bytes (though it probably already is)
+		return long( long((pow(file_len, 0.5)/Globals.blocksize)+1)*Globals.blocksize / 16 ) * 16
 
 def get_delta_sigfileobj(sig_fileobj, rp_new):
 	"""Like get_delta but signature is in a file object"""
openSUSE Build Service is sponsored by