Motr  M0
helper.c File Reference
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/syscall.h>
#include "lib/trace.h"
#include "lib/memory.h"
#include "lib/misc.h"
#include "lib/arith.h"
#include "lib/errno.h"
#include "lib/finject.h"
#include "rpc/rpclib.h"
#include "net/net.h"
#include "module/instance.h"
#include "conf/obj.h"
#include "stob/domain.h"
#include "ut/stob.h"
#include "be/ut/helper.h"
#include "be/tx_internal.h"
#include "be/seg0.h"
Include dependency graph for helper.c:

Go to the source code of this file.

Data Structures

struct  m0_be_ut_sm_group_thread
 
struct  be_ut_helper_struct
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT
 
#define M0_BE_LOG_NAME   "M0_BE:LOG"
 
#define M0_BE_SEG0_NAME   "M0_BE:SEG0"
 
#define M0_BE_SEG_NAME   "M0_BE:SEG%08lu"
 

Functions

 M0_BOB_DEFINE (M0_INTERNAL, &m0_ut_be_backend_bobtype, m0_be_ut_backend)
 
static void be_ut_helper_fini (void)
 
static void be_ut_helper_init (void)
 
static void be_ut_helper_init_once (void)
 
M0_INTERNAL void * m0_be_ut_seg_allocate_addr (m0_bcount_t size)
 
M0_INTERNAL uint64_t m0_be_ut_seg_allocate_id (void)
 
M0_INTERNAL void m0_be_ut_reqh_create (struct m0_reqh **pptr)
 
M0_INTERNAL void m0_be_ut_reqh_destroy (void)
 
static pid_t gettid_impl (void)
 
static void be_ut_sm_group_thread_func (struct m0_be_ut_sm_group_thread *sgt)
 
static int m0_be_ut_sm_group_thread_init (struct m0_be_ut_sm_group_thread **sgtp, bool lock_new)
 
static void m0_be_ut_sm_group_thread_fini (struct m0_be_ut_sm_group_thread *sgt)
 
void m0_be_ut_backend_cfg_default (struct m0_be_domain_cfg *cfg)
 
M0_INTERNAL int m0_be_ut_backend_init_cfg (struct m0_be_ut_backend *ut_be, const struct m0_be_domain_cfg *cfg, bool mkfs)
 
M0_INTERNAL int m0_be_ut_backend_log_resize (struct m0_be_ut_backend *ut_be, const struct m0_be_domain_cfg *cfg)
 
void m0_be_ut_backend_init (struct m0_be_ut_backend *ut_be)
 
void m0_be_ut_backend_fini (struct m0_be_ut_backend *ut_be)
 
M0_INTERNAL void m0_be_ut_backend_seg_add (struct m0_be_ut_backend *ut_be, const struct m0_be_0type_seg_cfg *seg_cfg, struct m0_be_seg **out)
 
M0_INTERNAL void m0_be_ut_backend_seg_add2 (struct m0_be_ut_backend *ut_be, m0_bcount_t size, bool preallocate, const char *stob_create_cfg, struct m0_be_seg **out)
 
M0_INTERNAL void m0_be_ut_backend_seg_del (struct m0_be_ut_backend *ut_be, struct m0_be_seg *seg)
 
static void be_ut_sm_group_thread_add (struct m0_be_ut_backend *ut_be, struct m0_be_ut_sm_group_thread *sgt)
 
static size_t be_ut_backend_sm_group_find (struct m0_be_ut_backend *ut_be)
 
static struct m0_sm_groupbe_ut_backend_sm_group_lookup (struct m0_be_ut_backend *ut_be, bool lock_new)
 
struct m0_sm_groupm0_be_ut_backend_sm_group_lookup (struct m0_be_ut_backend *ut_be)
 
void m0_be_ut_backend_sm_group_asts_run (struct m0_be_ut_backend *ut_be)
 
