osd_op_params->at_version.version++;
// make clone
- backend.clone(clone_obc->obs.oi, initial_obs, clone_obc->obs, txn);
+ backend.clone_for_write(soid, coid, txn);
+ backend.set_metadata(
+ coid,
+ clone_obc->obs.oi,
+ nullptr /* snapset */,
+ txn);
delta_stats.num_objects++;
if (clone_obc->obs.oi.is_omap()) {
return rm_xattr_iertr::now();
}
-void PGBackend::clone(
- /* const */object_info_t& snap_oi,
- const ObjectState& os,
- const ObjectState& d_os,
- ceph::os::Transaction& txn)
-{
- // See OpsExecuter::execute_clone documentation
- txn.clone(coll->get_cid(), ghobject_t{os.oi.soid}, ghobject_t{d_os.oi.soid});
- {
- ceph::bufferlist bv;
- snap_oi.encode_no_oid(bv, CEPH_FEATURES_ALL);
- txn.setattr(coll->get_cid(), ghobject_t{d_os.oi.soid}, OI_ATTR, bv);
- }
- txn.rmattr(coll->get_cid(), ghobject_t{d_os.oi.soid}, SS_ATTR);
-}
-
using get_omap_ertr =
crimson::os::FuturizedStore::Shard::read_errorator::extend<
crimson::ct_error::enodata>;
read_errorator::pass_further{});
}
+void PGBackend::set_metadata(
+ const hobject_t &obj,
+ object_info_t &oi,
+ const SnapSet *ss /* non-null iff head */,
+ ceph::os::Transaction& txn)
+{
+ ceph_assert((obj.is_head() && ss) || (!obj.is_head() && !ss));
+ {
+ ceph::bufferlist bv;
+ oi.encode_no_oid(bv, CEPH_FEATURES_ALL);
+ txn.setattr(coll->get_cid(), ghobject_t{obj}, OI_ATTR, bv);
+ }
+ if (ss) {
+ ceph::bufferlist bss;
+ encode(*ss, bss);
+ txn.setattr(coll->get_cid(), ghobject_t{obj}, SS_ATTR, bss);
+ }
+}
+
+void PGBackend::clone_for_write(
+ const hobject_t &from,
+ const hobject_t &to,
+ ceph::os::Transaction &txn)
+{
+ // See OpsExecuter::execute_clone documentation
+ txn.clone(coll->get_cid(), ghobject_t{from}, ghobject_t{to});
+ txn.rmattr(coll->get_cid(), ghobject_t{to}, SS_ATTR);
+}
+
ObjectState& os,
const OSDOp& osd_op,
ceph::os::Transaction& trans);
- void clone(
- /* const */object_info_t& snap_oi,
- const ObjectState& os,
- const ObjectState& d_os,
- ceph::os::Transaction& trans);
interruptible_future<struct stat> stat(
CollectionRef c,
const ghobject_t& oid) const;
ceph::os::Transaction& trans,
osd_op_params_t& osd_op_params,
object_stat_sum_t& delta_stats);
+
+ /// sets oi and (for head) ss attrs
+ void set_metadata(
+ const hobject_t &obj,
+ object_info_t &oi,
+ const SnapSet *ss /* non-null iff head */,
+ ceph::os::Transaction& trans);
+
+ /// clone from->to and clear ss attribute on to
+ void clone_for_write(
+ const hobject_t &from,
+ const hobject_t &to,
+ ceph::os::Transaction& trans);
+
virtual rep_op_fut_t
submit_transaction(const std::set<pg_shard_t> &pg_shards,
const hobject_t& hoid,