From c4fa36ad75b1d5b45bfc850d5183ed981844341e Mon Sep 17 00:00:00 2001 From: Yunchuan Wen Date: Tue, 20 Dec 2016 09:52:30 +0800 Subject: [PATCH] bluestore: avoid unnecessary copy with coll_t Signed-off-by: Yunchuan Wen --- src/os/bluestore/BlueStore.cc | 8 ++++---- src/os/bluestore/BlueStore.h | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 2bcd2163e25fb..7e6b2941052a1 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 b92777f5cd2be..2eeb4299c9aa4 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, -- 2.39.5