common: add an hobject_t::is_min() function

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: separate RWTracker's waitlist from getting locks

This way we can try and get locks which aren't associated with
an OpRequest.

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: implement the RWTracker mechanisms for backfill read locking

We want backfill to take read locks on the objects it's pushing. Add
a get_backfill_read(hobject_t) function, a corresponding drop_backfill_read(),
and a backfill_waiting_on_read member in ObjState. Check that member when
getting a write lock, and in put_write(). Tell callers to requeue the recovery
if necessary, and clean up the backfill block when its read lock is dropped.

Signed-off-by: Greg Farnum <greg@inktank.com>
PG: switch the start_recovery_ops interface to specify work to do as a param

We previously inferred whether there was useful work to be done
by looking at the number of ops started, but with the upcoming
introduction of the rw_manager read locking on backfill, we could
start no ops while still having work to do. Switch around the
interfaces to specify these as separate pieces of information.

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: take and drop read locks when doing backfill

All our interfaces are in place, so now we can actually take and
drop the locks.
1) Take locks in ReplicatedPG::recover_backfill. This is the entry
into the backfill code path, and covers all objects which are
added to backfills_in_flight (via prep_backfill_object_push()). If we
can't get the lock right away, we stop the backfill movement there
until we can do so.
2) Drop the locks in ReplicatedPG::on_peer_recover(), called when the
push is completed.
2b) Further drop the locks on all backfills_in_flight objects in
_clear_recovery_state(), for when we cancel peering.

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: reset new_obs and new_snapset in execute_ctx

Signed-off-by: Samuel Just <sam.just@inktank.com>
OpRequest: move method implementations into cc

I need to remove the osd_types.h include.

Signed-off-by: Samuel Just <sam.just@inktank.com>
osd_types,OpRequest: move osd_req_id into OpRequest

This was I can have OpRequest included from osd_types.h.

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG,osd_types: move rw tracking from its own map to ObjectContext

We also modify recovering to hold a reference to the recovering obc
in order to ensure that our backfill_read_lock doesn't outlive the
obc.

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedBackend: fix failed push error output

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: have make_writeable adjust backfill_pos

If we are writing to backfill_pos and create a clone, we end
up failing to send the transaction creating the clone to the
backfill peer.  This is fine as long as we end up backfilling
the clone.  To that end, we simply add the clone to
backfill_info and adjust backfill_pos accordingly.  This is less
brittle than the waiting_for_backfill_pos mechanism since it
works even if we wait between that check and issuing the repop,
which can happen for copy_from.

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG,ReplicatedPG: remove the waiting_for_backfill_peer mechanism

See previous patch.

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: call on_flushed on FlushEvt
ReplicatedPG: improved on_flushed error output

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: put repops even in TrimObjects

Signed-off-by: Samuel Just <sam.just@inktank.com>