Motr  M0
rcredits.c File Reference
#include "lib/trace.h"
#include "lib/chan.h"
#include "lib/semaphore.h"
#include "rm/rm.h"
#include "rm/rm_internal.h"
#include "ut/ut.h"
#include "rm/ut/rmut.h"
#include "rm/ut/rings.h"
Include dependency graph for rcredits.c:

Go to the source code of this file.

Enumerations

enum  rcredits_hier_type { RCREDITS_HIER_CHAIN, RCREDITS_HIER_STAR }
 

Functions

static void server1_in_complete (struct m0_rm_incoming *in, int32_t rc)
 
static void server1_in_conflict (struct m0_rm_incoming *in)
 
static void server2_in_complete (struct m0_rm_incoming *in, int32_t rc)
 
static void server2_in_conflict (struct m0_rm_incoming *in)
 
static void server3_in_complete (struct m0_rm_incoming *in, int32_t rc)
 
static void server3_in_conflict (struct m0_rm_incoming *in)
 
static void trick_in_complete (struct m0_rm_incoming *in, int32_t rc)
 
static void trick1_in_conflict (struct m0_rm_incoming *in)
 
static void trick2_in_conflict (struct m0_rm_incoming *in)
 
static void chain_hier_config (void)
 
static void star_hier_config (void)
 
static void remote_credits_utinit (enum rcredits_hier_type hier_type)
 
static void remote_credits_utfini (void)
 
static void credit_setup (enum rm_server srv_id, enum m0_rm_incoming_flags flag, uint64_t value)
 
static void credit_get_and_hold_nowait (enum rm_server debtor_id, enum m0_rm_incoming_flags flags, uint64_t credit_value)
 
static void wait_for_credit (enum rm_server srv_id)
 
static void credit_get_and_hold (enum rm_server debtor_id, enum m0_rm_incoming_flags flags, uint64_t credit_value)
 
static void held_credit_cache (enum rm_server srv_id)
 
static void credit_get_and_cache (enum rm_server debtor_id, enum m0_rm_incoming_flags flags, uint64_t credit_value)
 
static void borrow_and_cache (enum rm_server debtor_id, uint64_t credit_value)
 
static void borrow_and_hold (enum rm_server debtor_id, uint64_t credit_value)
 
static void test_two_borrows_single_req (void)
 
static void test_borrow_revoke_single_req (void)
 
static void test_revoke_with_hop (void)
 
static void test_no_borrow_flag (void)
 
static void test_simple_borrow (void)
 
static void test_borrow_non_conflicting (void)
 
static void test_revoke_conflicting_wait (void)
 
static void test_revoke_conflicting_try (void)
 
static void test_revoke_no_conflict_wait (void)
 
static void test_revoke_no_conflict_try (void)
 
static void test_borrow_held_no_conflict (void)
 
static void test_borrow_held_conflicting (void)
 
static void test_starvation (void)
 
static void test_barrier (void)
 
static void test_barrier_overcome (enum rcredits_hier_type hier)
 
static void test_barrier_overcome_star (void)
 
static void test_barrier_overcome_chain (void)
 
static void test_barrier_same_time (void)
 
static void remote_ha_state_update (enum rm_server server, enum m0_ha_obj_state new_state)
 
static void remote_die (enum rm_server server)
 
static void rm_server_restart (enum rm_server server)
 
static void remote_online (enum rm_server server)
 
static void debtor_death_acceptance_wait (enum rm_server dead, enum rm_server waiter)
 
static void test_debtor_death (void)
 
static void rm_ctx_creditor_track (enum rm_server srv_id)
 
static void test_creditor_death (void)
 
static void test_creditor_death2 (void)
 
static void test_creditor_recovered (void)
 
static void test_creditor_reset (void)
 

Variables

static enum rm_server test_servers_nr
 
static struct m0_semaphore conflict1_sem
 
static struct m0_semaphore conflict2_sem
 
static struct m0_semaphore conflict3_sem
 
static const struct m0_rm_incoming_ops server1_incoming_ops
 
static const struct m0_rm_incoming_ops server2_incoming_ops
 
static const struct m0_rm_incoming_ops server3_incoming_ops
 
static const struct m0_rm_incoming_ops trick1_incoming_ops
 
static const struct m0_rm_incoming_ops trick2_incoming_ops
 
struct m0_ut_suite rm_rcredits_ut
 

Enumeration Type Documentation

◆ rcredits_hier_type

Enumerator
RCREDITS_HIER_CHAIN 
RCREDITS_HIER_STAR 

Definition at line 38 of file rcredits.c.

Function Documentation

◆ borrow_and_cache()

static void borrow_and_cache ( enum rm_server  debtor_id,
uint64_t  credit_value 
)
static

Definition at line 292 of file rcredits.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ borrow_and_hold()

