Index: Rdiff.py =================================================================== RCS file: /sources/rdiff-backup/rdiff-backup/rdiff_backup/Rdiff.py,v retrieving revision 1.15 diff -u -r1.15 Rdiff.py --- Rdiff.py 4 Nov 2005 22:41:13 -0000 1.15 +++ Rdiff.py 3 Jan 2011 03:27:12 -0000 @@ -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"""