osd/ReplicatedPG: use snapset helpers for rollback

Force a write of the snapset if we clone to rollback to ensure the
(even unmodified) SnapSet is written to the newly cloned head object.

Signed-off-by: Sage Weil <sage@redhat.com>
osd/ReplicatedPG: use snapset helpers in make_writeable

This is mostly mechanical, except we are more careful in the clone_overlap
logic to only update the SnapSet if the modified ranges actually change
things.

Signed-off-by: Sage Weil <sage@redhat.com>
osd/ReplicatedPG: force snapset update on copyfrom completion

Signed-off-by: Sage Weil <sage@redhat.com>
osd/ReplicatedPG: use snapset helpers for finish_promote

Signed-off-by: Sage Weil <sage@redhat.com>
osd/ReplicatedPG: force snapset write for hit_set_persist

We are creating a new object manually; make sure snapset is written.

Signed-off-by: Sage Weil <sage@redhat.com>
osd/ReplicatedPG: apply snapset helpers in finish_ctx

Make sure we write the snapset for a new object or when expclitly
requested.  Rejigger the attr encoding a bit since we don't know upfront
whether we will want to write it or not (if we do decide we need it,
encode it at the same time).  Note that !bss.empty() ==
should_write_snapset() is effectively the invariant we are after.

This is originally based on Xinze Chi <xmdxcxz@gmail.com>'s patch.

Signed-off-by: Sage Weil <sage@redhat.com>