]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/Bluefs: fix file reader/writer buffer mempool
authorDeepika Upadhyay <dupadhya@redhat.com>
Wed, 17 Jun 2020 14:42:32 +0000 (10:42 -0400)
committerDeepika Upadhyay <dupadhya@redhat.com>
Mon, 13 Jul 2020 18:10:48 +0000 (23:40 +0530)
Signed-off-by: Deepika Upadhyay <dupadhya@redhat.com>
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h
src/os/bluestore/bluestore_types.h

index 6badbc786bb4dbc6d7b837e843b6035346e2509f..9589e02d9a1347f2e364940f6634d11da613847d 100644 (file)
@@ -1694,7 +1694,6 @@ int BlueFS::device_migrate_to_existing(
        ceph_assert(cur_len > 0);
        cur.substr_of(bl, off, cur_len);
        int r = bdev[dev_target]->write(i.offset, cur, buffered);
-       cur.reassign_to_mempool(mempool::mempool_bluefs_file_writer);
        ceph_assert(r == 0);
        off += cur_len;
       }
@@ -1958,6 +1957,7 @@ int64_t BlueFS::_read_random(
   logger->inc(l_bluefs_read_random_bytes, len);
 
   std::shared_lock s_lock(h->lock);
+  buf->bl.reassign_to_mempool(mempool::mempool_bluefs_file_reader);
   while (len > 0) {
     if (off < buf->bl_off || off >= buf->get_buf_end()) {
       s_lock.unlock();
@@ -2009,7 +2009,6 @@ int64_t BlueFS::_read_random(
       buf->pos += r;
     }
   }
-  buf->bl.reassign_to_mempool(mempool::mempool_bluefs_file_reader);
   dout(20) << __func__ << " got " << ret << dendl;
   --h->file->num_reading;
   return ret;
@@ -2059,6 +2058,7 @@ int64_t BlueFS::_read(
     if (off < buf->bl_off || off >= buf->get_buf_end()) {
       s_lock.unlock();
       std::unique_lock u_lock(h->lock);
+      buf->bl.reassign_to_mempool(mempool::mempool_bluefs_file_reader);
       if (off < buf->bl_off || off >= buf->get_buf_end()) {
         // if precondition hasn't changed during locking upgrade.
         buf->bl.clear();
@@ -2118,7 +2118,6 @@ int64_t BlueFS::_read(
     buf->pos += r;
   }
 
-  buf->bl.reassign_to_mempool(mempool::mempool_bluefs_file_reader);
   dout(20) << __func__ << " got " << ret << dendl;
   ceph_assert(!outbl || (int)outbl->length() == ret);
   --h->file->num_reading;
@@ -3363,7 +3362,6 @@ int BlueFS::open_for_write(
     }
   }
 
-  (*h)->buffer.reassign_to_mempool(mempool::mempool_bluefs_file_writer);
   dout(10) << __func__ << " h " << *h << " on " << file->fnode << dendl;
   return 0;
 }
@@ -3382,6 +3380,7 @@ BlueFS::FileWriter *BlueFS::_create_writer(FileRef f)
 void BlueFS::_close_writer(FileWriter *h)
 {
   dout(10) << __func__ << " " << h << " type " << h->writer_type << dendl;
+  h->buffer.reassign_to_mempool(mempool::mempool_bluefs_file_writer);
   for (unsigned i=0; i<MAX_BDEV; ++i) {
     if (bdev[i]) {
       if (h->iocv[i]) {
index 55615a6d59a6fc6d114c79105103c7492473d857..32c2809a67ac05d510b13e6b7a66063b157cb445 100644 (file)
@@ -3292,7 +3292,7 @@ BlueStore::Onode* BlueStore::Onode::decode(
   auto p = v.front().begin_deep();
   on->onode.decode(p);
   for (auto& i : on->onode.attrs) {
-    i.second.reassign_to_mempool(mempool::mempool_bluestore_cache_onode);
+    i.second.reassign_to_mempool(mempool::mempool_bluestore_cache_data);
   }
 
   // initialize extent_map
@@ -3301,7 +3301,7 @@ BlueStore::Onode* BlueStore::Onode::decode(
     denc(on->extent_map.inline_bl, p);
     on->extent_map.decode_some(on->extent_map.inline_bl);
     on->extent_map.inline_bl.reassign_to_mempool(
-      mempool::mempool_bluestore_cache_onode);
+      mempool::mempool_bluestore_cache_data);
   }
   else {
     on->extent_map.init_shards(false, false);
@@ -14687,10 +14687,10 @@ int BlueStore::_setattr(TransContext *txc,
   if (val.is_partial()) {
     auto& b = o->onode.attrs[name.c_str()] = bufferptr(val.c_str(),
                                                       val.length());
-    b.reassign_to_mempool(mempool::mempool_bluestore_cache_onode);
+    b.reassign_to_mempool(mempool::mempool_bluestore_cache_data);
   } else {
     auto& b = o->onode.attrs[name.c_str()] = val;
-    b.reassign_to_mempool(mempool::mempool_bluestore_cache_onode);
+    b.reassign_to_mempool(mempool::mempool_bluestore_cache_data);
   }
   txc->write_onode(o);
   dout(10) << __func__ << " " << c->cid << " " << o->oid
@@ -14713,10 +14713,10 @@ int BlueStore::_setattrs(TransContext *txc,
     if (p->second.is_partial()) {
       auto& b = o->onode.attrs[p->first.c_str()] =
        bufferptr(p->second.c_str(), p->second.length());
-      b.reassign_to_mempool(mempool::mempool_bluestore_cache_onode);
+      b.reassign_to_mempool(mempool::mempool_bluestore_cache_data);
     } else {
       auto& b = o->onode.attrs[p->first.c_str()] = p->second;
-      b.reassign_to_mempool(mempool::mempool_bluestore_cache_onode);
+      b.reassign_to_mempool(mempool::mempool_bluestore_cache_data);
     }
   }
   txc->write_onode(o);
index a6fbd789442c0386e3707f92af5b4b4388572676..2d05715e9b51c2d24c76a2fc96cd39f5d471220e 100644 (file)
@@ -1288,7 +1288,7 @@ public:
 
   private:
     /// forward lookups
-    mempool::bluestore_cache_onode::unordered_map<ghobject_t,OnodeRef> onode_map;
+    mempool::bluestore_cache_meta::unordered_map<ghobject_t,OnodeRef> onode_map;
 
     friend struct Collection; // for split_cache()
 
@@ -2216,6 +2216,7 @@ private:
           mempool::bluestore_Extent::allocated_bytes() +
           mempool::bluestore_cache_meta::allocated_bytes() +
           mempool::bluestore_cache_other::allocated_bytes() +
+          mempool::bluestore_cache_onode::allocated_bytes() +
           mempool::bluestore_SharedBlob::allocated_bytes() +
           mempool::bluestore_inline_bl::allocated_bytes();
       }
index 7821a052111d82184bb98fd93a2c0e774440bc38..ed7f8219d57f064c1a0113a2394953ba51df5cb1 100644 (file)
@@ -938,7 +938,6 @@ struct bluestore_onode_t {
   uint64_t size = 0;                   ///< object size
   // FIXME: bufferptr does not have a mempool
   std::map<mempool::bluestore_cache_meta::string, ceph::buffer::ptr> attrs;
-//  mempool::bluestore_cache_onode::map<string, bufferptr> attrs;     ///< attrs
 
   struct shard_info {
     uint32_t offset = 0;  ///< logical offset for start of shard