From: Samuel Just Date: Fri, 13 Nov 2015 18:18:31 +0000 (-0800) Subject: ReplicatedPG: break out complete_disconnect_watches helper X-Git-Tag: v10.1.0~277^2~19 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e4c535600671bc9fd689bd7e08496c964f5001a3;p=ceph.git ReplicatedPG: break out complete_disconnect_watches helper We'll need this shortly when we remove do_osd_op_effects from eval_repop. Signed-off-by: Samuel Just --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 3452cf9cb8d..a75c363b974 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -5242,7 +5242,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops) oi.watchers.erase(oi_iter); t->nop(); // update oi on disk ctx->watch_disconnects.push_back( - OpContext::watch_disconnect_t(cookie, entity, false)); + watch_disconnect_t(cookie, entity, false)); } else { dout(10) << " can't remove: no watch by " << entity << dendl; } @@ -5989,7 +5989,7 @@ inline int ReplicatedPG::_delete_oid(OpContext *ctx, bool no_whiteout) ++p) { dout(20) << __func__ << " will disconnect watcher " << p->first << dendl; ctx->watch_disconnects.push_back( - OpContext::watch_disconnect_t(p->first.first, p->first.second, true)); + watch_disconnect_t(p->first.first, p->first.second, true)); } oi.watchers.clear(); @@ -6355,27 +6355,34 @@ void ReplicatedPG::add_interval_usage(interval_set& s, object_stat_sum } } -void ReplicatedPG::do_osd_op_effects(OpContext *ctx, const ConnectionRef& conn) +void ReplicatedPG::complete_disconnect_watches( + ObjectContextRef obc, + const list &to_disconnect) { - entity_name_t entity = ctx->reqid.name; - dout(15) << "do_osd_op_effects " << entity << " con " << conn.get() << dendl; - - // disconnects first - for (list::iterator i = - ctx->watch_disconnects.begin(); - i != ctx->watch_disconnects.end(); + for (list::const_iterator i = + to_disconnect.begin(); + i != to_disconnect.end(); ++i) { pair watcher(i->cookie, i->name); - if (ctx->obc->watchers.count(watcher)) { - WatchRef watch = ctx->obc->watchers[watcher]; + if (obc->watchers.count(watcher)) { + WatchRef watch = obc->watchers[watcher]; dout(10) << "do_osd_op_effects disconnect watcher " << watcher << dendl; - ctx->obc->watchers.erase(watcher); + obc->watchers.erase(watcher); watch->remove(i->send_disconnect); } else { dout(10) << "do_osd_op_effects disconnect failed to find watcher " << watcher << dendl; } } +} + +void ReplicatedPG::do_osd_op_effects(OpContext *ctx, const ConnectionRef& conn) +{ + entity_name_t entity = ctx->reqid.name; + dout(15) << "do_osd_op_effects " << entity << " con " << conn.get() << dendl; + + // disconnects first + complete_disconnect_watches(ctx->obc, ctx->watch_disconnects); if (!conn) return; diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index d458a5495da..d51fe706033 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -473,6 +473,17 @@ public: LogClientTemp clog_error() { return osd->clog->error(); } + struct watch_disconnect_t { + uint64_t cookie; + entity_name_t name; + bool send_disconnect; + watch_disconnect_t(uint64_t c, entity_name_t n, bool sd) + : cookie(c), name(n), send_disconnect(sd) {} + }; + void complete_disconnect_watches( + ObjectContextRef obc, + const list &to_disconnect); + /* * Capture all object state associated with an in-progress read or write. */ @@ -498,13 +509,6 @@ public: // side effects list > watch_connects; ///< new watch + will_ping flag - struct watch_disconnect_t { - uint64_t cookie; - entity_name_t name; - bool send_disconnect; - watch_disconnect_t(uint64_t c, entity_name_t n, bool sd) - : cookie(c), name(n), send_disconnect(sd) {} - }; list watch_disconnects; ///< old watch + send_discon list notifies; struct NotifyAck {