void m0_be_ut_backend_new_grp_lock_state_set (struct m0_be_ut_backend *ut_be, bool unlocked_new)
 
void m0_be_ut_backend_thread_exit (struct m0_be_ut_backend *ut_be)
 
static void be_ut_tx_lock_if (struct m0_sm_group *grp, struct m0_be_ut_backend *ut_be)
 
static void be_ut_tx_unlock_if (struct m0_sm_group *grp, struct m0_be_ut_backend *ut_be)
 
void m0_be_ut_tx_init (struct m0_be_tx *tx, struct m0_be_ut_backend *ut_be)
 
void m0_be_ut_seg_init (struct m0_be_ut_seg *ut_seg, struct m0_be_ut_backend *ut_be, m0_bcount_t size)
 
void m0_be_ut_seg_fini (struct m0_be_ut_seg *ut_seg)
 
M0_INTERNAL void m0_be_ut_alloc (struct m0_be_ut_backend *ut_be, struct m0_be_ut_seg *ut_seg, void **ptr, m0_bcount_t size)
 
M0_INTERNAL void m0_be_ut_free (struct m0_be_ut_backend *ut_be, struct m0_be_ut_seg *ut_seg, void *ptr)
 
void m0_be_ut_seg_reload (struct m0_be_ut_seg *ut_seg)
 
static void be_ut_seg_allocator_initfini (struct m0_be_seg *seg, struct m0_be_ut_backend *ut_be, bool init)
 
void m0_be_ut_seg_allocator_init (struct m0_be_ut_seg *ut_seg, struct m0_be_ut_backend *ut_be)
 
void m0_be_ut_seg_allocator_fini (struct m0_be_ut_seg *ut_seg, struct m0_be_ut_backend *ut_be)
 

Variables

const struct m0_bob_type m0_ut_be_backend_bobtype
 
static struct be_ut_helper_struct be_ut_helper
 

Macro Definition Documentation

◆ M0_BE_LOG_NAME

#define M0_BE_LOG_NAME   "M0_BE:LOG"

Definition at line 255 of file helper.c.

◆ M0_BE_SEG0_NAME

#define M0_BE_SEG0_NAME   "M0_BE:SEG0"

Definition at line 256 of file helper.c.

◆ M0_BE_SEG_NAME

#define M0_BE_SEG_NAME   "M0_BE:SEG%08lu"

Definition at line 257 of file helper.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT

Definition at line 31 of file helper.c.

Function Documentation

◆ be_ut_backend_sm_group_find()

static size_t be_ut_backend_sm_group_find ( struct m0_be_ut_backend ut_be)
static

Definition at line 524 of file helper.c.

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

◆ be_ut_backend_sm_group_lookup()

static struct m0_sm_group* be_ut_backend_sm_group_lookup ( struct m0_be_ut_backend ut_be,
bool  lock_new 
)
static

Definition at line 537 of file helper.c.

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

◆ be_ut_helper_fini()

static void be_ut_helper_fini ( void  )
static

Definition at line 82 of file helper.c.

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

◆ be_ut_helper_init()

static void be_ut_helper_init ( void  )
static

Definition at line 88 of file helper.c.

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

◆ be_ut_helper_init_once()

static void be_ut_helper_init_once ( void  )
static

Definition at line 99 of file helper.c.

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

◆ be_ut_seg_allocator_initfini()

static void be_ut_seg_allocator_initfini ( struct m0_be_seg seg,
struct m0_be_ut_backend ut_be,
bool  init 
)
static

Definition at line 709 of file helper.c.

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

◆ be_ut_sm_group_thread_add()

static void be_ut_sm_group_thread_add ( struct m0_be_ut_backend ut_be,
struct m0_be_ut_sm_group_thread sgt 
)
static

Definition at line 507 of file helper.c.

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

◆ be_ut_sm_group_thread_func()

static void be_ut_sm_group_thread_func ( struct m0_be_ut_sm_group_thread sgt)
static

