]> git.proxmox.com Git - ceph.git/blob - ceph/src/os/bluestore/BitmapAllocator.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / os / bluestore / BitmapAllocator.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #ifndef CEPH_OS_BLUESTORE_BITMAPFASTALLOCATOR_H
5 #define CEPH_OS_BLUESTORE_BITMAPFASTALLOCATOR_H
6
7 #include <mutex>
8
9 #include "Allocator.h"
10 #include "os/bluestore/bluestore_types.h"
11 #include "fastbmap_allocator_impl.h"
12 #include "include/mempool.h"
13 #include "common/debug.h"
14
15 class BitmapAllocator : public Allocator,
16 public AllocatorLevel02<AllocatorLevel01Loose> {
17 CephContext* cct;
18
19 public:
20 BitmapAllocator(CephContext* _cct, int64_t capacity, int64_t alloc_unit, const std::string& name);
21 ~BitmapAllocator() override
22 {
23 }
24
25 const char* get_type() const override
26 {
27 return "bitmap";
28 }
29 int64_t allocate(
30 uint64_t want_size, uint64_t alloc_unit, uint64_t max_alloc_size,
31 int64_t hint, PExtentVector *extents) override;
32
33 void release(
34 const interval_set<uint64_t>& release_set) override;
35
36 using Allocator::release;
37
38 uint64_t get_free() override
39 {
40 return get_available();
41 }
42
43 void dump() override;
44 void dump(std::function<void(uint64_t offset, uint64_t length)> notify) override;
45 double get_fragmentation() override
46 {
47 return _get_fragmentation();
48 }
49
50 void init_add_free(uint64_t offset, uint64_t length) override;
51 void init_rm_free(uint64_t offset, uint64_t length) override;
52
53 void shutdown() override;
54 };
55
56 #endif