From: Yunchuan Wen Date: Tue, 20 Dec 2016 01:52:30 +0000 (+0800) Subject: bluestore: avoid unnecessary copy with coll_t X-Git-Tag: v12.0.0~397^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c4fa36ad75b1d5b45bfc850d5183ed981844341e;p=ceph.git bluestore: avoid unnecessary copy with coll_t Signed-off-by: Yunchuan Wen --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 2bcd2163e25f..7e6b2941052a 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -6993,7 +6993,7 @@ void BlueStore::_txc_add_transaction(TransContext *txc, Transaction *t) switch (op->op) { case Transaction::OP_RMCOLL: { - coll_t cid = i.get_cid(op->cid); + const coll_t &cid = i.get_cid(op->cid); r = _remove_collection(txc, cid, &c); if (!r) continue; @@ -7003,7 +7003,7 @@ void BlueStore::_txc_add_transaction(TransContext *txc, Transaction *t) case Transaction::OP_MKCOLL: { assert(!c); - coll_t cid = i.get_cid(op->cid); + const coll_t &cid = i.get_cid(op->cid); r = _create_collection(txc, cid, op->split_bits, &c); if (!r) continue; @@ -8836,7 +8836,7 @@ int BlueStore::_rename(TransContext *txc, int BlueStore::_create_collection( TransContext *txc, - coll_t cid, + const coll_t &cid, unsigned bits, CollectionRef *c) { @@ -8867,7 +8867,7 @@ int BlueStore::_create_collection( return r; } -int BlueStore::_remove_collection(TransContext *txc, coll_t cid, +int BlueStore::_remove_collection(TransContext *txc, const coll_t &cid, CollectionRef *c) { dout(15) << __func__ << " " << cid << dendl; diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index b92777f5cd2b..2eeb4299c9aa 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -2157,9 +2157,10 @@ private: OnodeRef& oldo, OnodeRef& newo, const ghobject_t& new_oid); - int _create_collection(TransContext *txc, coll_t cid, unsigned bits, - CollectionRef *c); - int _remove_collection(TransContext *txc, coll_t cid, CollectionRef *c); + int _create_collection(TransContext *txc, const coll_t &cid, + unsigned bits, CollectionRef *c); + int _remove_collection(TransContext *txc, const coll_t &cid, + CollectionRef *c); int _split_collection(TransContext *txc, CollectionRef& c, CollectionRef& d,