Rename allocator to allocator_t

This commit is contained in:
Vitaliy Filippov
2025-03-13 00:53:34 +03:00
parent b760951aa7
commit 263a3b5ad6
7 changed files with 14 additions and 14 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ blockstore_impl_t::blockstore_impl_t(blockstore_config_t & config, ring_loop_t *
dsk.open_meta(); dsk.open_meta();
dsk.open_journal(); dsk.open_journal();
calc_lengths(); calc_lengths();
data_alloc = new allocator(dsk.block_count); data_alloc = new allocator_t(dsk.block_count);
} }
catch (std::exception & e) catch (std::exception & e)
{ {
+1 -1
View File
@@ -279,7 +279,7 @@ class blockstore_impl_t
std::vector<obj_ver_id> unsynced_big_writes, unsynced_small_writes; std::vector<obj_ver_id> unsynced_big_writes, unsynced_small_writes;
int unsynced_big_write_count = 0, unstable_unsynced = 0; int unsynced_big_write_count = 0, unstable_unsynced = 0;
int unsynced_queued_ops = 0; int unsynced_queued_ops = 0;
allocator *data_alloc = NULL; allocator_t *data_alloc = NULL;
uint64_t used_blocks = 0; uint64_t used_blocks = 0;
uint8_t *zero_object; uint8_t *zero_object;
+1 -1
View File
@@ -60,7 +60,7 @@ struct disk_tool_t
bool first_block, first_entry; bool first_block, first_entry;
allocator *data_alloc; allocator_t *data_alloc;
std::map<uint64_t, uint64_t> data_remap; std::map<uint64_t, uint64_t> data_remap;
std::map<uint64_t, uint64_t>::iterator remap_it; std::map<uint64_t, uint64_t>::iterator remap_it;
ring_loop_t *ringloop; ring_loop_t *ringloop;
+1 -1
View File
@@ -27,7 +27,7 @@ int disk_tool_t::raw_resize()
return r; return r;
// Check parameters and fill allocator // Check parameters and fill allocator
fprintf(stderr, "Reading metadata\n"); fprintf(stderr, "Reading metadata\n");
data_alloc = new allocator((new_data_len < dsk.data_len ? dsk.data_len : new_data_len) / dsk.data_block_size); data_alloc = new allocator_t((new_data_len < dsk.data_len ? dsk.data_len : new_data_len) / dsk.data_block_size);
r = process_meta( r = process_meta(
[this](blockstore_meta_header_v2_t *hdr) [this](blockstore_meta_header_v2_t *hdr)
{ {
+1 -1
View File
@@ -7,7 +7,7 @@
void alloc_all(int size) void alloc_all(int size)
{ {
allocator *a = new allocator(size); allocator_t *a = new allocator_t(size);
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
{ {
uint64_t x = a->find_free(); uint64_t x = a->find_free();
+6 -6
View File
@@ -7,7 +7,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <malloc.h> #include <malloc.h>
allocator::allocator(uint64_t blocks) allocator_t::allocator_t(uint64_t blocks)
{ {
if (blocks >= 0x80000000 || blocks <= 1) if (blocks >= 0x80000000 || blocks <= 1)
{ {
@@ -32,12 +32,12 @@ allocator::allocator(uint64_t blocks)
} }
} }
allocator::~allocator() allocator_t::~allocator_t()
{ {
delete[] mask; delete[] mask;
} }
bool allocator::get(uint64_t addr) bool allocator_t::get(uint64_t addr)
{ {
if (addr >= size) if (addr >= size)
{ {
@@ -52,7 +52,7 @@ bool allocator::get(uint64_t addr)
return ((mask[offset + addr/64] >> (addr % 64)) & 1); return ((mask[offset + addr/64] >> (addr % 64)) & 1);
} }
void allocator::set(uint64_t addr, bool value) void allocator_t::set(uint64_t addr, bool value)
{ {
if (addr >= size) if (addr >= size)
{ {
@@ -109,7 +109,7 @@ void allocator::set(uint64_t addr, bool value)
} }
} }
uint64_t allocator::find_free() uint64_t allocator_t::find_free()
{ {
uint64_t p2 = 1, offset = 0, addr = 0, f, i; uint64_t p2 = 1, offset = 0, addr = 0, f, i;
while (p2 < size) while (p2 < size)
@@ -138,7 +138,7 @@ uint64_t allocator::find_free()
return addr; return addr;
} }
uint64_t allocator::get_free_count() uint64_t allocator_t::get_free_count()
{ {
return free; return free;
} }
+3 -3
View File
@@ -6,7 +6,7 @@
#include <stdint.h> #include <stdint.h>
// Hierarchical bitmap allocator // Hierarchical bitmap allocator
class allocator class allocator_t
{ {
uint64_t total; uint64_t total;
uint64_t size; uint64_t size;
@@ -14,8 +14,8 @@ class allocator
uint64_t last_one_mask; uint64_t last_one_mask;
uint64_t *mask; uint64_t *mask;
public: public:
allocator(uint64_t blocks); allocator_t(uint64_t blocks);
~allocator(); ~allocator_t();
bool get(uint64_t addr); bool get(uint64_t addr);
void set(uint64_t addr, bool value); void set(uint64_t addr, bool value);
uint64_t find_free(); uint64_t find_free();