Definition at line 185 of file helper.c.

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

◆ be_ut_tx_lock_if()

static void be_ut_tx_lock_if ( struct m0_sm_group grp,
struct m0_be_ut_backend ut_be 
)
static

Definition at line 606 of file helper.c.

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

◆ be_ut_tx_unlock_if()

static void be_ut_tx_unlock_if ( struct m0_sm_group grp,
struct m0_be_ut_backend ut_be 
)
static

Definition at line 613 of file helper.c.

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

◆ gettid_impl()

static pid_t gettid_impl ( void  )
static

Definition at line 180 of file helper.c.

Here is the caller graph for this function:

◆ m0_be_ut_alloc()

M0_INTERNAL void m0_be_ut_alloc ( struct m0_be_ut_backend ut_be,
struct m0_be_ut_seg ut_seg,
void **  ptr,
m0_bcount_t  size 
)

Definition at line 679 of file helper.c.

Here is the call graph for this function:

◆ m0_be_ut_backend_cfg_default()

void m0_be_ut_backend_cfg_default ( struct m0_be_domain_cfg cfg)

Definition at line 259 of file helper.c.

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

◆ m0_be_ut_backend_fini()

void m0_be_ut_backend_fini ( struct m0_be_ut_backend ut_be)

Definition at line 443 of file helper.c.

Here is the call graph for this function:

◆ m0_be_ut_backend_init()

void m0_be_ut_backend_init ( struct m0_be_ut_backend ut_be)

Definition at line 437 of file helper.c.

Here is the call graph for this function:

◆ m0_be_ut_backend_init_cfg()

M0_INTERNAL int m0_be_ut_backend_init_cfg ( struct m0_be_ut_backend ut_be,
const struct m0_be_domain_cfg cfg,
bool  mkfs 
)

Definition at line 351 of file helper.c.

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

◆ m0_be_ut_backend_log_resize()

M0_INTERNAL int m0_be_ut_backend_log_resize ( struct m0_be_ut_backend ut_be,
const struct m0_be_domain_cfg cfg 
)

Definition at line 405 of file helper.c.

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

◆ m0_be_ut_backend_new_grp_lock_state_set()

void m0_be_ut_backend_new_grp_lock_state_set ( struct m0_be_ut_backend ut_be,
bool  unlocked_new 
)

Definition at line 584 of file helper.c.

◆ m0_be_ut_backend_seg_add()

M0_INTERNAL void m0_be_ut_backend_seg_add ( struct m0_be_ut_backend ut_be,
const struct m0_be_0type_seg_cfg seg_cfg,
struct m0_be_seg **  out 
)

Definition at line 455 of file helper.c.

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

◆ m0_be_ut_backend_seg_add2()

M0_INTERNAL void m0_be_ut_backend_seg_add2 ( struct m0_be_ut_backend ut_be,
m0_bcount_t  size,
bool  preallocate,
const char *  stob_create_cfg,
struct m0_be_seg **  out 
)

Definition at line 466 of file helper.c.

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

◆ m0_be_ut_backend_seg_del()

M0_INTERNAL void m0_be_ut_backend_seg_del ( struct m0_be_ut_backend ut_be,
struct m0_be_seg seg 
)

Definition at line 483 of file helper.c.

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

◆ m0_be_ut_backend_sm_group_asts_run()

void m0_be_ut_backend_sm_group_asts_run ( struct m0_be_ut_backend ut_be)

Definition at line 572 of file helper.c.

Here is the call graph for this function:

◆ m0_be_ut_backend_sm_group_lookup()

struct m0_sm_group* m0_be_ut_backend_sm_group_lookup ( struct m0_be_ut_backend ut_be)

Definition at line 566 of file helper.c.

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

◆ m0_be_ut_backend_thread_exit()

void m0_be_ut_backend_thread_exit ( struct m0_be_ut_backend ut_be)

Definition at line 590 of file helper.c.

Here is the call graph for this function:

