Motr  M0
Locality

Data Structures

struct  chore_local
 
struct  locality_global
 
struct  m0_locality
 
struct  m0_locality_chore
 
struct  m0_locality_chore_ops
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_LIB
 
#define LOC_FOR(idx_var, loc_var)
 
#define LOC_ENDFOR   } } while (0)
 
#define CHORES_FOR(chvar)
 
#define CHORES_ENDFOR   m0_tl_endfor; } while (0)
 

Enumerations

enum  { M0_CHORE_L_MAGIC, M0_CHORE_L_HEAD_MAGIC, M0_CHORES_G_MAGIC, M0_CHORES_G_HEAD_MAGIC }
 
enum  { M0_LOCALITY_LOCKERS_NR = 256 }
 

Functions

 M0_LOCKERS_DEFINE (M0_INTERNAL, m0_locality, lo_lockers)
 
 M0_TL_DESCR_DEFINE (chore_l, "chores-local", static, struct chore_local, lo_linkage, lo_magix, M0_CHORE_L_MAGIC, M0_CHORE_L_HEAD_MAGIC)
 
 M0_TL_DEFINE (chore_l, static, struct chore_local)
 
 M0_TL_DESCR_DEFINE (chores_g, "chores-global", static, struct m0_locality_chore, lc_linkage, lc_magix, M0_CHORES_G_MAGIC, M0_CHORES_G_HEAD_MAGIC)
 
 M0_TL_DEFINE (chores_g, static, struct m0_locality_chore)
 
static struct locality_globalloc_glob (void)
 
static int loc_nr (void)
 
static void chore_del (struct m0_locality *loc, struct m0_locality_chore *chore)
 
static int chore_add (struct m0_locality *loc, struct m0_locality_chore *chore)
 
static void chore_post (struct m0_locality *loc, struct m0_locality_chore *chore, void(*cb)(struct m0_sm_group *, struct m0_sm_ast *))
 
static int chore_add_all (struct m0_locality_chore *chore)
 
static void chore_del_all (struct m0_locality_chore *chore)
 
