]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/Transaction: add the interface dedicated to touching temp objects
authorXuehan Xu <xuxuehan@qianxin.com>
Thu, 26 Mar 2026 08:08:41 +0000 (16:08 +0800)
committerXuehan Xu <xuxuehan@qianxin.com>
Mon, 25 May 2026 08:55:32 +0000 (16:55 +0800)
Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
src/os/Transaction.h

index 8badb1c98d8af101d742452a31cdfd81318c4e82..d4c3623addd55df61519acd9631b63099de86b13 100644 (file)
@@ -153,6 +153,9 @@ public:
     OP_COLL_SET_BITS = 42, // cid, bits
 
     OP_MERGE_COLLECTION = 43, // cid, destination
+#ifdef WITH_CRIMSON
+    OP_TOUCH_TEMP = 44, // cid, temp_oid, target_oid
+#endif
   };
 
   // Transaction hint type
@@ -439,6 +442,9 @@ public:
       op->oid = om[op->oid];
       break;
 
+#ifdef WITH_CRIMSON
+    case OP_TOUCH_TEMP:
+#endif
     case OP_CLONERANGE2:
     case OP_CLONE:
       ceph_assert(op->cid < cm.size());
@@ -856,6 +862,29 @@ public:
     _op->oid = _get_object_id(oid);
     data.ops = data.ops + 1;
   }
+#ifdef WITH_CRIMSON
+  /**
+   * touch_temp
+   *
+   * Ensure the existance of the temp recovering object in a collection.
+   * OP_TOUCH_TEMP exists for recovery/backfill objects. Unlike OP_TOUCH,
+   * the temp-recovering object must share the **same** laddr object pre-
+   * fixes of the target object. See "Multi-push Recovery" in doc/dev/crim-
+   * son/seastore_laddr.rst.
+   */
+  void touch_temp(
+    const coll_t& cid,
+    const ghobject_t &tmp_oid,
+    const ghobject_t &target_oid)
+  {
+    Op* _op = _get_next_op();
+    _op->op = OP_TOUCH_TEMP;
+    _op->cid = _get_coll_id(cid);
+    _op->oid = _get_object_id(tmp_oid);
+    _op->dest_oid = _get_object_id(target_oid);
+    data.ops = data.ops + 1;
+  }
+#endif
   /**
    * Write data to an offset within an object. If the object is too
    * small, it is expanded as needed.  It is possible to specify an