sparse_copy creates output file that is smaller than input
file when input file ends with unmapped blocks.
Used truncate(<input file size>) when output file is created
to ensure the size of output file will always be equal to
the size of input file.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
dst_file = open(dst_fname, 'r+b')
except IOError:
dst_file = open(dst_fname, 'wb')
+ dst_file.truncate(os.path.getsize(src_fname))
for first, last in fmap.get_mapped_ranges(0, fmap.blocks_cnt):
start = first * fmap.block_size