Reformat the codebase with the clang-format 18.

This commit is contained in:
guangli-dai
2025-06-13 12:31:12 -07:00
committed by Guangli Dai
parent a952a3b8b0
commit 6200e8987f
346 changed files with 18286 additions and 17770 deletions

View File

@@ -16,8 +16,8 @@ merge_hook(extent_hooks_t *extent_hooks, void *addr_a, size_t size_a,
}
static bool
split_hook(extent_hooks_t *extent_hooks, void *addr, size_t size,
size_t size_a, size_t size_b, bool committed, unsigned arena_ind) {
split_hook(extent_hooks_t *extent_hooks, void *addr, size_t size, size_t size_a,
size_t size_b, bool committed, unsigned arena_ind) {
return !maps_coalesce;
}
@@ -39,13 +39,13 @@ 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_t shard;
pa_central_t central;
base_t *base;
emap_t emap;
pa_shard_stats_t stats;
malloc_mutex_t stats_mtx;
extent_hooks_t hooks;
malloc_mutex_t stats_mtx;
extent_hooks_t hooks;
};
static test_data_t *
@@ -66,8 +66,8 @@ 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);
err = pa_central_init(
&test_data->central, base, opt_hpa, &hpa_hooks_default);
assert_false(err, "");
const size_t pa_oversize_threshold = 8 * 1024 * 1024;
@@ -80,7 +80,8 @@ init_test_data(ssize_t dirty_decay_ms, ssize_t muzzy_decay_ms) {
return test_data;
}
void destroy_test_data(test_data_t *data) {
void
destroy_test_data(test_data_t *data) {
base_delete(TSDN_NULL, data->base);
free(data);
}
@@ -89,28 +90,28 @@ static void *
do_alloc_free_purge(void *arg) {
test_data_t *test_data = (test_data_t *)arg;
for (int i = 0; i < 10 * 1000; i++) {
bool deferred_work_generated = false;
bool deferred_work_generated = false;
edata_t *edata = pa_alloc(TSDN_NULL, &test_data->shard, PAGE,
PAGE, /* slab */ false, /* szind */ 0, /* zero */ false,
/* guarded */ false, &deferred_work_generated);
assert_ptr_not_null(edata, "");
pa_dalloc(TSDN_NULL, &test_data->shard, edata,
&deferred_work_generated);
malloc_mutex_lock(TSDN_NULL,
&test_data->shard.pac.decay_dirty.mtx);
malloc_mutex_lock(
TSDN_NULL, &test_data->shard.pac.decay_dirty.mtx);
pac_decay_all(TSDN_NULL, &test_data->shard.pac,
&test_data->shard.pac.decay_dirty,
&test_data->shard.pac.stats->decay_dirty,
&test_data->shard.pac.ecache_dirty, true);
malloc_mutex_unlock(TSDN_NULL,
&test_data->shard.pac.decay_dirty.mtx);
malloc_mutex_unlock(
TSDN_NULL, &test_data->shard.pac.decay_dirty.mtx);
}
return NULL;
}
TEST_BEGIN(test_alloc_free_purge_thds) {
test_data_t *test_data = init_test_data(0, 0);
thd_t thds[4];
thd_t thds[4];
for (int i = 0; i < 4; i++) {
thd_create(&thds[i], do_alloc_free_purge, test_data);
}
@@ -122,6 +123,5 @@ TEST_END
int
main(void) {
return test(
test_alloc_free_purge_thds);
return test(test_alloc_free_purge_thds);
}