librbd: skip zeroes when copying an image

This is the simple coarse-grained solution, but it works well in
common cases like a small base image resized with a bunch of empty
space at the end. Finer-grained sparseness can be copied by using rbd
{export,import}-diff.

Fixes: #6257
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
osd/PG: debug cached_removed_snaps changes

See #7915.

Signed-off-by: Sage Weil <sage@inktank.com>
Merge pull request #1575 from jdurgin/wip-librbd-cp-sparse

librbd: skip zeroes when copying an image

Reviewed-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: handle snapdir properly during scrub

Handle snapdir similarly to how head is treated when updating the
next_clone info.  Also, add a warning when we have a snapdir object and
head_exists == true (the converse of the existing check).

Fixes: #7937
Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: continue scrub logic when snapset.head_exists doesn't match

The 'continue' will cause more damange/noise than continuing because the
next_clone value won't be updated properly.

Signed-off-by: Sage Weil <sage@inktank.com>
PG: set role for replicated even if role != shard

Fixes: #7939
Signed-off-by: Samuel Just <sam.just@inktank.com>
osd/ReplicatedPG: mark_unrollbackable when _rollback_to head

We fell into the case in _rollback_to where we just set ctx->modify = true
and don't explicitly mark the ctx and unrollbackable.  Later, we screw up
in proc_replica_log as a result because we think we can rollback this
update to the head when in reality we cannot.

Fixes: #7907
Signed-off-by: Sage Weil <sage@inktank.com>
Merge remote-tracking branches 'origin/wip-7939', 'upstream/wip-7907' and 'upstream/wip-7937' into wip-sam-testing