summaryrefslogtreecommitdiffstats
path: root/src/os/bluestore/BlueStore.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/bluestore/BlueStore.cc')
-rw-r--r--src/os/bluestore/BlueStore.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc
index 5db054135e1..f96caa7e6b0 100644
--- a/src/os/bluestore/BlueStore.cc
+++ b/src/os/bluestore/BlueStore.cc
@@ -3504,7 +3504,8 @@ uint64_t BlueStore::Collection::make_blob_unshared(SharedBlob *sb)
BlueStore::OnodeRef BlueStore::Collection::get_onode(
const ghobject_t& oid,
- bool create)
+ bool create,
+ bool is_createop)
{
ceph_assert(create ? lock.is_wlocked() : lock.is_locked());
@@ -3528,9 +3529,12 @@ BlueStore::OnodeRef BlueStore::Collection::get_onode(
<< pretty_binary_string(key) << dendl;
bufferlist v;
- int r = store->db->get(PREFIX_OBJ, key.c_str(), key.size(), &v);
- ldout(store->cct, 20) << " r " << r << " v.len " << v.length() << dendl;
+ int r = -ENOENT;
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 &&
@@ -11186,6 +11190,7 @@ void BlueStore::_txc_add_transaction(TransContext *txc, Transaction *t)
// 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;
@@ -11196,7 +11201,7 @@ void BlueStore::_txc_add_transaction(TransContext *txc, Transaction *t)
OnodeRef &o = ovec[op->oid];
if (!o) {
ghobject_t oid = i.get_oid(op->oid);
- o = c->get_onode(oid, create);
+ o = c->get_onode(oid, create, op->op == Transaction::OP_CREATE);
}
if (!create && (!o || !o->exists)) {
dout(10) << __func__ << " op " << op->op << " got ENOENT on "
@@ -11206,6 +11211,7 @@ void BlueStore::_txc_add_transaction(TransContext *txc, Transaction *t)
}
switch (op->op) {
+ case Transaction::OP_CREATE:
case Transaction::OP_TOUCH:
r = _touch(txc, c, o);
break;