]> git.proxmox.com Git - ceph.git/blame - ceph/src/os/bluestore/BitmapAllocator.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / os / bluestore / BitmapAllocator.h
CommitLineData
a8e16298
TL
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
15class BitmapAllocator : public Allocator,
16 public AllocatorLevel02<AllocatorLevel01Loose> {
17 CephContext* cct;
a8e16298 18public:
20effc67
TL
19 BitmapAllocator(CephContext* _cct, int64_t capacity, int64_t alloc_unit,
20 std::string_view name);
a8e16298
TL
21 ~BitmapAllocator() override
22 {
23 }
24
f67539c2
TL
25 const char* get_type() const override
26 {
27 return "bitmap";
28 }
a8e16298
TL
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
e306af50
TL
36 using Allocator::release;
37
a8e16298
TL
38 uint64_t get_free() override
39 {
40 return get_available();
41 }
42
43 void dump() override;
eafe8130 44 void dump(std::function<void(uint64_t offset, uint64_t length)> notify) override;
9f95a23c 45 double get_fragmentation() override
a8e16298
TL
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