}
//-----------------------------------------------------------------------------------
-int BlueStore::restore_allocator(Allocator* allocator, uint64_t *num, uint64_t *bytes)
+int BlueStore::__restore_allocator(Allocator* allocator, uint64_t *num, uint64_t *bytes)
{
utime_t start_time = ceph_clock_now();
BlueFS::FileReader *p_temp_handle = nullptr;
return 0;
}
+//-----------------------------------------------------------------------------------
+int BlueStore::restore_allocator(Allocator* dest_allocator, uint64_t *num, uint64_t *bytes)
+{
+ utime_t start = ceph_clock_now();
+ Allocator *temp_allocator = create_bitmap_allocator(bdev->get_size());
+ if (temp_allocator == nullptr) {
+ derr << "****failed create_bitmap_allocator()" << dendl;
+ return -1;
+ }
+
+ int ret = __restore_allocator(temp_allocator, num, bytes);
+ if (ret != 0) {
+ delete temp_allocator;
+ return ret;
+ }
+
+ uint64_t num_entries = 0;
+ dout(5) << " calling copy_allocator(bitmap_allocator -> shared_alloc.a)" << dendl;
+ copy_allocator(temp_allocator, dest_allocator, &num_entries);
+ delete temp_allocator;
+ utime_t duration = ceph_clock_now() - start;
+ dout(5) << " <<<FINISH>>> in " << duration << " seconds, num_entries=" << num_entries << dendl;
+ return ret;
+}
+
//-------------------------------------------------------------------------
void BlueStore::ExtentMap::provide_shard_info_to_onode(bufferlist v, uint32_t shard_id)
{
int copy_allocator(Allocator* src_alloc, Allocator *dest_alloc, uint64_t* p_num_entries);
int store_allocator(Allocator* allocator);
int invalidate_allocation_file_on_bluefs();
+ int __restore_allocator(Allocator* allocator, uint64_t *num, uint64_t *bytes);
int restore_allocator(Allocator* allocator, uint64_t *num, uint64_t *bytes);
int read_allocation_from_drive_on_startup();
int reconstruct_allocations(Allocator* allocator, read_alloc_stats_t &stats);