os/bluestore/BlueStore: move "onode::exists=true" in _assign_nid.

If object  has nid, it always set exists =true in get_onode.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
This commit is contained in:
Jianpeng Ma 2017-07-03 18:48:13 +08:00
parent ab06dd445d
commit d34444be01

View File

@ -7551,12 +7551,15 @@ int BlueStore::_upgrade_super()
void BlueStore::_assign_nid(TransContext *txc, OnodeRef o)
{
if (o->onode.nid)
if (o->onode.nid) {
assert(o->exists);
return;
}
uint64_t nid = ++nid_last;
dout(20) << __func__ << " " << nid << dendl;
o->onode.nid = nid;
txc->last_nid = nid;
o->exists = true;
}
uint64_t BlueStore::_assign_blobid(TransContext *txc)
@ -9156,7 +9159,6 @@ int BlueStore::_touch(TransContext *txc,
{
dout(15) << __func__ << " " << c->cid << " " << o->oid << dendl;
int r = 0;
o->exists = true;
_assign_nid(txc, o);
txc->write_onode(o);
dout(10) << __func__ << " " << c->cid << " " << o->oid << " = " << r << dendl;
@ -10278,7 +10280,6 @@ int BlueStore::_write(TransContext *txc,
dout(15) << __func__ << " " << c->cid << " " << o->oid
<< " 0x" << std::hex << offset << "~" << length << std::dec
<< dendl;
o->exists = true;
_assign_nid(txc, o);
int r = _do_write(txc, c, o, offset, length, bl, fadvise_flags);
txc->write_onode(o);
@ -10297,7 +10298,6 @@ int BlueStore::_zero(TransContext *txc,
dout(15) << __func__ << " " << c->cid << " " << o->oid
<< " 0x" << std::hex << offset << "~" << length << std::dec
<< dendl;
o->exists = true;
_assign_nid(txc, o);
int r = _do_zero(txc, c, o, offset, length);
dout(10) << __func__ << " " << c->cid << " " << o->oid
@ -10775,7 +10775,6 @@ int BlueStore::_clone(TransContext *txc,
return -EINVAL;
}
newo->exists = true;
_assign_nid(txc, newo);
// clone data
@ -10960,7 +10959,6 @@ int BlueStore::_clone_range(TransContext *txc,
goto out;
}
newo->exists = true;
_assign_nid(txc, newo);
if (length > 0) {