diff options
author | Greg Farnum <greg@inktank.com> | 2013-09-24 12:53:27 -0700 |
---|---|---|
committer | Greg Farnum <greg@inktank.com> | 2013-09-24 12:53:27 -0700 |
commit | 29b9e701e7a5cd1d19b0e35199ea1fb425434712 (patch) | |
tree | af01d99b7db208dbc4dfde26a889990541ead28a | |
parent | ac0748108e194ba15c5a167874c9932c92c3f30c (diff) | |
download | ceph-29b9e701e7a5cd1d19b0e35199ea1fb425434712.tar.gz |
ReplicatedPG: add insufficient skeleton for promote_object
Signed-off-by: Greg Farnum <greg@inktank.com>
-rw-r--r-- | src/osd/ReplicatedPG.cc | 22 | ||||
-rw-r--r-- | src/osd/ReplicatedPG.h | 5 |
2 files changed, 21 insertions, 6 deletions
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index ffb0499fd44..28d1f97f037 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -916,10 +916,10 @@ bool ReplicatedPG::maybe_handle_cache(OpRequestRef op, ObjectContextRef obc, return false; break; case pg_pool_t::CACHEMODE_WRITEBACK: - if (obc.get()) { + if (obc.get() && obc->obs.exists) { // we have the object already return false; - } else { - do_cache_redirect(op, obc); + } else { // try and promote! + promote_object(op, obc); return true; } break; @@ -927,12 +927,17 @@ bool ReplicatedPG::maybe_handle_cache(OpRequestRef op, ObjectContextRef obc, do_cache_redirect(op, obc); return true; break; - case pg_pool_t::CACHEMODE_READONLY: - if (obc.get() && !r) { + case pg_pool_t::CACHEMODE_READONLY: // TODO: clean this case up + if (!obc.get() && r == -ENOENT) { // we don't have the object and op's a read + promote_object(op, obc); + return true; + } else if (obc.get() && obc->obs.exists) { // we have the object locally return false; - } else { + } else if (!r) { // it must be a write do_cache_redirect(op, obc); return true; + } else { // crap, there was a failure of some kind + return false; } break; default: @@ -955,6 +960,11 @@ void ReplicatedPG::do_cache_redirect(OpRequestRef op, ObjectContextRef obc) return; } +void ReplicatedPG::promote_object(OpRequestRef op, ObjectContextRef obc) +{ + +} + void ReplicatedPG::execute_ctx(OpContext *ctx) { dout(10) << __func__ << " " << ctx << dendl; diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index e880bdecade..9957f0623e0 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -623,8 +623,13 @@ protected: uint64_t offset, uint64_t length, bool count_bytes); void add_interval_usage(interval_set<uint64_t>& s, object_stat_sum_t& st); + /** + * This helper function is called from do_op if the ObjectContext lookup fails. + * @returns true if the caching code is handling the Op, false otherwise. + */ inline bool maybe_handle_cache(OpRequestRef op, ObjectContextRef obc, int r); void do_cache_redirect(OpRequestRef op, ObjectContextRef obc); + void promote_object(OpRequestRef op, ObjectContextRef obc); int prepare_transaction(OpContext *ctx); |