Motr  M0
cob_foms.c File Reference
#include "ioservice/cob_foms.c"
#include "lib/trace.h"
#include "ioservice/ut/bulkio_common.h"
#include "mdservice/fsync_fops.h"
#include "rpc/rpclib.h"
#include "rpc/rpc_opcodes.h"
#include "rpc/rpc_machine.h"
#include "stob/type.h"
#include "stob/ad.h"
#include "stob/linux.h"
#include "ut/cs_fop.h"
#include "ut/misc.h"
#include "ut/ut.h"
Include dependency graph for cob_foms.c:

Go to the source code of this file.

Data Structures

struct  cobfoms_ut
 
struct  cobthread_arg
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_COB
 
#define SERVER_EP_ADDR   "0@lo:12345:34:1"
 
#define CLIENT_EP_ADDR   "0@lo:12345:34:*"
 
#define SERVER_ENDP   M0_NET_XPRT_PREFIX_DEFAULT":"SERVER_EP_ADDR
 

Enumerations

enum  cob_fom_type { COB_CREATE = 1, COB_DELETE = 2 }
 
enum  {
  CLIENT_COB_DOM_ID = 12, CLIENT_RPC_CONN_TIMEOUT = 200, CLIENT_MAX_RPCS_IN_FLIGHT = 8, COB_NAME_STRLEN = 34,
  GOB_FID_CONTAINER_ID = 1000, GOB_FID_KEY_ID = 5678, COB_FOP_SINGLE = 1, COB_FOP_NR = 5,
  POOL_WIDTH = 10, COB_TEST_KEY = 111
}
 
enum  { FID_UT_CONTAINER_BITS_MAX = 32, FID_UT_KEY_BITS_MAX = 64, FID_UT_DEVICE_ID_BITS_MAX = 24 }
 

Functions

static struct m0_fomcd_fom_alloc ()
 
static void cd_fom_dealloc (struct m0_fom *fom)
 
static void fom_dtx_init (struct m0_fom *fom, struct m0_sm_group *grp, enum m0_cob_op opcode)
 
static void fom_stob_tx_credit (struct m0_fom *fom, enum m0_cob_op opcode)
 
static void fom_dtx_done (struct m0_fom *fom, struct m0_sm_group *grp)
 
static void cd_stob_delete_test ()
 
static void cobfoms_utinit (void)
 
static void cobfoms_utfini (void)
 
static void cobfops_populate_internal (struct m0_fop *fop, uint64_t gob_fid_key)
 
static void cobfops_populate (uint64_t index)
 
static void cobfops_create (void)
 
static void cobfops_destroy (struct m0_fop_type *ftype1, struct m0_fop_type *ftype2)
 
static void cobfops_threads_init (void)
 
static void cobfops_threads_fini (void)
 
static void cobfops_send_wait (struct cobthread_arg *arg)
 
static void cobfoms_fops_dispatch (struct m0_fop_type *ftype, uint64_t flags, int expected_rc)
 
static void cobfoms_fop_thread_init (uint64_t fop_nr, uint64_t thread_nr)
 
static void cobfoms_fop_thread_fini (struct m0_fop_type *ftype1, struct m0_fop_type *ftype2)
 
static void cobfoms_send_internal (struct m0_fop_type *ftype1, struct m0_fop_type *ftype2, uint64_t flags, int rc1, int rc2, uint64_t nr)
 
static void cobfoms_single (void)
 
static void cobfoms_multiple (void)
 
static void cobfoms_preexisting_cob (void)
 
static void cobfoms_del_nonexist_cob (void)
 
static void cobfoms_fsync_send_fop (struct m0_be_tx_remid *remid, int expected_rc)
 
static void cobfoms_fsync_nonexist_tx (void)
 
static void cobfoms_fsync_create_delete (void)
 
static void fom_create (struct m0_fom **fom, enum cob_fom_type fomtype)
 
static void fom_fini (struct m0_fom *fom, enum cob_fom_type fomtype)
 
static void fop_alloc (struct m0_fom *fom, enum cob_fom_type fomtype)
 
static void fom_fini_test (enum cob_fom_type fomtype)
 
static void fom_get_test (enum cob_fom_type fomtype)
 
static void fom_create_test (enum cob_fom_type fomtype)
 
static void cc_fom_dealloc (struct m0_fom *fom)
 
static struct m0_fomcc_fom_alloc ()
 
static void cc_fom_create_test ()
 
static void cc_fom_fini_test ()
 
