}
break;
+ case Transaction::OP_MERGE_DELETE:
+ {
+ const ghobject_t& noid = i.get_oid(op->dest_oid);
+ OnodeRef& no = ovec[op->dest_oid];
+ if (!no) {
+ no = c->get_onode(noid, true);
+ }
+ vector<boost::tuple<uint64_t, uint64_t, uint64_t>> move_info;
+ i.decode_move_info(move_info);
+ r = _move_ranges_destroy_src(txc, c, o, no, move_info);
+ }
+ break;
+
case Transaction::OP_COLL_ADD:
assert(0 == "not implemented");
break;
return r;
}
+/* Move contents of src object according to move_info to base object.
+ * Once the move_info is traversed completely, delete the src object.
+ */
+int BlueStore::_move_ranges_destroy_src(TransContext *txc,
+ CollectionRef& c,
+ OnodeRef& srco,
+ OnodeRef& baseo,
+ const vector<boost::tuple<uint64_t, uint64_t, uint64_t>> move_info)
+{
+ dout(15) << __func__ << " " << c->cid << " " << srco->oid << " -> " << baseo->oid << dendl;
+
+ int r = 0;
+
+ //Traverse move_info completely, move contents from src object to base object.
+ for (unsigned i = 0; i < move_info.size(); ++i) {
+ uint64_t srcoff = move_info[i].get<0>();
+ uint64_t dstoff = move_info[i].get<1>();
+ uint64_t len = move_info[i].get<2>();
+
+ dout(15) << __func__ << " " << c->cid << " " << srco->oid << " -> "
+ << baseo->oid << " from 0x" << std::hex << srcoff << "~" << len
+ << " to offset 0x" << dstoff << std::dec << dendl;
+
+ r = _clone_range(txc, c, srco, baseo, srcoff, len, dstoff);
+ if (r < 0)
+ goto out;
+ }
+
+ // delete the src object
+ r = _do_remove(txc, c, srco);
+
+ out:
+ return r;
+}
+
int BlueStore::_rename(TransContext *txc,
CollectionRef& c,
OnodeRef& oldo,
OnodeRef& oldo,
OnodeRef& newo,
uint64_t srcoff, uint64_t length, uint64_t dstoff);
+ int _move_ranges_destroy_src(TransContext *txc,
+ CollectionRef& c,
+ OnodeRef& oldo,
+ OnodeRef& newo,
+ const vector<boost::tuple<uint64_t, uint64_t, uint64_t>> move_info);
int _rename(TransContext *txc,
CollectionRef& c,
OnodeRef& oldo,