Assume that the array will be zeroed when the process starts, and
avoid the possibility that it will be zeroed *again* when the
ctors run for this link module (potentially clobbering values
that have been filled in by other ctors who ran earlier than
ours).
Signed-off-by: Sage Weil <sage@redhat.com>
// --------------------------------------------------------------
-static mempool::pool_t *pools[mempool::num_pools] = {
-#define P(x) nullptr,
- DEFINE_MEMORY_POOLS_HELPER(P)
-#undef P
-};
+// We rely on this array of pointers being zeroed when the process
+// starts *before* the ctors from *any* linked modules are executed.
+// That way, regardless of link order, pool_t's are allocated and
+// instantiated on demand.
+static mempool::pool_t *pools[mempool::num_pools];
mempool::pool_t& mempool::get_pool(mempool::pool_index_t ix)
{