Project

General

Profile

Subtask #5510

Feature #4929: Erasure encoded placement group

Subtask #5487: Factor out ObjectContext / ReplicatedPG::object_contexts

ObjectContext : replace ref with shared_ptr

Added by Loic Dachary over 6 years ago. Updated almost 6 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
OSD
Target version:
-
% Done:

100%

Spent time:
Source:
Development
Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:

Associated revisions

Revision e1be37a3 (diff)
Added by Loic Dachary over 6 years ago

PG: remove unused PG::_cond

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

Signed-off-by: Loic Dachary <>

Revision 1688fb48 (diff)
Added by Loic Dachary over 6 years ago

ReplicatedPG: add Mutex to protect snapset_contexts

snapset_contexts_locks is added and locked in each function where
snapset_contexts or the SnapSetContext::ref data member needs to be
accessed or modified.

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

Signed-off-by: Loic Dachary <>

Revision 7e85c632 (diff)
Added by Loic Dachary over 6 years ago

ReplicatedPG: ObjectContext is made compatible with SharedPtrRegistry

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 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 ObjectContext::destructor_callback data member Context is added
and called by the destructor. It will allow the caller to perform
additional cleanup, if necessary.

All ObjectContext * data members are replaced with shared_ptr.

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

Signed-off-by: Loic Dachary <>

Revision ff70e764 (diff)
Added by Loic Dachary over 6 years ago

ReplicatedPG: ObjectContext * becomes ObjectContextRef

The map of hobject_t to ObjectContext is made a
SharedPtrRegistry owned by ReplicatedPG

-  map&lt;hobject_t, ObjectContext*&gt; object_contexts;
+ SharedPtrRegistry&lt;hobject_t, ObjectContext&gt; object_contexts;

All ObjectContext pointers are changed into ObjectContextRef, i.e.
shared_ptr.

In Watch.h std::tr1::shared_ptr<ObjectContext> is used instead
of ObjectContextRef because Watch.h is included before it is
defined.

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

Signed-off-by: Loic Dachary <>

Revision 13f6807e (diff)
Added by Loic Dachary over 6 years ago

ReplicatedPG: remove reference counting logic

ObjectContext manual reference counting and managing the
object_contexts object involves calls to

  • obc->ref++ and obc->get()
  • put_object_context and put_object_contexts
  • register_object_context
  • assertions on obc->registered

They are all removed because SharedPtrRegistry provides the
same service.

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

Signed-off-by: Loic Dachary <>

Revision 8c745944 (diff)
Added by Loic Dachary over 6 years ago

ReplicatedPG: remove lookup_object_context method

Both ReplicatedPG::lookup_object_context and
ReplicatedPG::_lookup_object_context methods are provided by
SharedPtrRegistry.

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

Signed-off-by: Loic Dachary <>

Revision 833a2250 (diff)
Added by Loic Dachary over 6 years ago

ReplicatedPG: replace map iterators with SharedPtrRegistry::get_next

SharedPtrRegistry does not provide an iterator equivalent to

map&lt;hobject_t, ObjectContext*&gt;::iterator i

It is replaced with a thread safe get_next method roughly used
as follows:

pair&lt;hobject_t, ObjectContextRef&gt; i;
while (object_contexts.get_next(i.first, &i))

All occurences of the iterator are replaced with get_next style
traversal.

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

Signed-off-by: Loic Dachary <>

Revision 95349c02 (diff)
Added by Loic Dachary over 6 years ago

ReplicatedPG: add Context to cleanup the PG after an ObjectContext deletion

ReplicatedPG::C_PG_ObjectContext is added to encapsulate a
call to ReplicatedPG::object_context_destructor_callback method
which is reponsible for

  • manually de-allocating the SnapSetContext of the ObjectContext if
    any. It will eventually be managed by a SharedPtrRegistry.

ReplicatedPG::C_PG_ObjectContext must be added to the destructor_callback
member of ObjectContext immediately after it is created.

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

Signed-off-by: Loic Dachary <>

Revision bd9f73d8 (diff)
Added by Loic Dachary over 6 years ago

ReplicatedPG: replace object_contexts.find with object_contexts.lookup

The std::map equivalent of find is SharedPtrRegistry::lookup

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

Signed-off-by: Loic Dachary <>

Revision d980f581 (diff)
Added by Loic Dachary over 6 years ago

ReplicatedPG: create ObjectContext with SharedPtrRegistry

All new ObjectContext are replaced with calls to
SharedPtrRegistry::lookup_or_create to ensure that they are all
registered. Because the constructor is invoked with no argument, care
is taken to always initialize the destructor_callback data member
immediately afterwards.

ReplicatedPG::get_object_context contains a redundant call to
get_snapset_context that is removed.

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

Signed-off-by: Loic Dachary <>

History

#1 Updated by Loic Dachary over 6 years ago

  • Description updated (diff)
  • Status changed from In Progress to Fix Under Review

#2 Updated by Loic Dachary over 6 years ago

  • Description updated (diff)

#3 Updated by Loic Dachary over 6 years ago

  • Status changed from Fix Under Review to In Progress

#4 Updated by Loic Dachary over 6 years ago

  • Status changed from In Progress to Fix Under Review

#5 Updated by Loic Dachary over 6 years ago

rebased against master

#6 Updated by Loic Dachary over 6 years ago

  • Status changed from Fix Under Review to Resolved
  • % Done changed from 0 to 100
  • translation missing: en.field_remaining_hours set to 0.00

merged and the rados tests results from the past few days does not exhibit problems that can be obviously traced back to this patch series

#7 Updated by Loic Dachary almost 6 years ago

  • Estimated time set to 0.00 h

Also available in: Atom PDF