static void cc_fom_get_test ()
 
static void cc_stob_create_test ()
 
static void cob_verify (struct m0_fom *fom, const bool exists)
 
static void md_cob_fop_create_delete_test (bool create_p, const struct m0_fid *pver, int expected_reply_rc)
 
static void md_cob_create_delete ()
 
static void cc_cob_create_test ()
 
static void cc_fom_state_test (void)
 
static void cc_fom_populate_test ()
 
static void cd_fom_create_test ()
 
static void cd_fom_fini_test ()
 
static void cd_fom_get_test ()
 
static void cd_fom_populate_test ()
 
static struct m0_fomcob_testdata_create ()
 
static void cob_testdata_cleanup (struct m0_fom *fom)
 
static void cd_cob_delete_test ()
 
static void cd_fom_state_test (void)
 
static void dummy_locality_setup ()
 
static void cob_create_api_test (void)
 
static void cob_delete_api_test (void)
 
static void fid_convert_ut_check (uint32_t container, uint64_t key, uint32_t device_id)
 
static void fid_convert_ut (void)
 

Variables

struct m0_fop_type m0_fop_cob_create_fopt
 
struct m0_fop_type m0_fop_cob_delete_fopt
 
struct m0_fop_type m0_fop_fsync_ios_fopt
 
struct m0_reqh_service_type m0_ios_type
 
static struct cobfoms_utcut
 
static struct m0_fom_locality dummy_loc
 
static struct m0_cobtest_cob = NULL
 
static struct m0_fom_type ft
 
static bool cc_cob_create_test_done = false
 
static char COB_FOP_NR_STR [] = { '0' + COB_FOP_NR, '\0'}
 
static const char * SERVER_LOGFILE = "cobfoms_ut.log"
 
static char * server_args []
 
const struct m0_sm_conf cob_ops_conf
 
struct m0_ut_suite cobfoms_ut
 

Macro Definition Documentation

◆ CLIENT_EP_ADDR

#define CLIENT_EP_ADDR   "0@lo:12345:34:*"

Definition at line 84 of file cob_foms.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_COB

Definition at line 25 of file cob_foms.c.

◆ SERVER_ENDP

#define SERVER_ENDP   M0_NET_XPRT_PREFIX_DEFAULT":"SERVER_EP_ADDR

Definition at line 85 of file cob_foms.c.

◆ SERVER_EP_ADDR

#define SERVER_EP_ADDR   "0@lo:12345:34:1"

Definition at line 83 of file cob_foms.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CLIENT_COB_DOM_ID 
CLIENT_RPC_CONN_TIMEOUT 
CLIENT_MAX_RPCS_IN_FLIGHT 
COB_NAME_STRLEN 
GOB_FID_CONTAINER_ID 
GOB_FID_KEY_ID 
COB_FOP_SINGLE 
COB_FOP_NR 
POOL_WIDTH 
COB_TEST_KEY 

Definition at line 68 of file cob_foms.c.

◆ anonymous enum

anonymous enum
Enumerator
FID_UT_CONTAINER_BITS_MAX 
FID_UT_KEY_BITS_MAX 
FID_UT_DEVICE_ID_BITS_MAX 

Definition at line 1474 of file cob_foms.c.

◆ cob_fom_type

Enumerator
COB_CREATE 
COB_DELETE 

Definition at line 63 of file cob_foms.c.

Function Documentation

◆ cc_cob_create_test()

static void cc_cob_create_test ( )
static

Definition at line 876 of file cob_foms.c.

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

◆ cc_fom_alloc()

static struct m0_fom* cc_fom_alloc ( )
static

Definition at line 727 of file cob_foms.c.

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

◆ cc_fom_create_test()

static void cc_fom_create_test ( )
static

Definition at line 745 of file cob_foms.c.

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

◆ cc_fom_dealloc()

static void cc_fom_dealloc ( struct m0_fom fom)
static

Definition at line 717 of file cob_foms.c.

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

◆ cc_fom_fini_test()

static void cc_fom_fini_test ( )
static

Definition at line 753 of file cob_foms.c.

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

◆ cc_fom_get_test()

static void cc_fom_get_test ( )
static

Definition at line 761 of file cob_foms.c.

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

◆ cc_fom_populate_test()

static void cc_fom_populate_test ( )
static

Definition at line 1007 of file cob_foms.c.

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

◆ cc_fom_state_test()

static void cc_fom_state_test ( void  )
static

Definition at line 957 of file cob_foms.c.

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

