]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: s/release_op_ctx_locks/release_object_locks, don't use opcontext
authorSamuel Just <sjust@redhat.com>
Tue, 8 Dec 2015 23:31:05 +0000 (15:31 -0800)
committerSamuel Just <sjust@redhat.com>
Thu, 25 Feb 2016 18:56:41 +0000 (10:56 -0800)
This gets us one step closer to removing OpContext from Repop.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 1cdaa4561a97f53ec0c9035d3e20e042bedfd2a1..43d5bae9accd524683458e582e6a8892b6546d19 100644 (file)
@@ -8455,8 +8455,8 @@ ReplicatedPG::RepGather *ReplicatedPG::new_repop(
 void ReplicatedPG::remove_repop(RepGather *repop)
 {
   dout(20) << __func__ << " " << *repop << dendl;
-  if (repop->ctx->obc)
-    dout(20) << " obc " << *repop->ctx->obc << dendl;
+  assert(repop->ctx->obc);
+  dout(20) << " obc " << *repop->ctx->obc << dendl;
   if (repop->ctx->clone_obc)
     dout(20) << " clone_obc " << *repop->ctx->clone_obc << dendl;
   if (repop->ctx->snapset_obc)
@@ -8468,7 +8468,9 @@ void ReplicatedPG::remove_repop(RepGather *repop)
     (*p)();
   }
 
-  release_op_ctx_locks(repop->ctx);
+  release_object_locks(
+    repop->ctx->obc->obs.oi.soid.get_head(),
+    repop->ctx->lock_manager);
   repop->put();
 
   osd->logger->dec(l_osd_op_wip);
index 4d19eb5c2d086c2237b99b0d7290a445b8abb459..d2b77f3f7f7855f6e6505ec74cf72afb0e37bb3c 100644 (file)
@@ -677,7 +677,6 @@ public:
     }
     ~OpContext() {
       assert(!op_t);
-      assert(lock_type == ObjectContext::RWState::RWNONE);
       if (reply)
        reply->put();
       for (list<pair<boost::tuple<uint64_t, uint64_t, unsigned>,
@@ -805,7 +804,7 @@ protected:
    * @param ctx [in] ctx to clean up
    */
   void close_op_ctx(OpContext *ctx) {
-    release_op_ctx_locks(ctx);
+    release_object_locks(ctx->lock_manager);
     ctx->op_t.reset();
     for (auto p = ctx->on_finish.begin();
         p != ctx->on_finish.end();
@@ -816,37 +815,38 @@ protected:
   }
 
   /**
-   * Releases ctx locks
+   * Releases locks
    *
-   * @param ctx [in] ctx to clean up
+   * @param manager [in] manager with locks to release
    */
-  void release_op_ctx_locks(OpContext *ctx) {
-    list<OpRequestRef> to_req;
+  void release_object_locks(
+    ObcLockManager &lock_manager) {
+    list<pair<hobject_t, list<OpRequestRef> > > to_req;
     bool requeue_recovery = false;
     bool requeue_snaptrim = false;
-    ctx->lock_manager.put_locks(
+    lock_manager.put_locks(
       &to_req,
       &requeue_recovery,
       &requeue_snaptrim);
-    ctx->lock_type = ObjectContext::RWState::RWNONE;
     if (requeue_recovery)
       osd->recovery_wq.queue(this);
     if (requeue_snaptrim)
       queue_snap_trim();
 
     if (!to_req.empty()) {
-      assert(ctx->obc);
       // requeue at front of scrub blocking queue if we are blocked by scrub
-      if (scrubber.write_blocked_by_scrub(
-           ctx->obc->obs.oi.soid.get_head(),
-           get_sort_bitwise())) {
-       waiting_for_active.splice(
-         waiting_for_active.begin(),
-         to_req,
-         to_req.begin(),
-         to_req.end());
-      } else {
-       requeue_ops(to_req);
+      for (auto &&p: to_req) {
+       if (scrubber.write_blocked_by_scrub(
+             p.first.get_head(),
+             get_sort_bitwise())) {
+         waiting_for_active.splice(
+           waiting_for_active.begin(),
+           p.second,
+           p.second.begin(),
+           p.second.end());
+       } else {
+         requeue_ops(p.second);
+       }
       }
     }
   }