◆ m0_be_ut_free()

M0_INTERNAL void m0_be_ut_free ( struct m0_be_ut_backend ut_be,
struct m0_be_ut_seg ut_seg,
void *  ptr 
)

Definition at line 692 of file helper.c.

Here is the call graph for this function:

◆ m0_be_ut_reqh_create()

M0_INTERNAL void m0_be_ut_reqh_create ( struct m0_reqh **  pptr)

Definition at line 142 of file helper.c.

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

◆ m0_be_ut_reqh_destroy()

M0_INTERNAL void m0_be_ut_reqh_destroy ( void  )

Definition at line 169 of file helper.c.

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

◆ m0_be_ut_seg_allocate_addr()

M0_INTERNAL void* m0_be_ut_seg_allocate_addr ( m0_bcount_t  size)

Definition at line 107 of file helper.c.

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

◆ m0_be_ut_seg_allocate_id()

M0_INTERNAL uint64_t m0_be_ut_seg_allocate_id ( void  )

Definition at line 124 of file helper.c.

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

◆ m0_be_ut_seg_allocator_fini()

void m0_be_ut_seg_allocator_fini ( struct m0_be_ut_seg ut_seg,
struct m0_be_ut_backend ut_be 
)

Definition at line 759 of file helper.c.

Here is the call graph for this function:

◆ m0_be_ut_seg_allocator_init()

void m0_be_ut_seg_allocator_init ( struct m0_be_ut_seg ut_seg,
struct m0_be_ut_backend ut_be 
)

Definition at line 753 of file helper.c.

Here is the call graph for this function:

◆ m0_be_ut_seg_fini()

void m0_be_ut_seg_fini ( struct m0_be_ut_seg ut_seg)

Definition at line 661 of file helper.c.

Here is the call graph for this function:

◆ m0_be_ut_seg_init()

void m0_be_ut_seg_init ( struct m0_be_ut_seg ut_seg,
struct m0_be_ut_backend ut_be,
m0_bcount_t  size 
)

Definition at line 630 of file helper.c.

Here is the call graph for this function:

◆ m0_be_ut_seg_reload()

void m0_be_ut_seg_reload ( struct m0_be_ut_seg ut_seg)

Definition at line 703 of file helper.c.

Here is the call graph for this function:

◆ m0_be_ut_sm_group_thread_fini()

static void m0_be_ut_sm_group_thread_fini ( struct m0_be_ut_sm_group_thread sgt)
static

Definition at line 235 of file helper.c.

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

◆ m0_be_ut_sm_group_thread_init()

static int m0_be_ut_sm_group_thread_init ( struct m0_be_ut_sm_group_thread **  sgtp,
bool  lock_new 
)
static

Definition at line 202 of file helper.c.

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

◆ m0_be_ut_tx_init()

void m0_be_ut_tx_init ( struct m0_be_tx tx,
struct m0_be_ut_backend ut_be 
)

Definition at line 620 of file helper.c.

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

◆ M0_BOB_DEFINE()

M0_BOB_DEFINE ( M0_INTERNAL  ,
m0_ut_be_backend_bobtype,
m0_be_ut_backend   
)

Variable Documentation

◆ be_ut_helper

struct be_ut_helper_struct be_ut_helper
static
Initial value:
= {
.buh_once_control = PTHREAD_ONCE_INIT,
}

Definition at line 77 of file helper.c.

◆ m0_ut_be_backend_bobtype

const struct m0_bob_type m0_ut_be_backend_bobtype
Initial value:
= {
.bt_name = "m0_ut_be_backend_bobtype",
.bt_magix_offset = offsetof(struct m0_be_ut_backend, but_magix),
.bt_magix = M0_BE_TX_ENGINE_MAGIC,
.bt_check = NULL,
}
#define NULL
Definition: misc.h:38
#define offsetof(typ, memb)
Definition: misc.h:29

Definition at line 49 of file helper.c.