From: Sage Weil Date: Fri, 23 Dec 2016 18:35:40 +0000 (-0500) Subject: os/bluestore: use mempool string for onode_t attr map X-Git-Tag: v12.0.0~181^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=22d186ede2579be6be7d589fe0048c9541906113;p=ceph.git os/bluestore: use mempool string for onode_t attr map Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 9eb88409e460..4fec89b79329 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -5456,7 +5456,7 @@ int BlueStore::getattr( int r; { RWLock::RLocker l(c->lock); - string k(name); + mempool::bluestore_meta_other::string k(name); OnodeRef o = c->get_onode(oid, false); if (!o || !o->exists) { @@ -5513,7 +5513,9 @@ int BlueStore::getattrs( r = -ENOENT; goto out; } - aset = o->onode.attrs; + for (auto& i : o->onode.attrs) { + aset.emplace(i.first.c_str(), i.second); + } r = 0; } @@ -7482,7 +7484,7 @@ void BlueStore::_dump_onode(OnodeRef o, int log_level) << " expected_write_size " << o->onode.expected_write_size << " in " << o->onode.extent_map_shards.size() << " shards" << dendl; - for (map::iterator p = o->onode.attrs.begin(); + for (auto p = o->onode.attrs.begin(); p != o->onode.attrs.end(); ++p) { dout(log_level) << __func__ << " attr " << p->first @@ -8449,9 +8451,9 @@ int BlueStore::_setattr(TransContext *txc, << dendl; int r = 0; if (val.is_partial()) - o->onode.attrs[name] = bufferptr(val.c_str(), val.length()); + o->onode.attrs[name.c_str()] = bufferptr(val.c_str(), val.length()); else - o->onode.attrs[name] = val; + o->onode.attrs[name.c_str()] = val; txc->write_onode(o); dout(10) << __func__ << " " << c->cid << " " << o->oid << " " << name << " (" << val.length() << " bytes)" @@ -8471,9 +8473,10 @@ int BlueStore::_setattrs(TransContext *txc, for (map::const_iterator p = aset.begin(); p != aset.end(); ++p) { if (p->second.is_partial()) - o->onode.attrs[p->first] = bufferptr(p->second.c_str(), p->second.length()); + o->onode.attrs[p->first.c_str()] = + bufferptr(p->second.c_str(), p->second.length()); else - o->onode.attrs[p->first] = p->second; + o->onode.attrs[p->first.c_str()] = p->second; } txc->write_onode(o); dout(10) << __func__ << " " << c->cid << " " << o->oid @@ -8491,7 +8494,7 @@ int BlueStore::_rmattr(TransContext *txc, dout(15) << __func__ << " " << c->cid << " " << o->oid << " " << name << dendl; int r = 0; - map::iterator it = o->onode.attrs.find(name); + auto it = o->onode.attrs.find(name.c_str()); if (it == o->onode.attrs.end()) goto out; diff --git a/src/os/bluestore/bluestore_types.cc b/src/os/bluestore/bluestore_types.cc index 4619093d1b6b..eb6442265c75 100644 --- a/src/os/bluestore/bluestore_types.cc +++ b/src/os/bluestore/bluestore_types.cc @@ -559,10 +559,9 @@ void bluestore_onode_t::dump(Formatter *f) const f->dump_unsigned("nid", nid); f->dump_unsigned("size", size); f->open_object_section("attrs"); - for (map::const_iterator p = attrs.begin(); - p != attrs.end(); ++p) { + for (auto p = attrs.begin(); p != attrs.end(); ++p) { f->open_object_section("attr"); - f->dump_string("name", p->first); + f->dump_string("name", p->first.c_str()); // it's not quite std::string f->dump_unsigned("len", p->second.length()); f->close_section(); } diff --git a/src/os/bluestore/bluestore_types.h b/src/os/bluestore/bluestore_types.h index 3b1f26288992..8d37b214d48a 100644 --- a/src/os/bluestore/bluestore_types.h +++ b/src/os/bluestore/bluestore_types.h @@ -660,7 +660,7 @@ ostream& operator<<(ostream& out, const bluestore_shared_blob_t& o); struct bluestore_onode_t { uint64_t nid = 0; ///< numeric id (locally unique) uint64_t size = 0; ///< object size - map attrs; ///< attrs + map attrs; ///< attrs struct shard_info { uint32_t offset = 0; ///< logical offset for start of shard