◆ cc_stob_create_test()

static void cc_stob_create_test ( )
static

Definition at line 769 of file cob_foms.c.

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

◆ cd_cob_delete_test()

static void cd_cob_delete_test ( )
static

Definition at line 1184 of file cob_foms.c.

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

◆ cd_fom_alloc()

static struct m0_fom * cd_fom_alloc ( )
static

Definition at line 1042 of file cob_foms.c.

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

◆ cd_fom_create_test()

static void cd_fom_create_test ( )
static

Definition at line 1060 of file cob_foms.c.

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

◆ cd_fom_dealloc()

static void cd_fom_dealloc ( struct m0_fom fom)
static

Definition at line 1033 of file cob_foms.c.

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

◆ cd_fom_fini_test()

static void cd_fom_fini_test ( )
static

Definition at line 1068 of file cob_foms.c.

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

◆ cd_fom_get_test()

static void cd_fom_get_test ( )
static

Definition at line 1076 of file cob_foms.c.

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

◆ cd_fom_populate_test()

static void cd_fom_populate_test ( )
static

Definition at line 1084 of file cob_foms.c.

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

◆ cd_fom_state_test()

static void cd_fom_state_test ( void  )
static

Definition at line 1247 of file cob_foms.c.

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

◆ cd_stob_delete_test()

static void cd_stob_delete_test ( )
static

Definition at line 1142 of file cob_foms.c.

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

◆ cob_create_api_test()

static void cob_create_api_test ( void  )
static

Definition at line 1282 of file cob_foms.c.

Here is the call graph for this function:

◆ cob_delete_api_test()

static void cob_delete_api_test ( void  )
static

Definition at line 1313 of file cob_foms.c.

Here is the call graph for this function:

◆ cob_testdata_cleanup()

static void cob_testdata_cleanup ( struct m0_fom fom)
static

Definition at line 1134 of file cob_foms.c.

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

◆ cob_testdata_create()

static struct m0_fom* cob_testdata_create ( )
static

Definition at line 1104 of file cob_foms.c.

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

◆ cob_verify()

static void cob_verify ( struct m0_fom fom,
const bool  exists 
)
static

Definition at line 798 of file cob_foms.c.

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

◆ cobfoms_del_nonexist_cob()

static void cobfoms_del_nonexist_cob ( void  )
static

Definition at line 433 of file cob_foms.c.

Here is the call graph for this function:

◆ cobfoms_fop_thread_fini()

static void cobfoms_fop_thread_fini ( struct m0_fop_type ftype1,
struct m0_fop_type ftype2 
)
static

Definition at line 372 of file cob_foms.c.

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

◆ cobfoms_fop_thread_init()

static void cobfoms_fop_thread_init ( uint64_t  fop_nr,
uint64_t  thread_nr 
)
static

Definition at line 361 of file cob_foms.c.

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

◆ cobfoms_fops_dispatch()

static void cobfoms_fops_dispatch ( struct m0_fop_type ftype,
uint64_t  flags,
int  expected_rc 
)
static

Definition at line 325 of file cob_foms.c.

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

◆ cobfoms_fsync_create_delete()

static void cobfoms_fsync_create_delete ( void  )
static

Sends several create-delete pairs using sequential fids and then sends an fsync fop request to sync the last one. All the fops involved must succeed.

Definition at line 508 of file cob_foms.c.

Here is the call graph for this function:

◆ cobfoms_fsync_nonexist_tx()

static void cobfoms_fsync_nonexist_tx ( void  )
static

Tries to fsync a non-existent transaction and checks the right error code is returned.

Definition at line 457 of file cob_foms.c.

Here is the call graph for this function:

◆ cobfoms_fsync_send_fop()

static void cobfoms_fsync_send_fop ( struct m0_be_tx_remid remid,
int  expected_rc 
)
static

Sends an fsync fop request to the ioservice to trigger the fsync of a given transaction.

Parameters
remidRemote ID of the transaction to fsync.Any other lingering transaction in the ioservice with an ID lower than txid will be also immediately placed.
expected_rcExpected value for the rc included in the corresponding fsync fop reply. If the received value is different this function asserts.

Definition at line 467 of file cob_foms.c.

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

◆ cobfoms_multiple()

static void cobfoms_multiple ( void  )
static

Definition at line 405 of file cob_foms.c.

Here is the call graph for this function:

◆ cobfoms_preexisting_cob()

static void cobfoms_preexisting_cob ( void  )
static

