HPA: Introduce a redesigned hpa_central_t.
For now, this only handles allocating virtual address space to shards, with no reuse. This is framework, though; it will change over time.
This commit is contained in:
committed by
David Goldblatt
parent
e09eac1d4e
commit
d93eef2f40
@@ -13,6 +13,7 @@ struct test_data_s {
|
||||
* test_data_t and the hpa_shard_t;
|
||||
*/
|
||||
hpa_shard_t shard;
|
||||
hpa_central_t central;
|
||||
base_t *base;
|
||||
edata_cache_t shard_edata_cache;
|
||||
|
||||
@@ -50,9 +51,12 @@ create_test_data(hpa_hooks_t *hooks, hpa_shard_opts_t *opts) {
|
||||
err = emap_init(&test_data->emap, test_data->base, /* zeroed */ false);
|
||||
assert_false(err, "");
|
||||
|
||||
err = hpa_shard_init(&test_data->shard, &test_data->emap,
|
||||
test_data->base, &test_data->shard_edata_cache, SHARD_IND,
|
||||
hooks, opts);
|
||||
err = hpa_central_init(&test_data->central, test_data->base, hooks);
|
||||
assert_false(err, "");
|
||||
|
||||
err = hpa_shard_init(&test_data->shard, &test_data->central,
|
||||
&test_data->emap, test_data->base, &test_data->shard_edata_cache,
|
||||
SHARD_IND, opts);
|
||||
assert_false(err, "");
|
||||
|
||||
return (hpa_shard_t *)test_data;
|
||||
|
@@ -40,6 +40,7 @@ init_test_extent_hooks(extent_hooks_t *hooks) {
|
||||
typedef struct test_data_s test_data_t;
|
||||
struct test_data_s {
|
||||
pa_shard_t shard;
|
||||
pa_central_t central;
|
||||
base_t *base;
|
||||
emap_t emap;
|
||||
pa_shard_stats_t stats;
|
||||
@@ -63,9 +64,13 @@ test_data_t *init_test_data(ssize_t dirty_decay_ms, ssize_t muzzy_decay_ms) {
|
||||
nstime_t time;
|
||||
nstime_init(&time, 0);
|
||||
|
||||
err = pa_central_init(&test_data->central, base, opt_hpa,
|
||||
&hpa_hooks_default);
|
||||
assert_false(err, "");
|
||||
|
||||
const size_t oversize_threshold = 8 * 1024 * 1024;
|
||||
err = pa_shard_init(TSDN_NULL, &test_data->shard, &test_data->emap,
|
||||
test_data->base, /* ind */ 1, &test_data->stats,
|
||||
err = pa_shard_init(TSDN_NULL, &test_data->shard, &test_data->central,
|
||||
&test_data->emap, test_data->base, /* ind */ 1, &test_data->stats,
|
||||
&test_data->stats_mtx, &time, oversize_threshold, dirty_decay_ms,
|
||||
muzzy_decay_ms);
|
||||
assert_false(err, "");
|
||||
|
Reference in New Issue
Block a user