static void borrow_and_hold ( enum rm_server  debtor_id,
uint64_t  credit_value 
)
static

Definition at line 298 of file rcredits.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ chain_hier_config()

static void chain_hier_config ( void  )
static

Definition at line 133 of file rcredits.c.

Here is the caller graph for this function:

◆ credit_get_and_cache()

static void credit_get_and_cache ( enum rm_server  debtor_id,
enum m0_rm_incoming_flags  flags,
uint64_t  credit_value 
)
static

Definition at line 284 of file rcredits.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ credit_get_and_hold()

static void credit_get_and_hold ( enum rm_server  debtor_id,
enum m0_rm_incoming_flags  flags,
uint64_t  credit_value 
)
static

Definition at line 266 of file rcredits.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ credit_get_and_hold_nowait()

static void credit_get_and_hold_nowait ( enum rm_server  debtor_id,
enum m0_rm_incoming_flags  flags,
uint64_t  credit_value 
)
static

Definition at line 247 of file rcredits.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ credit_setup()

static void credit_setup ( enum rm_server  srv_id,
enum m0_rm_incoming_flags  flag,
uint64_t  value 
)
static

Definition at line 222 of file rcredits.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ debtor_death_acceptance_wait()

static void debtor_death_acceptance_wait ( enum rm_server  dead,
enum rm_server  waiter 
)
static

Definition at line 879 of file rcredits.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ held_credit_cache()

static void held_credit_cache ( enum rm_server  srv_id)
static

Definition at line 274 of file rcredits.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remote_credits_utfini()

static void remote_credits_utfini ( void  )
static

Definition at line 197 of file rcredits.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remote_credits_utinit()

static void remote_credits_utinit ( enum rcredits_hier_type  hier_type)
static

Definition at line 164 of file rcredits.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remote_die()

static void remote_die ( enum rm_server  server)
static

Definition at line 859 of file rcredits.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remote_ha_state_update()

static void remote_ha_state_update ( enum rm_server  server,
enum m0_ha_obj_state  new_state 
)
static

Definition at line 847 of file rcredits.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remote_online()

static void remote_online ( enum rm_server  server)
static

Definition at line 873 of file rcredits.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rm_ctx_creditor_track()

static void rm_ctx_creditor_track ( enum rm_server  srv_id)
static

Definition at line 934 of file rcredits.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rm_server_restart()

static void rm_server_restart ( enum rm_server  server)
static

Definition at line 865 of file rcredits.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ server1_in_complete()

static void server1_in_complete ( struct m0_rm_incoming in,
int32_t  rc 
)
static

Definition at line 43 of file rcredits.c.

Here is the call graph for this function:

◆ server1_in_conflict()

static void server1_in_conflict ( struct m0_rm_incoming in)
static

Definition at line 49 of file rcredits.c.

Here is the call graph for this function:

◆ server2_in_complete()

static void server2_in_complete ( struct m0_rm_incoming in,
int32_t  rc 
)
static

Definition at line 59 of file rcredits.c.

Here is the call graph for this function:

◆ server2_in_conflict()

static void server2_in_conflict ( struct m0_rm_incoming in)
static

Definition at line 65 of file rcredits.c.

Here is the call graph for this function:

◆ server3_in_complete()

static void server3_in_complete ( struct m0_rm_incoming in,
int32_t  rc 
)
static

Definition at line 75 of file rcredits.c.

Here is the call graph for this function:

◆ server3_in_conflict()

static void server3_in_conflict ( struct m0_rm_incoming in)
static

Definition at line 81 of file rcredits.c.

Here is the call graph for this function:

◆ star_hier_config()

static void star_hier_config ( void  )
static

Definition at line 148 of file rcredits.c.

Here is the caller graph for this function:

◆ test_barrier()

static void test_barrier ( void  )
static

Definition at line 610 of file rcredits.c.

Here is the call graph for this function:

◆ test_barrier_overcome()

static void test_barrier_overcome ( enum rcredits_hier_type  hier)
static

Definition at line 666 of file rcredits.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_barrier_overcome_chain()

static void test_barrier_overcome_chain ( void  )
static

Definition at line 785 of file rcredits.c.

Here is the call graph for this function:

◆ test_barrier_overcome_star()

static void test_barrier_overcome_star ( void  )
static

Definition at line 780 of file rcredits.c.

Here is the call graph for this function:

◆ test_barrier_same_time()

static void test_barrier_same_time ( void  )
static

Definition at line 790 of file rcredits.c.

Here is the call graph for this function:

◆ test_borrow_held_conflicting()

static void test_borrow_held_conflicting ( void  )
static

Definition at line 527 of file rcredits.c.

Here is the call graph for this function:

◆ test_borrow_held_no_conflict()

static void test_borrow_held_no_conflict ( void  )
static

