diff options
author | Loic Dachary <loic@dachary.org> | 2013-08-13 16:52:18 +0200 |
---|---|---|
committer | Loic Dachary <loic@dachary.org> | 2013-08-22 02:10:59 +0200 |
commit | 95349c028ef049e28f651773cbf28f49a872013c (patch) | |
tree | 7b8f230a9f9c8ae618d82e32f32b9965c0deeea5 | |
parent | 833a225008115ef87884791dafa3797dbae9f9fd (diff) | |
download | ceph-95349c028ef049e28f651773cbf28f49a872013c.tar.gz |
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 <loic@dachary.org>
-rw-r--r-- | src/osd/ReplicatedPG.cc | 11 | ||||
-rw-r--r-- | src/osd/ReplicatedPG.h | 11 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 6c81997c931..a1bba507033 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4678,7 +4678,16 @@ int ReplicatedPG::find_object_context(const hobject_t& oid, } } -void ReplicatedPG::add_object_context_to_pg_stat(ObjectContext *obc, pg_stat_t *pgstat) +void ReplicatedPG::object_context_destructor_callback(ObjectContext *obc) +{ + dout(10) << "object_context_destructor_callback " << obc << " " + << obc->obs.oi.soid << dendl; + + if (obc->ssc) + put_snapset_context(obc->ssc); +} + +void ReplicatedPG::add_object_context_to_pg_stat(ObjectContextRef obc, pg_stat_t *pgstat) { object_info_t& oi = obc->obs.oi; diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 133be172a98..0fbe5afd9ca 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -302,6 +302,17 @@ protected: ObjectContextRef get_object_context(const hobject_t& soid, bool can_create); void context_registry_on_change(); + void object_context_destructor_callback(ObjectContext *obc); + struct C_PG_ObjectContext : public Context { + ReplicatedPGRef pg; + ObjectContext *obc; + C_PG_ObjectContext(ReplicatedPG *p, ObjectContext *o) : + pg(p), obc(o) {} + void finish(int r) { + pg->object_context_destructor_callback(obc); + } + }; + int find_object_context(const hobject_t& oid, ObjectContextRef *pobc, bool can_create, snapid_t *psnapid=NULL); |