/// return the effective length of the extent if we align to alloc_unit
uint64_t StupidAllocator::_aligned_len(
- btree_interval_set<uint64_t,allocator>::iterator p,
+ StupidAllocator::interval_set_t::iterator p,
uint64_t alloc_unit)
{
uint64_t skew = p.get_start() % alloc_unit;
std::lock_guard<std::mutex> l(lock);
ldout(cct, 10) << __func__ << " 0x" << std::hex << offset << "~" << length
<< std::dec << dendl;
- btree_interval_set<uint64_t,allocator> rm;
+ interval_set_t rm;
rm.insert(offset, length);
for (unsigned i = 0; i < free.size() && !rm.empty(); ++i) {
- btree_interval_set<uint64_t,allocator> overlap;
+ interval_set_t overlap;
overlap.intersection_of(rm, free[i]);
if (!overlap.empty()) {
ldout(cct, 20) << __func__ << " bin " << i << " rm 0x" << std::hex << overlap
#include <mutex>
#include "Allocator.h"
-#include "include/btree_interval_set.h"
+#include "include/btree_map.h"
+#include "include/interval_set.h"
#include "os/bluestore/bluestore_types.h"
#include "include/mempool.h"
int64_t num_reserved; ///< reserved bytes
typedef mempool::bluestore_alloc::pool_allocator<
- pair<const uint64_t,uint64_t>> allocator;
- std::vector<btree_interval_set<uint64_t,allocator>> free; ///< leading-edge copy
+ pair<const uint64_t,uint64_t>> allocator_t;
+ typedef btree::btree_map<uint64_t,uint64_t,std::less<uint64_t>,allocator_t> interval_set_map_t;
+ typedef interval_set<uint64_t,interval_set_map_t> interval_set_t;
+ std::vector<interval_set_t> free; ///< leading-edge copy
uint64_t last_alloc;
void _insert_free(uint64_t offset, uint64_t len);
uint64_t _aligned_len(
- btree_interval_set<uint64_t,allocator>::iterator p,
+ interval_set_t::iterator p,
uint64_t alloc_unit);
public:
#include <gtest/gtest.h>
#include "include/interval_set.h"
-#include "include/btree_interval_set.h"
+#include "include/btree_map.h"
using namespace ceph;
typedef T ISet;
};
-typedef ::testing::Types< interval_set<IntervalValueType> , btree_interval_set<IntervalValueType> > IntervalSetTypes;
+typedef ::testing::Types<
+ interval_set<IntervalValueType>,
+ interval_set<IntervalValueType,
+ btree::btree_map<IntervalValueType,IntervalValueType>>
+ > IntervalSetTypes;
TYPED_TEST_CASE(IntervalSetTest, IntervalSetTypes);