static void chore_add_cb (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static void chore_del_cb (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static int locality_data_alloc (int key)
 
static void locality_data_free (int key)
 
static void locality_data_free_all (void)
 
static int ldata_alloc (struct m0_locality *loc, int key)
 
static void ldata_free (struct m0_locality *loc, int key)
 
M0_INTERNAL void m0_locality_init (struct m0_locality *loc, struct m0_sm_group *grp, struct m0_fom_domain *dom, size_t idx)
 
M0_INTERNAL void m0_locality_fini (struct m0_locality *loc)
 
M0_INTERNAL struct m0_localitym0_locality_here (void)
 
M0_INTERNAL struct m0_localitym0_locality_get (uint64_t value)
 
M0_INTERNAL struct m0_localitym0_locality0_get (void)
 
M0_INTERNAL void m0_locality_dom_set (struct m0_fom_domain *dom)
 
M0_INTERNAL void m0_locality_dom_unset (struct m0_fom_domain *dom)
 
static void locs_ast_handler (void *__unused)
 
static int ast_thread_init (void *__unused)
 
M0_INTERNAL int m0_localities_init (void)
 
M0_INTERNAL void m0_localities_fini (void)
 
int m0_locality_chore_init (struct m0_locality_chore *chore, const struct m0_locality_chore_ops *ops, void *datum, m0_time_t interval, size_t datasize)
 
void m0_locality_chore_fini (struct m0_locality_chore *chore)
 
M0_INTERNAL void m0_locality_chores_run (struct m0_locality *locality)
 
int m0_locality_data_alloc (size_t nob, int(*ctor)(void *, void *), void(*dtor)(void *, void *), void *datum)
 
void m0_locality_data_free (int key)
 
void * m0_locality_data (int key)
 
void m0_locality_data_iterate (int key, void(*func)(int idx, void *data, void *datum), void *datum)
 
static int ctor_cb (void *arg)
 
static int dtor_cb (void *arg)
 
int m0_locality_call (struct m0_locality *loc, int(*cb)(void *), void *data)
 
M0_INTERNAL struct m0_fom_domainm0_fom_dom (void)
 
 M0_LOCKERS_DECLARE (M0_EXTERN, m0_locality, M0_LOCALITY_LOCKERS_NR)
 
void m0_locality_chore_quit (struct m0_locality_chore *chore)
 

Variables

struct {
   size_t   ld_nob
 
   int(*   ld_ctor )(void *, void *)
 
   void(*   ld_dtor )(void *, void *)
 
   void *   ld_datum
 
ldata [M0_LOCALITY_LOCKERS_NR]
 

Detailed Description

Macro Definition Documentation

◆ CHORES_ENDFOR

#define CHORES_ENDFOR   m0_tl_endfor; } while (0)

Definition at line 124 of file locality.c.

◆ CHORES_FOR

#define CHORES_FOR (   chvar)
Value:
do { \
struct m0_locality_chore *chvar; \
struct m0_tl *__chlist = &loc_glob()->lg_chore; \
m0_tl_for(chores_g, __chlist, chvar)
struct m0_tl lg_chore
Definition: locality.c:74
Definition: tlist.h:251
static struct locality_global * loc_glob(void)
Definition: locality.c:325

Definition at line 118 of file locality.c.

◆ LOC_ENDFOR

#define LOC_ENDFOR   } } while (0)

Definition at line 116 of file locality.c.

◆ LOC_FOR

#define LOC_FOR (   idx_var,
  loc_var 
)
Value:
do { \
int idx_var; \
\
for (idx_var = 0; idx_var < loc_nr(); ++idx_var) { \
struct m0_locality *loc_var = m0_locality_get(idx_var);
M0_INTERNAL struct m0_locality * m0_locality_get(uint64_t value)
Definition: locality.c:156
static int loc_nr(void)
Definition: locality.c:330

Definition at line 109 of file locality.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_LIB

Definition at line 29 of file locality.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
M0_CHORE_L_MAGIC 
M0_CHORE_L_HEAD_MAGIC 
M0_CHORES_G_MAGIC 
M0_CHORES_G_HEAD_MAGIC 

Definition at line 77 of file locality.c.

◆ anonymous enum

anonymous enum
Enumerator
M0_LOCALITY_LOCKERS_NR 

Definition at line 51 of file locality.h.

Function Documentation

◆ ast_thread_init()

static int ast_thread_init ( void *  __unused)
static

Definition at line 207 of file locality.c.

Here is the caller graph for this function:

◆ chore_add()

static int chore_add ( struct m0_locality loc,
struct m0_locality_chore chore 
)
static

Definition at line 386 of file locality.c.

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

◆ chore_add_all()

static int chore_add_all ( struct m0_locality_chore chore)
static

Definition at line 337 of file locality.c.

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

◆ chore_add_cb()

static void chore_add_cb ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)
static

Definition at line 397 of file locality.c.

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

◆ chore_del()

static void chore_del ( struct m0_locality loc,
struct m0_locality_chore chore 
)
static

Definition at line 392 of file locality.c.

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

◆ chore_del_all()

static void chore_del_all ( struct m0_locality_chore chore)
static

Definition at line 360 of file locality.c.

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

◆ chore_del_cb()

static void chore_del_cb ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)
static

Definition at line 425 of file locality.c.

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

◆ chore_post()

static void chore_post ( struct m0_locality loc,
struct m0_locality_chore chore,
void(*)(struct m0_sm_group *, struct m0_sm_ast *)  cb 
)
static

Definition at line 369 of file locality.c.

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

◆ ctor_cb()

static int ctor_cb ( void *  arg)
static

Definition at line 508 of file locality.c.

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

◆ dtor_cb()

static int dtor_cb ( void *  arg)
static

Definition at line 518 of file locality.c.

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

◆ ldata_alloc()

static int ldata_alloc ( struct m0_locality loc,
int  key 
)
static

Definition at line 529 of file locality.c.

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

◆ ldata_free()

static void ldata_free ( struct m0_locality loc,
int  key 
)
static

Definition at line 548 of file locality.c.

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

◆ loc_glob()

static struct locality_global * loc_glob ( void  )
static

Definition at line 325 of file locality.c.

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

◆ loc_nr()

static int loc_nr ( void  )
static

Definition at line 330 of file locality.c.

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

◆ locality_data_alloc()

static int locality_data_alloc ( int  key)
static

Definition at line 489 of file locality.c.

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

◆ locality_data_free()

static void locality_data_free ( int  key)
static

Definition at line 501 of file locality.c.

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

◆ locality_data_free_all()

static void locality_data_free_all ( void  )
static

Definition at line 560 of file locality.c.

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

◆ locs_ast_handler()

static void locs_ast_handler ( void *  __unused)
static

Definition at line 190 of file locality.c.

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

◆ m0_fom_dom()

M0_INTERNAL struct m0_fom_domain * m0_fom_dom ( void  )

Definition at line 575 of file locality.c.

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

◆ m0_localities_fini()

M0_INTERNAL void m0_localities_fini ( void  )

Definition at line 242 of file locality.c.

Here is the call graph for this function:

◆ m0_localities_init()

M0_INTERNAL int m0_localities_init ( void  )

Definition at line 212 of file locality.c.

Here is the call graph for this function:

◆ m0_locality0_get()

M0_INTERNAL struct m0_locality * m0_locality0_get ( void  )

Definition at line 169 of file locality.c.

Here is the call graph for this function:

◆ m0_locality_call()

int m0_locality_call ( struct m0_locality loc,
int(*)(void *)  cb,
void *  data 
)

Definition at line 570 of file locality.c.

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

◆ m0_locality_chore_fini()

void m0_locality_chore_fini ( struct m0_locality_chore chore)

Definition at line 296 of file locality.c.

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

◆ m0_locality_chore_init()

int m0_locality_chore_init ( struct m0_locality_chore chore,
const struct m0_locality_chore_ops ops,
void *  datum,
m0_time_t  interval,
size_t  datasize 
)

Definition at line 270 of file locality.c.

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

◆ m0_locality_chore_quit()

void m0_locality_chore_quit ( struct m0_locality_chore chore)

◆ m0_locality_chores_run()

M0_INTERNAL void m0_locality_chores_run ( struct m0_locality locality)

Definition at line 305 of file locality.c.

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

◆ m0_locality_data()

void * m0_locality_data ( int  key)

Definition at line 474 of file locality.c.

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

◆ m0_locality_data_alloc()

int m0_locality_data_alloc ( size_t  nob,
int(*)(void *, void *)  ctor,
void(*)(void *, void *)  dtor,
void *  datum 
)

Definition at line 442 of file locality.c.

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

◆ m0_locality_data_free()

void m0_locality_data_free ( int  key)

Definition at line 463 of file locality.c.

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

◆ m0_locality_data_iterate()

void m0_locality_data_iterate ( int  key,
void(*)(int idx, void *data, void *datum)  func,
void *  datum 
)

Definition at line 480 of file locality.c.

Here is the caller graph for this function:

◆ m0_locality_dom_set()

M0_INTERNAL void m0_locality_dom_set ( struct m0_fom_domain dom)

Starts using localities from the specified domain.

Definition at line 174 of file locality.c.

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

◆ m0_locality_dom_unset()

M0_INTERNAL void m0_locality_dom_unset ( struct m0_fom_domain dom)

Stops using the domain, falls back to a single locality.

Definition at line 182 of file locality.c.

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

◆ m0_locality_fini()

M0_INTERNAL void m0_locality_fini ( struct m0_locality loc)

Definition at line 140 of file locality.c.

Here is the caller graph for this function:

◆ m0_locality_get()

M0_INTERNAL struct m0_locality * m0_locality_get ( uint64_t  value)

Returns locality corresponding in some unspecified, but deterministic way to the supplied value.

Postcondition
result->lo_grp != NULL

Definition at line 156 of file locality.c.

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

◆ m0_locality_here()

M0_INTERNAL struct m0_locality * m0_locality_here ( void  )

Returns locality corresponding to the core the call is made on.

Postcondition
result->lo_grp != NULL

Definition at line 146 of file locality.c.

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

◆ m0_locality_init()

M0_INTERNAL void m0_locality_init ( struct m0_locality loc,
struct m0_sm_group grp,
struct m0_fom_domain dom,
size_t  idx 
)

Definition at line 126 of file locality.c.

Here is the caller graph for this function:

◆ M0_LOCKERS_DECLARE()

M0_LOCKERS_DECLARE ( M0_EXTERN  ,
m0_locality  ,
M0_LOCALITY_LOCKERS_NR   
)

◆ M0_LOCKERS_DEFINE()

M0_LOCKERS_DEFINE ( M0_INTERNAL  ,
m0_locality  ,
lo_lockers   
)
Todo:
move m0_locality_lockers_type and ldata[] in locality_global, once lockers are updated to use non-global lockers type.

◆ M0_TL_DEFINE() [1/2]

M0_TL_DEFINE ( chore_l  ,
static  ,
struct chore_local   
)

◆ M0_TL_DEFINE() [2/2]

M0_TL_DEFINE ( chores_g  ,
static  ,
struct m0_locality_chore   
)

◆ M0_TL_DESCR_DEFINE() [1/2]

M0_TL_DESCR_DEFINE ( chore_l  ,
"chores-local ,
static  ,
struct chore_local  ,
lo_linkage  ,
lo_magix  ,
M0_CHORE_L_MAGIC  ,
M0_CHORE_L_HEAD_MAGIC   
)

◆ M0_TL_DESCR_DEFINE() [2/2]

M0_TL_DESCR_DEFINE ( chores_g  ,
"chores-global"  ,
static  ,
struct m0_locality_chore  ,
lc_linkage  ,
lc_magix  ,
M0_CHORES_G_MAGIC  ,
M0_CHORES_G_HEAD_MAGIC   
)

Variable Documentation

◆ ld_ctor

int(* ld_ctor) (void *, void *)

Definition at line 54 of file locality.c.

◆ ld_datum

void* ld_datum

Definition at line 56 of file locality.c.

◆ ld_dtor

void(* ld_dtor) (void *, void *)

Definition at line 55 of file locality.c.

◆ ld_nob

size_t ld_nob

Definition at line 53 of file locality.c.

◆ ldata

struct { ... } ldata[M0_LOCALITY_LOCKERS_NR]