Definition at line 411 of file cob_foms.c.

Here is the call graph for this function:

◆ cobfoms_send_internal()

static void cobfoms_send_internal ( struct m0_fop_type ftype1,
struct m0_fop_type ftype2,
uint64_t  flags,
int  rc1,
int  rc2,
uint64_t  nr 
)
static

Definition at line 379 of file cob_foms.c.

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

◆ cobfoms_single()

static void cobfoms_single ( void  )
static

Definition at line 395 of file cob_foms.c.

Here is the call graph for this function:

◆ cobfoms_utfini()

static void cobfoms_utfini ( void  )
static

Definition at line 162 of file cob_foms.c.

Here is the call graph for this function:

◆ cobfoms_utinit()

static void cobfoms_utinit ( void  )
static

Definition at line 121 of file cob_foms.c.

Here is the call graph for this function:

◆ cobfops_create()

static void cobfops_create ( void  )
static

Definition at line 211 of file cob_foms.c.

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

◆ cobfops_destroy()

static void cobfops_destroy ( struct m0_fop_type ftype1,
struct m0_fop_type ftype2 
)
static

Definition at line 239 of file cob_foms.c.

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

◆ cobfops_populate()

static void cobfops_populate ( uint64_t  index)
static

Definition at line 196 of file cob_foms.c.

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

◆ cobfops_populate_internal()

static void cobfops_populate_internal ( struct m0_fop fop,
uint64_t  gob_fid_key 
)
static

Definition at line 176 of file cob_foms.c.

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

◆ cobfops_send_wait()

static void cobfops_send_wait ( struct cobthread_arg arg)
static

Definition at line 293 of file cob_foms.c.

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

◆ cobfops_threads_fini()

static void cobfops_threads_fini ( void  )
static

Definition at line 280 of file cob_foms.c.

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

◆ cobfops_threads_init()

static void cobfops_threads_init ( void  )
static

Definition at line 264 of file cob_foms.c.

Here is the caller graph for this function:

◆ dummy_locality_setup()

static void dummy_locality_setup ( )
static

Definition at line 1275 of file cob_foms.c.

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

◆ fid_convert_ut()

static void fid_convert_ut ( void  )
static

Definition at line 1532 of file cob_foms.c.

Here is the call graph for this function:

◆ fid_convert_ut_check()

static void fid_convert_ut_check ( uint32_t  container,
uint64_t  key,
uint32_t  device_id 
)
static

Definition at line 1480 of file cob_foms.c.

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

◆ fom_create()

static void fom_create ( struct m0_fom **  fom,
enum cob_fom_type  fomtype 
)
static

Definition at line 575 of file cob_foms.c.

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

◆ fom_create_test()

static void fom_create_test ( enum cob_fom_type  fomtype)
static

Definition at line 705 of file cob_foms.c.

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

◆ fom_dtx_done()

static void fom_dtx_done ( struct m0_fom fom,
struct m0_sm_group grp 
)
static

Definition at line 1467 of file cob_foms.c.

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

◆ fom_dtx_init()

static void fom_dtx_init ( struct m0_fom fom,
struct m0_sm_group grp,
enum m0_cob_op  opcode 
)
static

Definition at line 1452 of file cob_foms.c.

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

◆ fom_fini()

static void fom_fini ( struct m0_fom fom,
enum cob_fom_type  fomtype 
)
static

Definition at line 604 of file cob_foms.c.

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

◆ fom_fini_test()

static void fom_fini_test ( enum cob_fom_type  fomtype)
static

Definition at line 667 of file cob_foms.c.

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

◆ fom_get_test()

static void fom_get_test ( enum cob_fom_type  fomtype)
static

Definition at line 688 of file cob_foms.c.

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

◆ fom_stob_tx_credit()

static void fom_stob_tx_credit ( struct m0_fom fom,
enum m0_cob_op  opcode 
)
static

Definition at line 1433 of file cob_foms.c.

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

◆ fop_alloc()

static void fop_alloc ( struct m0_fom fom,
enum cob_fom_type  fomtype 
)
static

Definition at line 624 of file cob_foms.c.

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

◆ md_cob_create_delete()

static void md_cob_create_delete ( )
static

Definition at line 860 of file cob_foms.c.

Here is the call graph for this function:

◆ md_cob_fop_create_delete_test()

static void md_cob_fop_create_delete_test ( bool  create_p,
const struct m0_fid pver,
int  expected_reply_rc 
)
static

