OSDN Git Service

mirror: Don't extend the last sub-chunk
authorFam Zheng <famz@redhat.com>
Wed, 20 Apr 2016 02:48:34 +0000 (10:48 +0800)
committerKevin Wolf <kwolf@redhat.com>
Wed, 20 Apr 2016 14:52:55 +0000 (16:52 +0200)
commit4150ae60ebf9445d853186c72cf33383710f7360
treedac1b789fc149a7d5de94a20993b9550de6af0f9
parentf27a27425901bacc69fb579e1dd8a5878eadd6e9
mirror: Don't extend the last sub-chunk

The last sub-chunk is rounded up to the copy granularity in the target
image, resulting in a larger size than the source.

Add a function to clip the copied sectors to the end.

This undoes the "wrong" changes to tests/qemu-iotests/109.out in
e5b43573e28. The remaining two offset changes are okay.

[ kwolf: Use DIV_ROUND_UP to calculate nb_chunks now ]

Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
block/mirror.c
tests/qemu-iotests/109.out