Motr  M0
helper.h File Reference
#include "lib/types.h"
#include "lib/buf.h"
#include "lib/memory.h"
#include "sm/sm.h"
#include "be/domain.h"
#include "be/seg.h"
#include "be/seg0.h"
#include "lib/bob.h"
Include dependency graph for helper.h:

Go to the source code of this file.

Data Structures

struct  m0_be_ut_backend
 
struct  m0_be_ut_seg
 

Macros

#define __MOTR_BE_UT_HELPER_H__
 
#define M0_BE_UT_ALLOC_PTR(ut_be, ut_seg, ptr)
 
#define M0_BE_UT_FREE_PTR(ut_be, ut_seg, ptr)   m0_be_ut_free((ut_be), (ut_seg), (ptr))
 
#define M0_BE_UT_TRANSACT(__ut_be, __tx, __cred, __credit_func, __action_func)
 

Enumerations

enum  { BE_UT_SEG_START_ADDR = 0x400000000000ULL, BE_UT_SEG_START_ID = 42, BE_UT_LOG_ID = BE_UT_SEG_START_ID - 2 }
 

Functions

 M0_BOB_DECLARE (M0_INTERNAL, m0_be_ut_backend)
 
void m0_be_ut_backend_cfg_default (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 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)
 
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_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_del (struct m0_be_ut_backend *ut_be, struct m0_be_seg *seg)
 
M0_INTERNAL void m0_be_ut_reqh_create (struct m0_reqh **pptr)
 
M0_INTERNAL void m0_be_ut_reqh_destroy (void)
 
struct m0_sm_groupm0_be_ut_backend_sm_group_lookup (struct m0_be_ut_backend *ut_be)
 
M0_INTERNAL 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)
 
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)
 
void m0_be_ut_seg_reload (struct m0_be_ut_seg *ut_seg)
 
M0_INTERNAL void * m0_be_ut_seg_allocate_addr (m0_bcount_t size)
 
M0_INTERNAL uint64_t m0_be_ut_seg_allocate_id (void)
 
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)
 
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)
 

Variables

const struct m0_bob_type m0_ut_be_backend_bobtype
 

Macro Definition Documentation

◆ __MOTR_BE_UT_HELPER_H__

#define __MOTR_BE_UT_HELPER_H__

Definition at line 25 of file helper.h.

◆ M0_BE_UT_ALLOC_PTR

#define M0_BE_UT_ALLOC_PTR (   ut_be,
  ut_seg,
  ptr 
)
Value:
(void **) &(ptr), sizeof(*(ptr)))
static void ptr(struct m0_addb2__context *ctx, const uint64_t *v, char *buf)
Definition: dump.c:440
struct m0_be_ut_seg ut_seg
Definition: ad.c:73
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: stubs.c:300
struct m0_be_ut_backend ut_be
Definition: ad.c:72

Definition at line 147 of file helper.h.

◆ M0_BE_UT_FREE_PTR

#define M0_BE_UT_FREE_PTR (   ut_be,
  ut_seg,
  ptr 
)    m0_be_ut_free((ut_be), (ut_seg), (ptr))

Definition at line 151 of file helper.h.

◆ M0_BE_UT_TRANSACT

#define M0_BE_UT_TRANSACT (   __ut_be,
  __tx,
  __cred,
  __credit_func,
  __action_func 
)
Value:
do { \
struct m0_be_tx_credit __cred = {}; \
struct m0_be_tx *__tx; \
int __rc; \
M0_ALLOC_PTR(__tx); \
M0_ASSERT(__tx != NULL); \
m0_be_ut_tx_init(__tx, (__ut_be)); \
__credit_func; \
m0_be_tx_prep(__tx, &__cred); \
__rc = m0_be_tx_open_sync(__tx); \
M0_ASSERT_INFO(__rc == 0, "__rc = %d", __rc); \
if (__rc == 0) { \
__action_func; \
m0_be_tx_close_sync(__tx); \
} \
m0_be_tx_fini(__tx); \
m0_free(__tx); \
} while (0)
#define NULL
Definition: misc.h:38
M0_INTERNAL int m0_be_tx_open_sync(struct m0_be_tx *tx)
Definition: stubs.c:199
#define M0_ALLOC_PTR(ptr)
Definition: memory.h:86
Definition: tx.h:280

Executes __action_func in a single transaction. Uses __credit_func to get transaction credit.

See also
m0_be_ut_alloc()/m0_be_ut_free() source code for examples.

Definition at line 159 of file helper.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
BE_UT_SEG_START_ADDR 
BE_UT_SEG_START_ID 
BE_UT_LOG_ID 

Definition at line 37 of file helper.h.

Function Documentation

◆ 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 300 of file stubs.c.

Here is the call graph for this function:
Here is the caller 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 227 of file stubs.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 242 of file stubs.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 238 of file stubs.c.

Here is the call graph for this function:
Here is the caller 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 231 of file stubs.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()

M0_INTERNAL 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 277 of file stubs.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 282 of file stubs.c.

Here is the call graph for this function:
Here is the caller 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 308 of file stubs.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 251 of file stubs.c.

Here is the call graph for this function:
Here is the caller 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 246 of file stubs.c.

Here is the call graph for this function:
Here is the caller 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 267 of file stubs.c.

Here is the call graph for this function:
Here is the caller 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 256 of file stubs.c.

Here is the call graph for this function:
Here is the caller 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 272 of file stubs.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 286 of file stubs.c.

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

◆ M0_BOB_DECLARE()

M0_BOB_DECLARE ( M0_INTERNAL  ,
m0_be_ut_backend   
)

Variable Documentation

◆ m0_ut_be_backend_bobtype

const struct m0_bob_type m0_ut_be_backend_bobtype

Definition at line 49 of file helper.c.