]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: use mempool string for onode_t attr map
authorSage Weil <sage@redhat.com>
Fri, 23 Dec 2016 18:35:40 +0000 (13:35 -0500)
committerSage Weil <sage@redhat.com>
Fri, 13 Jan 2017 16:48:03 +0000 (11:48 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/bluestore_types.cc
src/os/bluestore/bluestore_types.h

index 9eb88409e460695ef846e09efd86788fa5e91346..4fec89b79329e0f90adb271461a8efc59e90a2f0 100644 (file)
@@ -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<string,bufferptr>::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<string,bufferptr>::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<string, bufferptr>::iterator it = o->onode.attrs.find(name);
+  auto it = o->onode.attrs.find(name.c_str());
   if (it == o->onode.attrs.end())
     goto out;
 
index 4619093d1b6bcf7619d235f618ce60486fbaa739..eb6442265c75963a3f7d54758b8d078f6a78f16e 100644 (file)
@@ -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<string,bufferptr>::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();
   }
index 3b1f26288992e3f9b5a292b6437f49ecb37d60b0..8d37b214d48ada5190e55871a10c959eebc0c173 100644 (file)
@@ -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<string, bufferptr> attrs;        ///< attrs
+  map<mempool::bluestore_meta_other::string, bufferptr> attrs;        ///< attrs
 
   struct shard_info {
     uint32_t offset = 0;  ///< logical offset for start of shard