#define dout_subsys ceph_subsys_bluestore
-Allocator *Allocator::create(string type, int64_t size)
+Allocator *Allocator::create(string type,
+ int64_t size, int64_t block_size)
{
if (type == "stupid") {
return new StupidAllocator;
} else if (type == "bitmap") {
- return new BitMapAllocator(size);
+ return new BitMapAllocator(size, block_size);
}
derr << "Allocator::" << __func__ << " unknown alloc type " << type << dendl;
return NULL;
virtual uint64_t get_free() = 0;
virtual void shutdown() = 0;
- static Allocator *create(string type, int64_t size);
+ static Allocator *create(string type, int64_t size, int64_t block_size);
};
#endif
#define dout_prefix *_dout << "bitmapalloc:"
-BitMapAllocator::BitMapAllocator(int64_t device_size)
+BitMapAllocator::BitMapAllocator(int64_t device_size, int64_t block_size)
: m_num_uncommitted(0),
m_num_committing(0)
{
- int64_t block_size = g_conf->bdev_block_size;
int64_t zone_size_blks = 1024; // Change it later
m_block_size = block_size;
public:
BitMapAllocator();
- BitMapAllocator(int64_t device_size);
+ BitMapAllocator(int64_t device_size, int64_t block_size);
~BitMapAllocator();
int reserve(uint64_t need);
continue;
}
assert(bdev[id]->get_size());
- alloc[id] = Allocator::create(g_conf->bluestore_allocator, bdev[id]->get_size());
+ alloc[id] = Allocator::create(g_conf->bluestore_allocator,
+ bdev[id]->get_size(),
+ g_conf->bluefs_alloc_size);
interval_set<uint64_t>& p = block_all[id];
for (interval_set<uint64_t>::iterator q = p.begin(); q != p.end(); ++q) {
alloc[id]->init_add_free(q.get_start(), q.get_len());
{
assert(alloc == NULL);
assert(bdev->get_size());
- alloc = Allocator::create(g_conf->bluestore_allocator, bdev->get_size());
+ alloc = Allocator::create(g_conf->bluestore_allocator,
+ bdev->get_size(),
+ min_alloc_size);
uint64_t num = 0, bytes = 0;
fm->enumerate_reset();
uint64_t offset, length;