diff --git a/src/btree.c b/src/btree.c index 8086492f..ca919548 100644 --- a/src/btree.c +++ b/src/btree.c @@ -2088,7 +2088,7 @@ btree_lookup_node(cache *cc, // IN * - state->child_node: the child node */ static inline async_status -btree_lookup_node_async2(btree_lookup_async2_state *state, uint64 depth) +btree_lookup_node_async(btree_lookup_async_state *state, uint64 depth) { async_begin(state, depth); @@ -2100,19 +2100,19 @@ btree_lookup_node_async2(btree_lookup_async2_state *state, uint64 depth) || state->type == PAGE_TYPE_MEMTABLE); state->node.addr = state->root_addr; - cache_get_async2_state_init(state->cache_get_state, - state->cc, - state->node.addr, - state->type, - state->callback, - state->callback_arg); - while (cache_get_async2(state->cc, state->cache_get_state) + cache_get_async_state_init(state->cache_get_state, + state->cc, + state->node.addr, + state->type, + state->callback, + state->callback_arg); + while (cache_get_async(state->cc, state->cache_get_state) != ASYNC_STATUS_DONE) { async_yield(state); } state->node.page = - cache_get_async2_state_result(state->cc, state->cache_get_state); + cache_get_async_state_result(state->cc, state->cache_get_state); state->node.hdr = (btree_hdr *)state->node.page->data; for (state->h = btree_height(state->node.hdr); @@ -2137,19 +2137,19 @@ btree_lookup_node_async2(btree_lookup_async2_state *state, uint64 depth) } - cache_get_async2_state_init(state->cache_get_state, - state->cc, - state->child_node.addr, - state->type, - state->callback, - state->callback_arg); - while (cache_get_async2(state->cc, state->cache_get_state) + cache_get_async_state_init(state->cache_get_state, + state->cc, + state->child_node.addr, + state->type, + state->callback, + state->callback_arg); + while (cache_get_async(state->cc, state->cache_get_state) != ASYNC_STATUS_DONE) { async_yield(state); } state->child_node.page = - cache_get_async2_state_result(state->cc, state->cache_get_state); + cache_get_async_state_result(state->cc, state->cache_get_state); state->child_node.hdr = (btree_hdr *)state->child_node.page->data; debug_assert(state->child_node.page->disk_addr == state->child_node.addr); @@ -2180,13 +2180,13 @@ btree_lookup_node_async2(btree_lookup_async2_state *state, uint64 depth) * - state->child_node: the child node */ static inline async_status -btree_lookup_with_ref_async2(btree_lookup_async2_state *state, uint64 depth) +btree_lookup_with_ref_async(btree_lookup_async_state *state, uint64 depth) { async_begin(state, depth); state->stop_at_height = 0; state->stats = NULL; - async_await_subroutine(state, btree_lookup_node_async2); + async_await_subroutine(state, btree_lookup_node_async); int64 idx = btree_find_tuple( state->cfg, state->node.hdr, state->target, &state->found); @@ -2221,11 +2221,11 @@ btree_lookup_with_ref(cache *cc, // IN } async_status -btree_lookup_async2(btree_lookup_async2_state *state) +btree_lookup_async(btree_lookup_async_state *state) { async_begin(state, 0); - async_await_subroutine(state, btree_lookup_with_ref_async2); + async_await_subroutine(state, btree_lookup_with_ref_async); bool32 success = TRUE; if (state->found) { success = merge_accumulator_copy_message(state->result, state->msg); @@ -2267,7 +2267,7 @@ btree_lookup(cache *cc, // IN // merge_accumulator *result) // OUT // { // return async_call_sync_callback(cache_cleanup(cc), -// btree_lookup_async2, +// btree_lookup_async, // cc, // cfg, // root_addr, @@ -2329,11 +2329,11 @@ btree_lookup_and_merge(cache *cc, // IN * - state->msg: the message of the target */ async_status -btree_lookup_and_merge_async2(btree_lookup_async2_state *state) +btree_lookup_and_merge_async(btree_lookup_async_state *state) { async_begin(state, 0); - async_await_subroutine(state, btree_lookup_with_ref_async2); + async_await_subroutine(state, btree_lookup_with_ref_async); platform_status rc = STATUS_OK; if (state->found) { diff --git a/src/btree.h b/src/btree.h index d7da7764..5b3af0de 100644 --- a/src/btree.h +++ b/src/btree.h @@ -224,7 +224,7 @@ btree_lookup_and_merge(cache *cc, bool32 *local_found); // clang-format off -DEFINE_ASYNC_STATE(btree_lookup_async2_state, 3, +DEFINE_ASYNC_STATE(btree_lookup_async_state, 3, param, cache *, cc, param, const btree_config *, cfg, param, uint64, root_addr, @@ -241,29 +241,29 @@ DEFINE_ASYNC_STATE(btree_lookup_async2_state, 3, local, uint32, h, local, bool32, found, local, message, msg, - local, page_get_async2_state_buffer, cache_get_state) + local, page_get_async_state_buffer, cache_get_state) // clang-format on static inline void -btree_lookup_and_merge_async2_state_init(btree_lookup_async2_state *state, - cache *cc, - const btree_config *cfg, - uint64 root_addr, - page_type type, - key target, - merge_accumulator *result, - async_callback_fn callback, - void *callback_arg) +btree_lookup_and_merge_async_state_init(btree_lookup_async_state *state, + cache *cc, + const btree_config *cfg, + uint64 root_addr, + page_type type, + key target, + merge_accumulator *result, + async_callback_fn callback, + void *callback_arg) { - btree_lookup_async2_state_init( + btree_lookup_async_state_init( state, cc, cfg, root_addr, type, target, result, callback, callback_arg); } async_status -btree_lookup_async2(btree_lookup_async2_state *state); +btree_lookup_async(btree_lookup_async_state *state); async_status -btree_lookup_and_merge_async2(btree_lookup_async2_state *state); +btree_lookup_and_merge_async(btree_lookup_async_state *state); void btree_iterator_init(cache *cc, diff --git a/src/cache.h b/src/cache.h index ef7cf6b6..e85f7aa2 100644 --- a/src/cache.h +++ b/src/cache.h @@ -107,18 +107,17 @@ typedef page_handle *(*page_get_fn)(cache *cc, bool32 blocking, page_type type); -#define PAGE_GET_ASYNC2_STATE_BUFFER_SIZE (2048) -typedef uint8 page_get_async2_state_buffer[PAGE_GET_ASYNC2_STATE_BUFFER_SIZE]; -typedef void (*page_get_async2_state_init_fn)( - page_get_async2_state_buffer buffer, - cache *cc, - uint64 addr, - page_type type, - async_callback_fn callback, - void *callback_arg); -typedef async_status (*page_get_async2_fn)(page_get_async2_state_buffer buffer); -typedef page_handle *(*page_get_async2_state_result_fn)( - page_get_async2_state_buffer buffer); +#define PAGE_GET_ASYNC_STATE_BUFFER_SIZE (2048) +typedef uint8 page_get_async_state_buffer[PAGE_GET_ASYNC_STATE_BUFFER_SIZE]; +typedef void (*page_get_async_state_init_fn)(page_get_async_state_buffer buffer, + cache *cc, + uint64 addr, + page_type type, + async_callback_fn callback, + void *callback_arg); +typedef async_status (*page_get_async_fn)(page_get_async_state_buffer buffer); +typedef page_handle *(*page_get_async_state_result_fn)( + page_get_async_state_buffer buffer); typedef bool32 (*page_try_claim_fn)(cache *cc, page_handle *page); typedef void (*page_sync_fn)(cache *cc, @@ -151,9 +150,9 @@ typedef struct cache_ops { extent_discard_fn extent_discard; page_get_fn page_get; - page_get_async2_state_init_fn page_get_async2_state_init; - page_get_async2_fn page_get_async2; - page_get_async2_state_result_fn page_get_async2_result; + page_get_async_state_init_fn page_get_async_state_init; + page_get_async_fn page_get_async; + page_get_async_state_result_fn page_get_async_result; page_generic_fn page_unget; page_try_claim_fn page_try_claim; @@ -261,27 +260,27 @@ cache_get(cache *cc, uint64 addr, bool32 blocking, page_type type) } static inline void -cache_get_async2_state_init(page_get_async2_state_buffer buffer, - cache *cc, - uint64 addr, - page_type type, - async_callback_fn callback, - void *callback_arg) -{ - return cc->ops->page_get_async2_state_init( +cache_get_async_state_init(page_get_async_state_buffer buffer, + cache *cc, + uint64 addr, + page_type type, + async_callback_fn callback, + void *callback_arg) +{ + return cc->ops->page_get_async_state_init( buffer, cc, addr, type, callback, callback_arg); } static inline async_status -cache_get_async2(cache *cc, page_get_async2_state_buffer buffer) +cache_get_async(cache *cc, page_get_async_state_buffer buffer) { - return cc->ops->page_get_async2(buffer); + return cc->ops->page_get_async(buffer); } static inline page_handle * -cache_get_async2_state_result(cache *cc, page_get_async2_state_buffer buffer) +cache_get_async_state_result(cache *cc, page_get_async_state_buffer buffer) { - return cc->ops->page_get_async2_result(buffer); + return cc->ops->page_get_async_result(buffer); } /* diff --git a/src/clockcache.c b/src/clockcache.c index cb046a6f..bae38e92 100644 --- a/src/clockcache.c +++ b/src/clockcache.c @@ -1764,7 +1764,7 @@ clockcache_get(clockcache *cc, uint64 addr, bool32 blocking, page_type type) */ // clang-format off -DEFINE_ASYNC_STATE(clockcache_get_async2_state, 3, +DEFINE_ASYNC_STATE(clockcache_get_async_state, 3, param, clockcache *, cc, param, uint64, addr, param, page_type, type, @@ -1783,9 +1783,9 @@ DEFINE_ASYNC_STATE(clockcache_get_async2_state, 3, local, async_waiter, wait_node) // clang-format on -_Static_assert(sizeof(clockcache_get_async2_state) - <= PAGE_GET_ASYNC2_STATE_BUFFER_SIZE, - "clockcache_get_async2_state is too large"); +_Static_assert(sizeof(clockcache_get_async_state) + <= PAGE_GET_ASYNC_STATE_BUFFER_SIZE, + "clockcache_get_async_state is too large"); /* @@ -1793,7 +1793,7 @@ _Static_assert(sizeof(clockcache_get_async2_state) * retry the get from the beginning, TRUE if we succeeded. */ static async_status -clockcache_get_in_cache_async(clockcache_get_async2_state *state, uint64 depth) +clockcache_get_in_cache_async(clockcache_get_async_state *state, uint64 depth) { async_begin(state, depth); @@ -1846,13 +1846,13 @@ clockcache_get_in_cache_async(clockcache_get_async2_state *state, uint64 depth) void clockcache_get_from_disk_async_callback(void *arg) { - clockcache_get_async2_state *state = (clockcache_get_async2_state *)arg; + clockcache_get_async_state *state = (clockcache_get_async_state *)arg; clockcache_finish_load(state->cc, state->addr, state->entry_number); state->callback(state->callback_arg); } static async_status -clockcache_get_from_disk_async(clockcache_get_async2_state *state, uint64 depth) +clockcache_get_from_disk_async(clockcache_get_async_state *state, uint64 depth) { async_begin(state, depth); @@ -1896,7 +1896,7 @@ clockcache_get_from_disk_async(clockcache_get_async2_state *state, uint64 depth) // Result is TRUE if successful, FALSE otherwise static async_status -clockcache_get_internal_async(clockcache_get_async2_state *state, uint64 depth) +clockcache_get_internal_async(clockcache_get_async_state *state, uint64 depth) { async_begin(state, depth); @@ -1944,7 +1944,7 @@ clockcache_get_internal_async(clockcache_get_async2_state *state, uint64 depth) } async_status -clockcache_get_async2(clockcache_get_async2_state *state) +clockcache_get_async(clockcache_get_async_state *state) { async_begin(state, 0); @@ -2836,31 +2836,31 @@ clockcache_unpin_virtual(cache *c, page_handle *page) } static void -clockcache_get_async2_state_init_virtual(page_get_async2_state_buffer buffer, - cache *cc, - uint64 addr, - page_type type, - async_callback_fn callback, - void *callback_arg) +clockcache_get_async_state_init_virtual(page_get_async_state_buffer buffer, + cache *cc, + uint64 addr, + page_type type, + async_callback_fn callback, + void *callback_arg) { - clockcache_get_async2_state_init((clockcache_get_async2_state *)buffer, - (clockcache *)cc, - addr, - type, - callback, - callback_arg); + clockcache_get_async_state_init((clockcache_get_async_state *)buffer, + (clockcache *)cc, + addr, + type, + callback, + callback_arg); } static async_status -clockcache_get_async2_virtual(page_get_async2_state_buffer buffer) +clockcache_get_async_virtual(page_get_async_state_buffer buffer) { - return clockcache_get_async2((clockcache_get_async2_state *)buffer); + return clockcache_get_async((clockcache_get_async_state *)buffer); } static page_handle * -clockcache_get_async2_state_result_virtual(page_get_async2_state_buffer buffer) +clockcache_get_async_state_result_virtual(page_get_async_state_buffer buffer) { - clockcache_get_async2_state *state = (clockcache_get_async2_state *)buffer; + clockcache_get_async_state *state = (clockcache_get_async_state *)buffer; return state->__async_result; } @@ -2998,9 +2998,9 @@ static cache_ops clockcache_ops = { .extent_discard = clockcache_extent_discard_virtual, .page_get = clockcache_get_virtual, - .page_get_async2_state_init = clockcache_get_async2_state_init_virtual, - .page_get_async2 = clockcache_get_async2_virtual, - .page_get_async2_result = clockcache_get_async2_state_result_virtual, + .page_get_async_state_init = clockcache_get_async_state_init_virtual, + .page_get_async = clockcache_get_async_virtual, + .page_get_async_result = clockcache_get_async_state_result_virtual, .page_unget = clockcache_unget_virtual, .page_try_claim = clockcache_try_claim_virtual, diff --git a/src/routing_filter.c b/src/routing_filter.c index 2da93466..86f48499 100644 --- a/src/routing_filter.c +++ b/src/routing_filter.c @@ -828,8 +828,7 @@ routing_filter_estimate_unique_fp(cache *cc, } static inline async_status -routing_get_header_async2(routing_filter_lookup_async2_state *state, - uint64 depth) +routing_get_header_async(routing_filter_lookup_async_state *state, uint64 depth) { async_begin(state, depth); @@ -840,19 +839,19 @@ routing_get_header_async2(routing_filter_lookup_async2_state *state, state->filter.addr + state->page_size * (state->index / state->addrs_per_page); - cache_get_async2_state_init(state->cache_get_state, - state->cc, - state->index_addr, - PAGE_TYPE_FILTER, - state->callback, - state->callback_arg); - while (cache_get_async2(state->cc, state->cache_get_state) + cache_get_async_state_init(state->cache_get_state, + state->cc, + state->index_addr, + PAGE_TYPE_FILTER, + state->callback, + state->callback_arg); + while (cache_get_async(state->cc, state->cache_get_state) != ASYNC_STATUS_DONE) { async_yield(state); } state->index_page = - cache_get_async2_state_result(state->cc, state->cache_get_state); + cache_get_async_state_result(state->cc, state->cache_get_state); state->hdr_raw_addr = ((uint64 *)state->index_page->data)[state->index % state->addrs_per_page]; @@ -860,19 +859,19 @@ routing_get_header_async2(routing_filter_lookup_async2_state *state, state->header_addr = state->hdr_raw_addr - (state->hdr_raw_addr % state->page_size); - cache_get_async2_state_init(state->cache_get_state, - state->cc, - state->header_addr, - PAGE_TYPE_FILTER, - state->callback, - state->callback_arg); - while (cache_get_async2(state->cc, state->cache_get_state) + cache_get_async_state_init(state->cache_get_state, + state->cc, + state->header_addr, + PAGE_TYPE_FILTER, + state->callback, + state->callback_arg); + while (cache_get_async(state->cc, state->cache_get_state) != ASYNC_STATUS_DONE) { async_yield(state); } state->filter_page = - cache_get_async2_state_result(state->cc, state->cache_get_state); + cache_get_async_state_result(state->cc, state->cache_get_state); uint64 header_off = state->hdr_raw_addr - state->header_addr; state->hdr = (routing_hdr *)(state->filter_page->data + header_off); @@ -882,7 +881,7 @@ routing_get_header_async2(routing_filter_lookup_async2_state *state, async_status -routing_filter_lookup_async2(routing_filter_lookup_async2_state *state) +routing_filter_lookup_async(routing_filter_lookup_async_state *state) { async_begin(state, 0); @@ -907,7 +906,7 @@ routing_filter_lookup_async2(routing_filter_lookup_async2_state *state) state->index = routing_get_index(state->fp << state->filter.value_size, index_remainder_and_value_size); - async_await_subroutine(state, routing_get_header_async2); + async_await_subroutine(state, routing_get_header_async); uint64 encoding_size = (state->hdr->num_remainders + state->cfg->index_size - 1) / 8 + 4; @@ -980,7 +979,7 @@ routing_filter_lookup(cache *cc, { #if 0 return async_call_sync_callback(cache_cleanup(cc), - routing_filter_lookup_async2, + routing_filter_lookup_async, cc, cfg, *filter, diff --git a/src/routing_filter.h b/src/routing_filter.h index 899d0ef9..ac749c0f 100644 --- a/src/routing_filter.h +++ b/src/routing_filter.h @@ -101,7 +101,7 @@ routing_filters_equal(const routing_filter *f1, const routing_filter *f2) } // clang-format off -DEFINE_ASYNC_STATE(routing_filter_lookup_async2_state, 2, +DEFINE_ASYNC_STATE(routing_filter_lookup_async_state, 2, param, cache *, cc, param, const routing_config *, cfg, param, routing_filter, filter, @@ -122,11 +122,11 @@ DEFINE_ASYNC_STATE(routing_filter_lookup_async2_state, 2, local, uint64, hdr_raw_addr, local, uint64, header_addr, local, page_handle *, index_page, - local, page_get_async2_state_buffer, cache_get_state) + local, page_get_async_state_buffer, cache_get_state) // clang-format on async_status -routing_filter_lookup_async2(routing_filter_lookup_async2_state *state); +routing_filter_lookup_async(routing_filter_lookup_async_state *state); void routing_filter_dec_ref(cache *cc, routing_filter *filter); diff --git a/src/trunk.c b/src/trunk.c index 8f7133d0..5e7601a2 100644 --- a/src/trunk.c +++ b/src/trunk.c @@ -1729,7 +1729,7 @@ trunk_insert(trunk_handle *spl, key tuple_key, message data) } // If any change is made in here, please make similar change in -// trunk_lookup_async2 +// trunk_lookup_async platform_status trunk_lookup(trunk_handle *spl, key target, merge_accumulator *result) { @@ -1803,7 +1803,7 @@ trunk_lookup(trunk_handle *spl, key target, merge_accumulator *result) } async_status -trunk_lookup_async2(trunk_lookup_async2_state *state) +trunk_lookup_async(trunk_lookup_async_state *state) { async_begin(state, 0); // look in memtables diff --git a/src/trunk.h b/src/trunk.h index 49a2f68d..6d1787a6 100644 --- a/src/trunk.h +++ b/src/trunk.h @@ -238,7 +238,7 @@ trunk_lookup_found(merge_accumulator *result) } // clang-format off -DEFINE_ASYNC_STATE(trunk_lookup_async2_state, 1, +DEFINE_ASYNC_STATE(trunk_lookup_async_state, 1, param, trunk_handle *, spl, param, key, target, param, merge_accumulator *, result, @@ -250,7 +250,7 @@ DEFINE_ASYNC_STATE(trunk_lookup_async2_state, 1, // clang-format on async_status -trunk_lookup_async2(trunk_lookup_async2_state *state); +trunk_lookup_async(trunk_lookup_async_state *state); platform_status trunk_range_iterator_init(trunk_handle *spl, diff --git a/src/trunk_node.c b/src/trunk_node.c index c64af782..e99eec01 100644 --- a/src/trunk_node.c +++ b/src/trunk_node.c @@ -898,19 +898,19 @@ ondisk_node_handle_init_async(trunk_merge_lookup_async_state *state, platform_assert(state->pivot->child_addr != 0); state->child_handle.cc = state->context->cc; - cache_get_async2_state_init(state->cache_get_state, - state->context->cc, - state->pivot->child_addr, - PAGE_TYPE_TRUNK, - state->callback, - state->callback_arg); - while (cache_get_async2(state->context->cc, state->cache_get_state) + cache_get_async_state_init(state->cache_get_state, + state->context->cc, + state->pivot->child_addr, + PAGE_TYPE_TRUNK, + state->callback, + state->callback_arg); + while (cache_get_async(state->context->cc, state->cache_get_state) != ASYNC_STATUS_DONE) { async_yield(state); } state->child_handle.header_page = - cache_get_async2_state_result(state->context->cc, state->cache_get_state); + cache_get_async_state_result(state->context->cc, state->cache_get_state); if (state->child_handle.header_page == NULL) { platform_error_log("%s():%d: cache_get() failed", __func__, __LINE__); state->rc = STATUS_IO_ERROR; @@ -1051,19 +1051,19 @@ ondisk_node_handle_setup_content_page_async( } else { uint64 addr = state->handle.header_page->disk_addr + state->offset; addr -= (addr % page_size); - cache_get_async2_state_init(state->cache_get_state, - state->handle.cc, - addr, - PAGE_TYPE_TRUNK, - state->callback, - state->callback_arg); - while (cache_get_async2(state->handle.cc, state->cache_get_state) + cache_get_async_state_init(state->cache_get_state, + state->handle.cc, + addr, + PAGE_TYPE_TRUNK, + state->callback, + state->callback_arg); + while (cache_get_async(state->handle.cc, state->cache_get_state) != ASYNC_STATUS_DONE) { async_yield(state); } - *state->page = cache_get_async2_state_result(state->handle.cc, - state->cache_get_state); + *state->page = + cache_get_async_state_result(state->handle.cc, state->cache_get_state); if (*state->page == NULL) { platform_error_log("%s():%d: cache_get() failed", __func__, __LINE__); state->rc = STATUS_IO_ERROR; @@ -1698,7 +1698,8 @@ node_inc_all_refs(trunk_node_context *context, trunk_node *node) } uint64 inflight_start = node_first_live_inflight_bundle(node); for (uint64 i = inflight_start; i < vector_length(&node->inflight_bundles); - i++) { + i++) + { bundle *bndl = vector_get_ptr(&node->inflight_bundles, i); bundle_inc_all_refs(context, bndl); } @@ -3347,7 +3348,8 @@ bundle_compaction_task(void *arg, void *scratch) } pivot_state_lock_compactions(state); if (bc->state == BUNDLE_COMPACTION_SUCCEEDED - && state->bundle_compactions == bc) { + && state->bundle_compactions == bc) + { enqueue_maplet_compaction(state); } pivot_state_unlock_compactions(state); @@ -4871,7 +4873,7 @@ ondisk_bundle_merge_lookup_async(trunk_merge_lookup_async_state *state, async_begin(state, depth); async_await_call(state, - routing_filter_lookup_async2, + routing_filter_lookup_async, &state->filter_state, state->context->cc, state->context->cfg->filter_cfg, @@ -4905,7 +4907,7 @@ ondisk_bundle_merge_lookup_async(trunk_merge_lookup_async_state *state, routing_filter_get_next_value(state->found_values, state->idx)) { async_await_call(state, - btree_lookup_and_merge_async2, + btree_lookup_and_merge_async, &state->btree_state, state->context->cc, state->context->cfg->btree_cfg, @@ -5158,7 +5160,8 @@ trunk_merge_lookup_async(trunk_merge_lookup_async_state *state) goto cleanup; } if (state->inflight_bundle_num - < state->pivot->num_live_inflight_bundles - 1) { + < state->pivot->num_live_inflight_bundles - 1) + { async_await_subroutine(state, ondisk_node_get_next_inflight_bundle_async); if (state->bndl == NULL) { @@ -5631,9 +5634,9 @@ typedef struct column { } column; #define COLUMN(name, data) \ - _Generic((data)[0], uint64 \ - : (column){name, INT, {.integer = (uint64 *)(data)}, 0}, fraction \ - : (column){name, FRACTION, {.frac = (fraction *)(data)}, 0}) + _Generic((data)[0], \ + uint64: (column){name, INT, {.integer = (uint64 *)(data)}, 0}, \ + fraction: (column){name, FRACTION, {.frac = (fraction *)(data)}, 0}) static void compute_column_width(column *col, uint64 num_rows) diff --git a/src/trunk_node.h b/src/trunk_node.h index 0d22a720..9b77707e 100644 --- a/src/trunk_node.h +++ b/src/trunk_node.h @@ -278,7 +278,7 @@ DEFINE_ASYNC_STATE(trunk_merge_lookup_async_state, 4, local, uint64, offset, local, page_handle **, page, local, uint64, pivot_num, - local, page_get_async2_state_buffer, cache_get_state, + local, page_get_async_state_buffer, cache_get_state, // ondisk_node_find_pivot //local, comparison, cmp, local, uint64, min, @@ -290,8 +290,8 @@ DEFINE_ASYNC_STATE(trunk_merge_lookup_async_state, 4, // ondisk_bundle_merge_lookup local, uint64, found_values, local, uint64, idx, - local, routing_filter_lookup_async2_state, filter_state, - local, btree_lookup_async2_state, btree_state, + local, routing_filter_lookup_async_state, filter_state, + local, btree_lookup_async_state, btree_state, ) // clang-format on diff --git a/tests/functional/btree_test.c b/tests/functional/btree_test.c index 4ef3ddfe..aeadbf7a 100644 --- a/tests/functional/btree_test.c +++ b/tests/functional/btree_test.c @@ -306,10 +306,10 @@ test_btree_perf(cache *cc, // A single async context typedef struct { - btree_lookup_async2_state ctxt; - bool32 ready; - key_buffer keybuf; - merge_accumulator result; + btree_lookup_async_state ctxt; + bool32 ready; + key_buffer keybuf; + merge_accumulator result; } btree_test_async_ctxt; // Per-table array of async contexts @@ -419,7 +419,7 @@ btree_test_run_pending(cache *cc, continue; } ctxt->ready = FALSE; - res = btree_lookup_async2(&ctxt->ctxt); + res = btree_lookup_async(&ctxt->ctxt); if (res == ASYNC_STATUS_DONE) { bool32 local_found = btree_found(&ctxt->result); if (local_found ^ expected_found) { @@ -473,18 +473,18 @@ test_btree_async_lookup(cache *cc, async_status res; key target = key_buffer_key(&async_ctxt->keybuf); - btree_lookup_async2_state_init(&async_ctxt->ctxt, - cc, - cfg, - root_addr, - PAGE_TYPE_BRANCH, - target, - &async_ctxt->result, - btree_test_async_callback, - async_ctxt); + btree_lookup_async_state_init(&async_ctxt->ctxt, + cc, + cfg, + root_addr, + PAGE_TYPE_BRANCH, + target, + &async_ctxt->result, + btree_test_async_callback, + async_ctxt); async_ctxt->ready = FALSE; - res = btree_lookup_async2(&async_ctxt->ctxt); + res = btree_lookup_async(&async_ctxt->ctxt); if (res == ASYNC_STATUS_DONE) { *correct = btree_found(&async_ctxt->result) == expected_found; btree_test_put_async_ctxt(async_lookup, async_ctxt); diff --git a/tests/functional/cache_test.c b/tests/functional/cache_test.c index d59b1b1f..4d62d9a9 100644 --- a/tests/functional/cache_test.c +++ b/tests/functional/cache_test.c @@ -572,7 +572,7 @@ test_cache_flush(cache *cc, #define READER_BATCH_SIZE 32 typedef struct { - page_get_async2_state_buffer buffer; + page_get_async_state_buffer buffer; enum { waiting_on_io, ready_to_continue, done } status; } test_async_ctxt; @@ -613,43 +613,17 @@ test_wait_inflight(test_params *params, if (ctxt->status == waiting_on_io) { cache_cleanup(params->cc); } else if (ctxt->status == ready_to_continue) { - async_status res = cache_get_async2(params->cc, ctxt->buffer); + async_status res = cache_get_async(params->cc, ctxt->buffer); if (res == ASYNC_STATUS_DONE) { ctxt->status = done; } } } params->handle_arr[j] = - cache_get_async2_state_result(params->cc, ctxt->buffer); + cache_get_async_state_result(params->cc, ctxt->buffer); } } -// Abandon a batch of async lookups we issued -// static void -// test_abandon_read_batch(test_params *params, -// uint64 batch_start, -// uint64 batch_end, // exclusive -// bool32 was_async[]) -// { -// page_handle **handle_arr = params->handle_arr; -// const uint64 *addr_arr = params->addr_arr; -// cache *cc = params->cc; -// uint64 j; - -// test_wait_inflight(params, batch_end); - -// // Unget all pages we have in the batch -// for (j = 0; j < batch_end; j++) { -// test_async_ctxt *ctxt = ¶ms->ctxt[j]; -// handle_arr[batch_start + j] = -// cache_get_async2_state_result(params->cc, ctxt->buffer); -// platform_assert(handle_arr[batch_start + j]); -// cache_unget(cc, handle_arr[batch_start + j]); -// handle_arr[batch_start + j] = NULL; -// cache_assert_ungot(cc, addr_arr[batch_start + j]); -// } -// } - // Do async reads for a batch of addresses, and wait for them to complete static bool32 test_do_read_batch(threadid tid, test_params *params, uint64 batch_start) @@ -673,17 +647,17 @@ test_do_read_batch(threadid tid, test_params *params, uint64 batch_start) cache_get(cc, addr_arr[j], TRUE, PAGE_TYPE_MISC); ctxt->status = done; } else { - cache_get_async2_state_init(ctxt->buffer, - cc, - addr_arr[j], - PAGE_TYPE_MISC, - test_async_callback, - ¶ms->ctxt[j]); + cache_get_async_state_init(ctxt->buffer, + cc, + addr_arr[j], + PAGE_TYPE_MISC, + test_async_callback, + ¶ms->ctxt[j]); ctxt->status = waiting_on_io; - res = cache_get_async2(cc, ctxt->buffer); + res = cache_get_async(cc, ctxt->buffer); switch (res) { case ASYNC_STATUS_DONE: - handle_arr[j] = cache_get_async2_state_result(cc, ctxt->buffer); + handle_arr[j] = cache_get_async_state_result(cc, ctxt->buffer); ctxt->status = done; break; case ASYNC_STATUS_RUNNING: @@ -692,37 +666,6 @@ test_do_read_batch(threadid tid, test_params *params, uint64 batch_start) platform_assert(0); } } - // // platform_log_stream("batch %lu, %lu: res %u\n", batch_start, j, - // res); if (mt_reader) { - // switch (res) { - // case async_locked: - // case async_no_reqs: - // cache_assert_ungot(cc, addr_arr[j]); - // /* - // * Need to keep lock order. Lock order is lower disk - // * address to higher disk address. If a writer thread has - // * the page locked, we cannot take read refs on blocks - // * with higher addresses, then come back to take read refs - // * on blocks with lower addresses. This'll be a lock order - // * violation and cause deadlock. So abandon this batch, - // * and ask caller to retry. - // */ - // test_abandon_read_batch(params, batch_start, j, was_async); - // return TRUE; - // case ASYNC_STATUS_DONE: - // handle_arr[j] = cache_get_async2_state_result(cc, - // ctxt->buffer); platform_assert(ctxt->page); - // platform_semaphore_post(¶ms->batch_sema); - // continue; - // case ASYNC_STATUS_RUNNING: - // was_async[j] = TRUE; - // break; - // default: - // platform_assert(0); - // } - // } else { - // platform_assert(res == ASYNC_STATUS_RUNNING); - // } } // Wait for the batch of async gets to complete diff --git a/tests/functional/test_async.c b/tests/functional/test_async.c index 2276ec51..671738e1 100644 --- a/tests/functional/test_async.c +++ b/tests/functional/test_async.c @@ -120,7 +120,7 @@ async_ctxt_process_one(trunk_handle *spl, timestamp ts; ts = platform_get_timestamp(); - res = trunk_lookup_async2(&ctxt->state); + res = trunk_lookup_async(&ctxt->state); ts = platform_timestamp_elapsed(ts); if (latency_max != NULL && *latency_max < ts) { *latency_max = ts; @@ -146,12 +146,12 @@ async_ctxt_submit(trunk_handle *spl, async_ctxt_process_cb process_cb, void *process_arg) { - trunk_lookup_async2_state_init(&ctxt->state, - spl, - key_buffer_key(&ctxt->key), - &ctxt->data, - test_async_callback, - ctxt); + trunk_lookup_async_state_init(&ctxt->state, + spl, + key_buffer_key(&ctxt->key), + &ctxt->data, + test_async_callback, + ctxt); async_ctxt_process_one( spl, async_lookup, ctxt, latency_max, process_cb, process_arg); } diff --git a/tests/functional/test_async.h b/tests/functional/test_async.h index 3a65d9b9..cceed687 100644 --- a/tests/functional/test_async.h +++ b/tests/functional/test_async.h @@ -20,7 +20,7 @@ // A single async context typedef struct { - trunk_lookup_async2_state state; + trunk_lookup_async_state state; pcq *ready_q; union { int8 refcount; // Used by functionality test