if (_shared_bdev_alloc) {
ceph_assert(shared_bdev_alloc == nullptr);
alloc[id] = shared_bdev_alloc = _shared_bdev_alloc;
+ need_shared_alloc_init = true;
}
return 0;
}
vselector.reset(nullptr);
_stop_alloc();
_shutdown_logger();
-
- after_mkfs = true;
+ need_shared_alloc_init = false;
dout(10) << __func__ << " success" << dendl;
return 0;
dout(30) << __func__ << " noting alloc for " << p.second->fnode << dendl;
for (auto& q : p.second->fnode.extents) {
if (alloc[q.bdev] == shared_bdev_alloc) {
- if (!after_mkfs) {
+ if (need_shared_alloc_init) {
alloc[q.bdev]->init_rm_free(q.offset, q.length);
+ shared_bdev_used += q.length;
}
- shared_bdev_used += q.length;
} else {
alloc[q.bdev]->init_rm_free(q.offset, q.length);
}
}
}
+ need_shared_alloc_init = false;
dout(1) << __func__ << " shared_bdev_used = " << shared_bdev_used << dendl;
// set up the log for future writes
<< std::hex << log_writer->pos << std::dec
<< dendl;
- after_mkfs = false;
-
return 0;
out:
if (!noop) {
block_all[id].erase(offset, length);
_adjust_granularity(id, &offset, &length, false);
- if (length) {
+ if (length && alloc[id] != shared_bdev_alloc) {
alloc[id]->init_rm_free(offset, length);
}
if (cct->_conf->bluefs_log_replay_check_allocations) {
BlockDevice::aio_callback_t discard_cb[3]; //discard callbacks for each dev
std::unique_ptr<BlueFSVolumeSelector> vselector;
+ bool need_shared_alloc_init = false;
Allocator* shared_bdev_alloc = nullptr;
std::atomic<uint64_t> shared_bdev_used = 0;
+
class SocketHook;
SocketHook* asok_hook = nullptr;
- bool after_mkfs = false;
-
void _init_logger();
void _shutdown_logger();
void _update_logger_stats();