replace ObjectContext pointers with shared_ptr

The ObjectContext pointers are shared using a ref data member that
needs to be updated by the caller. This is tedious and error
prone. All pointers are replaced with shared_ptr for
automatic reference counting and the ref data member is removed.

The ReplicatedPG::object_contexts is changed to a SharedPtrRegistry.
The SharedPtrRegistry::get_next() method with a value of
ObjectContextRef instead of ObjectContext is added. The
SharedPtrRegistry::empty() method is added. When creating a new object
SharedPtrRegistry::lookup_or_create uses the default ObjectContext
constructor with no argument. The existing ObjectContext constructor
is modified to have no argument and the initialization that was
previously done within the constructor is done by the caller (that
only happens three times).

The SharedPtrRegistry do not delete the ObjectContext or update the
ReplicatedPG::object_contexts at exactly the same point as
ReplicatedPG::put_object_context does. It happens when the last object
holding a shared_ptr goes out of scope, which is always later than
the call to ReplicatedPG::put_object_context.

The ObjectContext::get method is removed: its only purpose is to
increment the ref.

The ObjectContext::registered data member is removed as well as all
the associated assert()

The ReplicatedPG::_lookup_object_context method is removed because it
is used once to retrieve an ObjectContext without incrementing ref, in
order to save a call to ReplicatedPG::put_object_context. Since the ref
data member is no longer used, the method is redundant.

The ReplicatedPG::lookup_object_context (no underscore) method is
replaced with SharedPtrRegistry::lookup.

The ReplicatedPG::put_object_context has three different purposes: a)
check mode.wake b) decrement the ref of the associated ObjectContext
given in argument c) if the ref drops to zero delete the object,
delete its entry in the ReplicatedPG::object_contexts registry and
call PG::kick. The decrementing part is no longer necessary because
the SharedPtrRegistry takes care of it. The mode.wake check is removed
because it is not currently used. The cleanup that happens on deletion is
moved to the ObjectContext destructor, using a Context object as a
callback to invoke the
ReplicatedPG::object_context_destructor_callback method.

ReplicatedPG::register_object_context is removed. It was called after
creating a new ObjectContext to add it to
ReplicatedPG::object_contexts and also to initialize ssc, obs.exists
and obs.oi. The call is replaced with the desired side effects, in
addition to setting the new destructor_callback data member.

ReplicatedPG::put_object_contexts calls put_object_context on a list
of ObjectContexts and clears the list. It is replaced by a call to
list::clear.

ReplicatedPG::context_registry_on_change is a call to the
Watch::discard method of all the watchers found in
ReplicatedPG::object_contexts.

ReplicatedPG::_finish_mark_all_unfound_lost explicitely calls
ReplicatedPG::put_object_contexts in a loop to clear the list. It is
taken care of by SharedPtrRegistry and the list can be cleared without
iterating over all its elements.

Watch::get_obc is inlined and does not rely on the ObjectContext::get
method.

http://tracker.ceph.com/issues/5510 refs #5510

Signed-off-by: Loic Dachary <loic@dachary.org>