Import changes from Joshua Charles Campbell <joshua2@ualberta.ca>,
found in joshua-perf-fixes branch.

- Handle partial writes in csum_whole_file
  - Fix a bug in the original patch where we didn't catch EOF properly (Mark)

Signed-off-by: Mark Fasheh <mfasheh@suse.de>