Definition at line 505 of file rcredits.c.

Here is the call graph for this function:

◆ test_borrow_non_conflicting()

static void test_borrow_non_conflicting ( void  )
static

Definition at line 403 of file rcredits.c.

Here is the call graph for this function:

◆ test_borrow_revoke_single_req()

static void test_borrow_revoke_single_req ( void  )
static

Definition at line 324 of file rcredits.c.

Here is the call graph for this function:

◆ test_creditor_death()

static void test_creditor_death ( void  )
static

Definition at line 948 of file rcredits.c.

Here is the call graph for this function:

◆ test_creditor_death2()

static void test_creditor_death2 ( void  )
static

Definition at line 1002 of file rcredits.c.

Here is the call graph for this function:

◆ test_creditor_recovered()

static void test_creditor_recovered ( void  )
static

Definition at line 1041 of file rcredits.c.

Here is the call graph for this function:

◆ test_creditor_reset()

static void test_creditor_reset ( void  )
static

Definition at line 1080 of file rcredits.c.

Here is the call graph for this function:

◆ test_debtor_death()

static void test_debtor_death ( void  )
static

Definition at line 908 of file rcredits.c.

Here is the call graph for this function:

◆ test_no_borrow_flag()

static void test_no_borrow_flag ( void  )
static

Definition at line 368 of file rcredits.c.

Here is the call graph for this function:

◆ test_revoke_conflicting_try()

static void test_revoke_conflicting_try ( void  )
static

Definition at line 438 of file rcredits.c.

Here is the call graph for this function:

◆ test_revoke_conflicting_wait()

static void test_revoke_conflicting_wait ( void  )
static

Definition at line 415 of file rcredits.c.

Here is the call graph for this function:

◆ test_revoke_no_conflict_try()

static void test_revoke_no_conflict_try ( void  )
static

Definition at line 483 of file rcredits.c.

Here is the call graph for this function:

◆ test_revoke_no_conflict_wait()

static void test_revoke_no_conflict_wait ( void  )
static

Definition at line 460 of file rcredits.c.

Here is the call graph for this function:

◆ test_revoke_with_hop()

static void test_revoke_with_hop ( void  )
static

Definition at line 347 of file rcredits.c.

Here is the call graph for this function:

◆ test_simple_borrow()

static void test_simple_borrow ( void  )
static

Definition at line 388 of file rcredits.c.

Here is the call graph for this function:

◆ test_starvation()

static void test_starvation ( void  )
static

Definition at line 551 of file rcredits.c.

Here is the call graph for this function:

◆ test_two_borrows_single_req()

static void test_two_borrows_single_req ( void  )
static

Definition at line 304 of file rcredits.c.

Here is the call graph for this function:

◆ trick1_in_conflict()

static void trick1_in_conflict ( struct m0_rm_incoming in)
static

Definition at line 97 of file rcredits.c.

Here is the call graph for this function:

◆ trick2_in_conflict()

static void trick2_in_conflict ( struct m0_rm_incoming in)
static

Definition at line 111 of file rcredits.c.

Here is the call graph for this function:

◆ trick_in_complete()

static void trick_in_complete ( struct m0_rm_incoming in,
int32_t  rc 
)
static

Definition at line 91 of file rcredits.c.

Here is the call graph for this function:

◆ wait_for_credit()

static void wait_for_credit ( enum rm_server  srv_id)
static

Definition at line 257 of file rcredits.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ conflict1_sem

struct m0_semaphore conflict1_sem
static

Definition at line 34 of file rcredits.c.

◆ conflict2_sem

struct m0_semaphore conflict2_sem
static

Definition at line 35 of file rcredits.c.

◆ conflict3_sem

struct m0_semaphore conflict3_sem
static

Definition at line 36 of file rcredits.c.

◆ rm_rcredits_ut

