ReplicatedPG: don't rescan the local collection if we can avoid it

Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 664b589b05243b30a92ac3642958d56fb9144e3d)

Conflicts:
	src/osd/ReplicatedPG.cc
ReplicatedPG: remove the other backfill related flushes

Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 1f50750d0fd94ffddc14f3d7a1e95fa4449aa1b8)

Conflicts:
	src/osd/ReplicatedPG.cc
ReplicatedPG::prepare_transaction: info.last_backfill is inclusive

Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 0a9a2d7b9c4013631e5e7d4b34bacaa4ec782147)
PG::BackfillInterval: use trim() in pop_front()

Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 46dfd9197548a9d7cf4e5aa86497d73d8cc5d6ae)
PG::BackfillInfo: introduce trim_to

We'll use this to trim off last_backfill_started since it'll
often be included in rescans.

Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 8774f03d39b061bc1e811ee8af9d49108f0443c1)
PG,ReplicatedPG: remove the waiting_for_backfill_peer mechanism

See previous patch.

Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 6f975e35a1e29a01347e4a6709b54a0422e063dd)

The referenced previous patch is actually irrelevant to this backport.

Conflicts:
	src/osd/ReplicatedPG.cc
ReplicatedPG: replace backfill_pos with last_backfill_started

last_backfill_started reflects what pinfo.last_backfill will be
once all currently outstanding backfills complete.  backfill_pos
was tricky since we couldn't correctly inialize it without
doing the first backfill scan pair.

In recover_backfill, we rescan from last_backfill_started rather
than from backfill_pos.  This ensures that we capture all clones
created between last_backfill_started and what previously had been
backfill_pos without special handling in make_writeable.  The main
downside is that we will tend to "rescan" last_backfill_started.

Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 9ec35d5ccf6a86c380865c7fc96017a1f502560a)

Conflicts:
	src/osd/ReplicatedPG.cc
Revert "ReplicatedPG::recover_backfill: do not update last_backfill prematurely"

I'm going to backport the full version of this patch.

This reverts commit d4e67ff3037a3cc7ae2ecc9e1d8d086c45ae515a.
ReplicatedPG: recover_backfill: don't prematurely adjust last_backfill

We can't adjust last_backfill to object x until x has been fully
backfilled.  pending_backfill_updates contains all those backfills
started, but which have not yet been reflected in pinfo.last_update.
backfills_in_flight contains those backfills which have not yet
completed.  Thus, we can adjust last_update to the largest entry
in pending_backfill_updates not in backfills_in_flight.

Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 4139e75d63b0503dbb7fea8036044eda5e8b7cf1)
ReplicatedPG::recover_backfill: update last_backfill to max() when backfill is complete

Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 7a06a71e0f2023f66d003dfb0168f4fe51eaa058)
osd: Fix problems in ReplicatedPG::do_op() logic

Fix assert(is_degraded_object(soid)) in ReplicatedPG::wait_for_degraded_object()
  Use last_backfill_started as the backfill line
  Handle uncommon case of multi op source after backfill line and target before
  backfill line and !is_degraded_object().
  Include backfill line itself for before_backfill (<= instead of <)

Signed-off-by: David Zafman <david.zafman@inktank.com>
(cherry picked from commit 7837490a9d5fc467a2cc25400f94979d8d4b4d8e)
ReplicatedPG::do_op: remove unused backfill_target_info

Not removed in previous backported patch.

Signed-off-by: Samuel Just <sam.just@inktank.com>
Merge pull request #2919 from athanatos/wip-8595

Wip 8595