From: Igor Fedotov Date: Thu, 8 Oct 2020 12:14:58 +0000 (+0300) Subject: os/bluestore: do not assign already cached buffer to X-Git-Tag: v16.1.0~565^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=050873feae3c2d7e51ee0d37a00204934f2a1161;p=ceph.git os/bluestore: do not assign already cached buffer to 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 --- diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index fdde77dabb7..f7a72f1f73b 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -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"); }