struct m0_ut_suite rm_rcredits_ut
Initial value:
= {
.ts_name = "rm-rcredits-ut",
.ts_tests = {
{ "no-borrow-flag" , test_no_borrow_flag },
{ "simple-borrow" , test_simple_borrow },
{ "two-borrows-single-req" , test_two_borrows_single_req },
{ "borrow-revoke-single-req" , test_borrow_revoke_single_req },
{ "revoke-with-hop" , test_revoke_with_hop },
{ "revoke-conflicting-wait" , test_revoke_conflicting_wait },
{ "revoke-conflicting-try" , test_revoke_conflicting_try },
{ "borrow-non-conflicting" , test_borrow_non_conflicting },
{ "revoke-no-conflict-wait" , test_revoke_no_conflict_wait },
{ "revoke-no-conflict-try" , test_revoke_no_conflict_try },
{ "borrow-held-no-conflict" , test_borrow_held_no_conflict },
{ "borrow-held-conflicting" , test_borrow_held_conflicting },
{ "starvation" , test_starvation },
{ "barrier" , test_barrier },
{ "barrier-overcome-star" , test_barrier_overcome_star },
{ "barrier-overcome-chain" , test_barrier_overcome_chain },
{ "barrier-same-time" , test_barrier_same_time },
{ "debtor-death" , test_debtor_death },
{ "creditor-death" , test_creditor_death },
{ "creditor-death2" , test_creditor_death2 },
{ "creditor-recovered" , test_creditor_recovered },
{ "creditor-reset" , test_creditor_reset },
{ NULL, NULL }
}
}
static void test_revoke_no_conflict_wait(void)
Definition: rcredits.c:460
static void test_no_borrow_flag(void)
Definition: rcredits.c:368
static void test_simple_borrow(void)
Definition: rcredits.c:388
#define NULL
Definition: misc.h:38
static void test_borrow_non_conflicting(void)
Definition: rcredits.c:403
static void test_creditor_recovered(void)
Definition: rcredits.c:1041
static void test_revoke_conflicting_try(void)
Definition: rcredits.c:438
static void test_revoke_conflicting_wait(void)
Definition: rcredits.c:415
static void test_revoke_with_hop(void)
Definition: rcredits.c:347
static void test_borrow_held_no_conflict(void)
Definition: rcredits.c:505
static void test_revoke_no_conflict_try(void)
Definition: rcredits.c:483
static void test_debtor_death(void)
Definition: rcredits.c:908
static void test_creditor_reset(void)
Definition: rcredits.c:1080
static void test_two_borrows_single_req(void)
Definition: rcredits.c:304
static void test_borrow_revoke_single_req(void)
Definition: rcredits.c:324
static void test_barrier_overcome_star(void)
Definition: rcredits.c:780
static void test_barrier(void)
Definition: rcredits.c:610
static void test_barrier_same_time(void)
Definition: rcredits.c:790
static void test_creditor_death2(void)
Definition: rcredits.c:1002
static void test_barrier_overcome_chain(void)
Definition: rcredits.c:785
static void test_starvation(void)
Definition: rcredits.c:551
static void test_borrow_held_conflicting(void)
Definition: rcredits.c:527
static void test_creditor_death(void)
Definition: rcredits.c:948

Definition at line 1123 of file rcredits.c.

◆ server1_incoming_ops

const struct m0_rm_incoming_ops server1_incoming_ops
static
Initial value:
= {
.rio_complete = server1_in_complete,
.rio_conflict = server1_in_conflict
}
static void server1_in_conflict(struct m0_rm_incoming *in)
Definition: rcredits.c:49
static void server1_in_complete(struct m0_rm_incoming *in, int32_t rc)
Definition: rcredits.c:43

Definition at line 54 of file rcredits.c.

◆ server2_incoming_ops

const struct m0_rm_incoming_ops server2_incoming_ops
static
Initial value:
= {
.rio_complete = server2_in_complete,
.rio_conflict = server2_in_conflict
}
static void server2_in_complete(struct m0_rm_incoming *in, int32_t rc)
Definition: rcredits.c:59
static void server2_in_conflict(struct m0_rm_incoming *in)
Definition: rcredits.c:65

Definition at line 70 of file rcredits.c.

◆ server3_incoming_ops

const struct m0_rm_incoming_ops server3_incoming_ops
static
Initial value:
= {
.rio_complete = server3_in_complete,
.rio_conflict = server3_in_conflict
}
static void server3_in_conflict(struct m0_rm_incoming *in)
Definition: rcredits.c:81
static void server3_in_complete(struct m0_rm_incoming *in, int32_t rc)
Definition: rcredits.c:75

Definition at line 86 of file rcredits.c.

◆ test_servers_nr

enum rm_server test_servers_nr
static

Definition at line 33 of file rcredits.c.

◆ trick1_incoming_ops

const struct m0_rm_incoming_ops trick1_incoming_ops
static
Initial value:
= {
.rio_complete = trick_in_complete,
.rio_conflict = trick1_in_conflict
}
static void trick_in_complete(struct m0_rm_incoming *in, int32_t rc)
Definition: rcredits.c:91
static void trick1_in_conflict(struct m0_rm_incoming *in)
Definition: rcredits.c:97

Definition at line 106 of file rcredits.c.

◆ trick2_incoming_ops

const struct m0_rm_incoming_ops trick2_incoming_ops
static
Initial value:
= {
.rio_complete = trick_in_complete,
.rio_conflict = trick2_in_conflict
}
static void trick_in_complete(struct m0_rm_incoming *in, int32_t rc)
Definition: rcredits.c:91
static void trick2_in_conflict(struct m0_rm_incoming *in)
Definition: rcredits.c:111

Definition at line 122 of file rcredits.c.