OPTION(bluestore_debug_misc, OPT_BOOL, false)
OPTION(bluestore_debug_no_reuse_blocks, OPT_BOOL, false)
OPTION(bluestore_debug_small_allocations, OPT_INT, 0)
+OPTION(bluestore_debug_freelist, OPT_BOOL, false)
OPTION(kstore_max_ops, OPT_U64, 512)
OPTION(kstore_max_bytes, OPT_U64, 64*1024*1024)
}
}
+void FreelistManager::_audit()
+{
+ assert(lock.is_locked());
+ uint64_t sum = 0;
+ for (auto& p : kv_free) {
+ sum += p.second;
+ }
+ if (total_free != sum) {
+ derr << __func__ << " sum " << sum << " != total_free " << total_free
+ << dendl;
+ derr << kv_free << dendl;
+ assert(0 == "freelistmanager bug");
+ }
+}
+
int FreelistManager::allocate(
uint64_t offset, uint64_t length,
KeyValueDB::Transaction txn)
}
p->second = newlen;
}
-
+ if (g_conf->bluestore_debug_freelist)
+ _audit();
return 0;
}
dout(20) << __func__ << " set " << offset << "~" << length << dendl;
kv_free[offset] = length;
+
+ if (g_conf->bluestore_debug_freelist)
+ _audit();
return 0;
}
std::map<uint64_t, uint64_t> kv_free; ///< mirrors our kv values in the db
+ void _audit();
+
public:
FreelistManager() :
lock("FreelistManager::lock"),
g_ceph_context->_conf->set_val("bluestore_fsck_on_umount", "true");
g_ceph_context->_conf->set_val("bluestore_debug_misc", "true");
g_ceph_context->_conf->set_val("bluestore_debug_small_allocations", "4");
+ g_ceph_context->_conf->set_val("bluestore_debug_freelist", "true");
g_ceph_context->_conf->set_val(
"enable_experimental_unrecoverable_data_corrupting_features", "*");
g_ceph_context->_conf->apply_changes(NULL);