public:
enum {
OP_NOP = 0,
- OP_CREATE = 7, // cid, oid
OP_TOUCH = 9, // cid, oid
OP_WRITE = 10, // cid, oid, offset, len, bl
OP_ZERO = 11, // cid, oid, offset, len
case OP_NOP:
break;
- case OP_CREATE:
case OP_TOUCH:
case OP_REMOVE:
case OP_SETATTR:
_op->op = OP_NOP;
data.ops++;
}
- /**
- * create
- *
- * create an object that does not yet exist
- * (behavior is undefined if the object already exists)
- */
- void create(const coll_t& cid, const ghobject_t& oid) {
- Op* _op = _get_next_op();
- _op->op = OP_CREATE;
- _op->cid = _get_coll_id(cid);
- _op->oid = _get_object_id(oid);
- data.ops++;
- }
/**
* touch
*
case Transaction::OP_NOP:
f->dump_string("op_name", "nop");
break;
- case Transaction::OP_CREATE:
- {
- coll_t cid = i.get_cid(op->cid);
- ghobject_t oid = i.get_oid(op->oid);
- f->dump_string("op_name", "create");
- f->dump_stream("collection") << cid;
- f->dump_stream("oid") << oid;
- }
- break;
-
case Transaction::OP_TOUCH:
{
coll_t cid = i.get_cid(op->cid);
BlueStore::OnodeRef BlueStore::Collection::get_onode(
const ghobject_t& oid,
- bool create,
- bool is_createop)
+ bool create)
{
ceph_assert(create ? lock.is_wlocked() : lock.is_locked());
}
}
- OnodeRef o = OnodeRef();
- if (!is_createop) {
- o = onode_map.lookup(oid);
- if (o)
- return o;
- }
+ OnodeRef o = onode_map.lookup(oid);
+ if (o)
+ return o;
mempool::bluestore_cache_other::string key;
get_object_key(store->cct, oid, &key);
<< pretty_binary_string(key) << dendl;
bufferlist v;
- int r = -ENOENT;
+ int r = store->db->get(PREFIX_OBJ, key.c_str(), key.size(), &v);
+ ldout(store->cct, 20) << " r " << r << " v.len " << v.length() << dendl;
Onode *on;
- if (!is_createop) {
- r = store->db->get(PREFIX_OBJ, key.c_str(), key.size(), &v);
- ldout(store->cct, 20) << " r " << r << " v.len " << v.length() << dendl;
- }
if (v.length() == 0) {
ceph_assert(r == -ENOENT);
if (!store->cct->_conf->bluestore_debug_misc &&
// these operations implicity create the object
bool create = false;
if (op->op == Transaction::OP_TOUCH ||
- op->op == Transaction::OP_CREATE ||
op->op == Transaction::OP_WRITE ||
op->op == Transaction::OP_ZERO) {
create = true;
OnodeRef &o = ovec[op->oid];
if (!o) {
ghobject_t oid = i.get_oid(op->oid);
- o = c->get_onode(oid, create, op->op == Transaction::OP_CREATE);
+ o = c->get_onode(oid, create);
}
if (!create && (!o || !o->exists)) {
dout(10) << __func__ << " op " << op->op << " got ENOENT on "
}
switch (op->op) {
- case Transaction::OP_CREATE:
case Transaction::OP_TOUCH:
r = _touch(txc, c, o);
break;
pool_opts_t pool_opts;
ContextQueue *commit_queue;
- OnodeRef get_onode(const ghobject_t& oid, bool create, bool is_createop=false);
+ OnodeRef get_onode(const ghobject_t& oid, bool create);
// the terminology is confusing here, sorry!
//
switch (op->op) {
case Transaction::OP_NOP:
break;
- case Transaction::OP_CREATE:
case Transaction::OP_TOUCH:
{
const coll_t &_cid = i.get_cid(op->cid);
// these operations implicity create the object
bool create = false;
if (op->op == Transaction::OP_TOUCH ||
- op->op == Transaction::OP_CREATE ||
op->op == Transaction::OP_WRITE ||
op->op == Transaction::OP_ZERO) {
create = true;
}
switch (op->op) {
- case Transaction::OP_CREATE:
case Transaction::OP_TOUCH:
r = _touch(txc, c, o);
break;
switch (op->op) {
case Transaction::OP_NOP:
break;
- case Transaction::OP_CREATE:
case Transaction::OP_TOUCH:
{
coll_t cid = i.get_cid(op->cid);
[&](const PGTransaction::ObjectOperation::Init::None &) {},
[&](const PGTransaction::ObjectOperation::Init::Create &op) {
for (auto &&st: *transactions) {
- st.second.create(
+ st.second.touch(
coll_t(spg_t(pgid, st.first)),
ghobject_t(oid, ghobject_t::NO_GEN, st.first));
}
[&](const PGTransaction::ObjectOperation::Init::None &) {
},
[&](const PGTransaction::ObjectOperation::Init::Create &op) {
- t->create(coll, goid);
+ t->touch(coll, goid);
},
[&](const PGTransaction::ObjectOperation::Init::Clone &op) {
t->clone(