}
break;
+ case Transaction::OP_MERGE_DELETE:
+ {
+ coll_t cid = i.get_cid(op->cid);
+ ghobject_t oid = i.get_oid(op->oid);
+ ghobject_t noid = i.get_oid(op->dest_oid);
+ vector<boost::tuple<uint64_t, uint64_t, uint64_t>> move_info;
+ i.decode_move_info(move_info);
+ r = _move_ranges_destroy_src(cid, oid, noid, move_info);
+ }
+ break;
+
case Transaction::OP_MKCOLL:
{
coll_t cid = i.get_cid(op->cid);
return len;
}
+/* Move contents of src object according to move_info to base object.
+ * Once the move_info is traversed completely, delete the src object.
+ */
+int MemStore::_move_ranges_destroy_src(const coll_t& cid, const ghobject_t& srcoid,
+ const ghobject_t& baseoid,
+ const vector<boost::tuple<uint64_t, uint64_t, uint64_t> > move_info)
+{
+ dout(10) << __func__ << " " << cid << " " << srcoid << " -> " << baseoid << dendl;
+ CollectionRef c = get_collection(cid);
+ if (!c)
+ return -ENOENT;
+
+ ObjectRef oo = c->get_object(srcoid);
+ if (!oo)
+ return -ENOENT;
+ ObjectRef no = c->get_or_create_object(baseoid);
+
+ 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>();
+
+ if (srcoff >= oo->get_size())
+ return 0;
+ if (srcoff + len >= oo->get_size())
+ len = oo->get_size() - srcoff;
+
+ const ssize_t old_size = no->get_size();
+ no->clone(oo.get(), srcoff, len, dstoff);
+ used_bytes += (no->get_size() - old_size);
+ }
+
+// delete the src object
+ _remove(cid, srcoid);
+ return 0;
+}
+
int MemStore::_omap_clear(const coll_t& cid, const ghobject_t &oid)
{
dout(10) << __func__ << " " << cid << " " << oid << dendl;
int _clone_range(const coll_t& cid, const ghobject_t& oldoid,
const ghobject_t& newoid,
uint64_t srcoff, uint64_t len, uint64_t dstoff);
+ int _move_ranges_destroy_src(const coll_t& cid, const ghobject_t& oldoid,
+ const ghobject_t& newoid,
+ const vector<boost::tuple<uint64_t, uint64_t, uint64_t> > move_info);
int _omap_clear(const coll_t& cid, const ghobject_t &oid);
int _omap_setkeys(const coll_t& cid, const ghobject_t &oid, bufferlist& aset_bl);
int _omap_rmkeys(const coll_t& cid, const ghobject_t &oid, bufferlist& keys_bl);