Definition at line 833 of file cob_foms.c.

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

Variable Documentation

◆ cc_cob_create_test_done

bool cc_cob_create_test_done = false
static

Definition at line 53 of file cob_foms.c.

◆ COB_FOP_NR_STR

char COB_FOP_NR_STR[] = { '0' + COB_FOP_NR, '\0'}
static

Definition at line 81 of file cob_foms.c.

◆ cob_ops_conf

const struct m0_sm_conf cob_ops_conf

Definition at line 99 of file cob_foms.c.

◆ cobfoms_ut

Initial value:
= {
.ts_name = "cob-foms-ut",
.ts_init = NULL,
.ts_fini = NULL,
.ts_tests = {
{ "cobfoms_utinit", cobfoms_utinit},
{ "fid_convert", fid_convert_ut},
{ "cobfoms_fsync_nonexistent_tx", cobfoms_fsync_nonexist_tx},
{ "cobfoms_fsync_create_delete",
{ "cobfoms_single_fop", cobfoms_single},
{ "cobfoms_multiple_fops", cobfoms_multiple},
{ "cobfoms_preexisting_cob_create", cobfoms_preexisting_cob},
{ "cobfoms_delete_nonexistent_cob", cobfoms_del_nonexist_cob},
{ "cobfoms_md_cob_fop", md_cob_create_delete},
{ "cobfoms_create_cob_apitest", cob_create_api_test},
{ "cobfoms_delete_cob_apitest", cob_delete_api_test},
{ "cobfoms_utfini", cobfoms_utfini},
{ NULL, NULL }
}
}
static void cobfoms_fsync_nonexist_tx(void)
Definition: cob_foms.c:457
static void cobfoms_fsync_create_delete(void)
Definition: cob_foms.c:508
#define NULL
Definition: misc.h:38
static void cobfoms_utinit(void)
Definition: cob_foms.c:121
static void cobfoms_preexisting_cob(void)
Definition: cob_foms.c:411
static void cobfoms_del_nonexist_cob(void)
Definition: cob_foms.c:433
static void cob_create_api_test(void)
Definition: cob_foms.c:1282
static void cobfoms_single(void)
Definition: cob_foms.c:395
static void cob_delete_api_test(void)
Definition: cob_foms.c:1313
static void cobfoms_utfini(void)
Definition: cob_foms.c:162
static void cobfoms_multiple(void)
Definition: cob_foms.c:405
static void fid_convert_ut(void)
Definition: cob_foms.c:1532
static void md_cob_create_delete()
Definition: cob_foms.c:860

Definition at line 1556 of file cob_foms.c.

◆ cut

struct cobfoms_ut* cut
static

Definition at line 47 of file cob_foms.c.

◆ dummy_loc

struct m0_fom_locality dummy_loc
static

Definition at line 48 of file cob_foms.c.

◆ ft

struct m0_fom_type ft
static

Definition at line 51 of file cob_foms.c.

◆ m0_fop_cob_create_fopt

struct m0_fop_type m0_fop_cob_create_fopt

Definition at line 75 of file io_fops.c.

◆ m0_fop_cob_delete_fopt

struct m0_fop_type m0_fop_cob_delete_fopt

Definition at line 76 of file io_fops.c.

◆ m0_fop_fsync_ios_fopt

struct m0_fop_type m0_fop_fsync_ios_fopt

Definition at line 82 of file io_fops.c.

◆ server_args

char* server_args[]
static
Initial value:
= {
"m0d", "-T", "AD", "-D", "cobfoms_ut.db", "-S",
"cobfoms_ut_stob", "-A", "linuxstob:cobfoms_ut_addb_stob",
"-w", "10", "-e", SERVER_ENDP, "-H", SERVER_EP_ADDR,
"-c", M0_UT_PATH("diter.xc")
}
#define SERVER_EP_ADDR
Definition: cob_foms.c:83
#define SERVER_ENDP
Definition: cob_foms.c:85
#define M0_UT_CONF_PROCESS
Definition: misc.h:45
static char COB_FOP_NR_STR[]
Definition: cob_foms.c:81
#define M0_UT_PATH(name)
Definition: misc.h:41

Definition at line 112 of file cob_foms.c.

◆ SERVER_LOGFILE

const char* SERVER_LOGFILE = "cobfoms_ut.log"
static

Definition at line 87 of file cob_foms.c.

◆ test_cob

struct m0_cob* test_cob = NULL
static

Definition at line 50 of file cob_foms.c.