diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/os/bluestore/HybridAllocator.h | |
parent | Initial commit. (diff) | |
download | ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/os/bluestore/HybridAllocator.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/os/bluestore/HybridAllocator.h b/src/os/bluestore/HybridAllocator.h new file mode 100644 index 000000000..d60fc1a31 --- /dev/null +++ b/src/os/bluestore/HybridAllocator.h @@ -0,0 +1,53 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#pragma once + +#include <mutex> + +#include "AvlAllocator.h" +#include "BitmapAllocator.h" + +class HybridAllocator : public AvlAllocator { + BitmapAllocator* bmap_alloc = nullptr; +public: + HybridAllocator(CephContext* cct, int64_t device_size, int64_t _block_size, + uint64_t max_mem, + const std::string& name) : + AvlAllocator(cct, device_size, _block_size, max_mem, name) { + } + const char* get_type() const override + { + return "hybrid"; + } + int64_t allocate( + uint64_t want, + uint64_t unit, + uint64_t max_alloc_size, + int64_t hint, + PExtentVector *extents) override; + void release(const interval_set<uint64_t>& release_set) override; + uint64_t get_free() override; + double get_fragmentation() override; + + void dump() override; + void foreach( + std::function<void(uint64_t offset, uint64_t length)> notify) override; + void init_rm_free(uint64_t offset, uint64_t length) override; + void shutdown() override; + +protected: + // intended primarily for UT + BitmapAllocator* get_bmap() { + return bmap_alloc; + } + const BitmapAllocator* get_bmap() const { + return bmap_alloc; + } +private: + + void _spillover_range(uint64_t start, uint64_t end) override; + + // called when extent to be released/marked free + void _add_to_tree(uint64_t start, uint64_t size) override; +}; |