]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: do not assign already cached buffer to
authorIgor Fedotov <ifedotov@suse.com>
Thu, 8 Oct 2020 12:14:58 +0000 (15:14 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Thu, 8 Oct 2020 12:14:58 +0000 (15:14 +0300)
mempool_bluestore_writing.

This spoils mempool stats with unexpectedly high mount of entries in
the bluestore_writing mempool.
The issue might occurs while handling partial overwrites in EC pools.
Unser some circumstances EC backend might rewrite data from read cache back to disk.

Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/os/bluestore/BlueStore.h

index fdde77dabb7fe79cab767d9856903774abff1694..f7a72f1f73b1b40ab15f360b99d5edfe12566f93 100644 (file)
@@ -297,11 +297,13 @@ public:
       ceph_assert(writing.empty());
     }
 
-    void _add_buffer(BufferCacheShard* cache, Buffer *b, int level, Buffer *near) {
+    void _add_buffer(BufferCacheShard* cache, Buffer* b, int level, Buffer* near) {
       cache->_audit("_add_buffer start");
       buffer_map[b->offset].reset(b);
       if (b->is_writing()) {
-       b->data.reassign_to_mempool(mempool::mempool_bluestore_writing);
+        // we might get already cached data for which resetting mempool is inppropriate
+        // hence calling try_assign_to_mempool
+        b->data.try_assign_to_mempool(mempool::mempool_bluestore_writing);
         if (writing.empty() || writing.rbegin()->seq <= b->seq) {
           writing.push_back(*b);
         } else {
@@ -316,8 +318,8 @@ public:
           writing.insert(it, *b);
         }
       } else {
-       b->data.reassign_to_mempool(mempool::mempool_bluestore_cache_data);
-       cache->_add(b, level, near);
+        b->data.reassign_to_mempool(mempool::mempool_bluestore_cache_data);
+        cache->_add(b, level, near);
       }
       cache->_audit("_add_buffer end");
     }