return false;
}
} else {
- m_cache_state->present = true;
+ ceph_assert(m_cache_state->present);
r = create_and_open_bdev();
if (r < 0) {
on_finish->complete(r);
lderr(m_image_ctx.cct) << "failed to remove empty pool \""
<< this->m_log_pool_name << "\": " << dendl;
} else {
- m_cache_state->clean = true;
- m_cache_state->empty = true;
m_cache_state->present = false;
}
} else {
for (auto &operation : ops) {
auto &log_entry = operation->get_log_entry();
- log_entry->ram_entry.entry_valid = 1;
+ log_entry->ram_entry.set_entry_valid(true);
m_log_entries.push_back(log_entry);
ldout(m_image_ctx.cct, 20) << "operation=[" << *operation << "]" << dendl;
}
+ if (m_cache_state->empty && !m_log_entries.empty()) {
+ m_cache_state->empty = false;
+ this->update_image_cache_state();
+ }
}
template <typename I>
this->m_bytes_allocated -= allocated_bytes;
ceph_assert(this->m_bytes_cached >= cached_bytes);
this->m_bytes_cached -= cached_bytes;
+ if (!m_cache_state->empty && m_log_entries.empty()) {
+ m_cache_state->empty = true;
+ this->update_image_cache_state();
+ }
ldout(m_image_ctx.cct, 20)
<< "Finished root update: initial_first_valid_entry="