block/block-copy: specialcase first copy_range request
commit9d31bc53facf53d6f817c2472d4d0485d7bc5d8e
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Wed, 11 Mar 2020 10:29:58 +0000 (11 13:29 +0300)
committerMax Reitz <mreitz@redhat.com>
Wed, 11 Mar 2020 11:42:30 +0000 (11 12:42 +0100)
treef5664ec777184ac0309d168b3fc7d1dbca7c7eb5
parentd0ebeca14a585f352938062ef8ddde47fe4d39f9
block/block-copy: specialcase first copy_range request

In block_copy_do_copy we fallback to read+write if copy_range failed.
In this case copy_size is larger than defined for buffered IO, and
there is corresponding commit. Still, backup copies data cluster by
cluster, and most of requests are limited to one cluster anyway, so the
only source of this one bad-limited request is copy-before-write
operation.

Further patch will move backup to use block_copy directly, than for
cases where copy_range is not supported, first request will be
oversized in each backup. It's not good, let's change it now.

Fix is simple: just limit first copy_range request like buffer-based
request. If it succeed, set larger copy_range limit.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200311103004.7649-4-vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/block-copy.c