It'd be nice to have tests showing what block sizes we get from running this function against various values for the inputs, to ensure we don't hit any pathological cases. Graphs would help. Alternatively, or in conjunction with this, graphs of block size changes vs disk activity during performance tests would probably be informative. I'm sure you've thought of this and have all sorts of tuning tests planned, just adding some emphasis.