friend class Allocator;
std::string name;
public:
- explicit SocketHook(Allocator *alloc,
- const std::string& _name) :
+ SocketHook(Allocator *alloc, std::string_view _name) :
alloc(alloc), name(_name)
{
AdminSocket *admin_socket = g_ceph_context->get_admin_socket();
}
};
-Allocator::Allocator(const std::string& name,
+Allocator::Allocator(std::string_view name,
int64_t _capacity,
int64_t _block_size)
: device_size(_capacity), block_size(_block_size)
return asok_hook->name;
}
-Allocator *Allocator::create(CephContext* cct, string type,
- int64_t size, int64_t block_size, const std::string& name)
+Allocator *Allocator::create(CephContext* cct, std::string_view type,
+ int64_t size, int64_t block_size, std::string_view name)
{
Allocator* alloc = nullptr;
if (type == "stupid") {
class Allocator {
public:
- explicit Allocator(const std::string& name,
- int64_t _capacity,
- int64_t _block_size);
+ Allocator(std::string_view name,
+ int64_t _capacity,
+ int64_t _block_size);
virtual ~Allocator();
/*
virtual double get_fragmentation_score();
virtual void shutdown() = 0;
- static Allocator *create(CephContext* cct, std::string type, int64_t size,
- int64_t block_size, const std::string& name = "");
+ static Allocator *create(CephContext* cct, std::string_view type, int64_t size,
+ int64_t block_size, const std::string_view name = "");
const string& get_name() const;
int64_t device_size,
int64_t block_size,
uint64_t max_mem,
- const std::string& name) :
+ std::string_view name) :
Allocator(name, device_size, block_size),
range_size_alloc_threshold(
cct->_conf.get_val<uint64_t>("bluestore_avl_alloc_bf_threshold")),
AvlAllocator::AvlAllocator(CephContext* cct,
int64_t device_size,
int64_t block_size,
- const std::string& name) :
+ std::string_view name) :
Allocator(name, device_size, block_size),
range_size_alloc_threshold(
cct->_conf.get_val<uint64_t>("bluestore_avl_alloc_bf_threshold")),
*/
AvlAllocator(CephContext* cct, int64_t device_size, int64_t block_size,
uint64_t max_mem,
- const std::string& name);
+ std::string_view name);
public:
AvlAllocator(CephContext* cct, int64_t device_size, int64_t block_size,
- const std::string& name);
+ std::string_view name);
~AvlAllocator();
const char* get_type() const override
{
BitmapAllocator::BitmapAllocator(CephContext* _cct,
int64_t capacity,
int64_t alloc_unit,
- const std::string& name) :
+ std::string_view name) :
Allocator(name, capacity, alloc_unit),
cct(_cct)
{
public AllocatorLevel02<AllocatorLevel01Loose> {
CephContext* cct;
public:
- BitmapAllocator(CephContext* _cct, int64_t capacity, int64_t alloc_unit, const std::string& name);
+ BitmapAllocator(CephContext* _cct, int64_t capacity, int64_t alloc_unit,
+ std::string_view name);
~BitmapAllocator() override
{
}
public:
HybridAllocator(CephContext* cct, int64_t device_size, int64_t _block_size,
uint64_t max_mem,
- const std::string& name) :
+ std::string_view name) :
AvlAllocator(cct, device_size, _block_size, max_mem, name) {
}
const char* get_type() const override
StupidAllocator::StupidAllocator(CephContext* cct,
int64_t capacity,
int64_t _block_size,
- const std::string& name)
+ std::string_view name)
: Allocator(name, capacity, _block_size),
cct(cct), num_free(0),
free(10)
StupidAllocator(CephContext* cct,
int64_t size,
int64_t block_size,
- const std::string& name);
+ std::string_view name);
~StupidAllocator() override;
const char* get_type() const override
{
ZonedAllocator::ZonedAllocator(CephContext* cct,
int64_t size,
int64_t blk_size,
- const std::string& name)
+ std::string_view name)
: Allocator(name, size, blk_size),
cct(cct),
num_free(0),
public:
ZonedAllocator(CephContext* cct, int64_t size, int64_t block_size,
- const std::string& name);
+ std::string_view name);
~ZonedAllocator() override;
const char *get_type() const override {
AllocTest(): alloc(0) { }
void init_alloc(int64_t size, uint64_t min_alloc_size) {
std::cout << "Creating alloc type " << string(GetParam()) << " \n";
- alloc.reset(Allocator::create(g_ceph_context, string(GetParam()), size,
+ alloc.reset(Allocator::create(g_ceph_context, GetParam(), size,
min_alloc_size));
}
uint64_t alloc_size = 4 * 1024;
uint64_t capacity = 512ll * 1024 * 1024 * 1024;
- Allocator* alloc = Allocator::create(g_ceph_context, string(GetParam()),
+ Allocator* alloc = Allocator::create(g_ceph_context, GetParam(),
capacity, alloc_size);
ASSERT_NE(alloc, nullptr);
alloc->init_add_free(0, capacity);
AllocTest(): alloc(0) { }
void init_alloc(int64_t size, uint64_t min_alloc_size) {
std::cout << "Creating alloc type " << string(GetParam()) << " \n";
- alloc.reset(Allocator::create(g_ceph_context, string(GetParam()), size,
+ alloc.reset(Allocator::create(g_ceph_context, GetParam(), size,
min_alloc_size));
}
std::cerr << "error: invalid init: " << s << std::endl;
return -1;
}
- alloc.reset(Allocator::create(g_ceph_context, string("bitmap"), total,
+ alloc.reset(Allocator::create(g_ceph_context, "bitmap", total,
alloc_unit));
owned_by_app.insert(0, total);