]> git.proxmox.com Git - ceph.git/blame - ceph/src/os/bluestore/BitmapAllocator.h
import ceph 14.2.5
[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;
18
19public:
eafe8130 20 BitmapAllocator(CephContext* _cct, int64_t capacity, int64_t alloc_unit, const std::string& name);
a8e16298
TL
21 ~BitmapAllocator() override
22 {
23 }
24
25
26 int64_t allocate(
27 uint64_t want_size, uint64_t alloc_unit, uint64_t max_alloc_size,
28 int64_t hint, PExtentVector *extents) override;
29
30 void release(
31 const interval_set<uint64_t>& release_set) override;
32
33 uint64_t get_free() override
34 {
35 return get_available();
36 }
37
38 void dump() override;
eafe8130 39 void dump(std::function<void(uint64_t offset, uint64_t length)> notify) override;
a8e16298
TL
40 double get_fragmentation(uint64_t) override
41 {
42 return _get_fragmentation();
43 }
44
45 void init_add_free(uint64_t offset, uint64_t length) override;
46 void init_rm_free(uint64_t offset, uint64_t length) override;
47
48 void shutdown() override;
49};
50
51#endif