]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: don't create clone_obc on replica
authorSage Weil <sage@newdream.net>
Sat, 11 Sep 2010 21:06:43 +0000 (14:06 -0700)
committerSage Weil <sage@newdream.net>
Sat, 11 Sep 2010 21:06:43 +0000 (14:06 -0700)
We don't need the clone_obc on the replica, since we don't read from there.
We don't have head obc's either.

We do, however, keep the snapset_obc, since there are a few paths that
depend on whether it exists on disk (to clean it up) and that information
isn't currently fed through from the primary.

src/osd/ReplicatedPG.cc

index 3a0824a7d49d0211219ecc5ea3958e7eaa2f96ff..b5d25f71f1fad73f7819a1ada0f5b0f8073c20de 100644 (file)
@@ -1599,19 +1599,23 @@ void ReplicatedPG::make_writeable(OpContext *ctx)
       snaps[i] = snapc.snaps[i];
     
     // prepare clone
-    ctx->clone_obc = new ObjectContext(coid);
-    ctx->clone_obc->obs.oi.version = ctx->at_version;
-    ctx->clone_obc->obs.oi.prior_version = oi.version;
-    ctx->clone_obc->obs.oi.last_reqid = oi.last_reqid;
-    ctx->clone_obc->obs.oi.mtime = oi.mtime;
-    ctx->clone_obc->obs.oi.snaps = snaps;
-    ctx->clone_obc->obs.exists = true;
-    ctx->clone_obc->get();
-
-    if (is_primary())
+    object_info_t static_snap_oi(coid);
+    object_info_t *snap_oi;
+    if (is_primary()) {
+      ctx->clone_obc = new ObjectContext(coid);
+      ctx->clone_obc->obs.exists = true;
+      ctx->clone_obc->get();
       register_object_context(ctx->clone_obc);
-    
-    _make_clone(t, soid, coid, &ctx->clone_obc->obs.oi);
+      snap_oi = &ctx->clone_obc->obs.oi;
+    } else {
+      snap_oi = &static_snap_oi;
+    }
+    snap_oi->version = ctx->at_version;
+    snap_oi->prior_version = oi.version;
+    snap_oi->last_reqid = oi.last_reqid;
+    snap_oi->mtime = oi.mtime;
+    snap_oi->snaps = snaps;
+    _make_clone(t, soid, coid, snap_oi);
     
     // add to snap bound collections
     coll_t fc = make_snap_collection(t, snaps[0]);