Motr  M0
obj.c File Reference
#include "lib/trace.h"
#include "layout/layout.h"
#include "pool/pool.h"
#include "ut/ut.h"
#include "motr/ut/client.h"
#include "motr/cob.c"
#include "motr/obj.c"
Include dependency graph for obj.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CLIENT
 

Functions

static int t_register (struct m0_layout_domain *dom, const struct m0_layout_type *lt)
 
static void t_unregister (struct m0_layout_domain *dom, const struct m0_layout_type *lt)
 
static m0_bcount_t t_max_recsize (struct m0_layout_domain *dom)
 
static void ut_layout_enum_get (const struct m0_layout_enum *e, uint32_t idx, const struct m0_fid *gfid, struct m0_fid *out)
 
static uint32_t ut_layout_nr (const struct m0_layout_enum *e)
 
static struct m0_layout_enumut_lio_ops_to_enum (const struct m0_layout_instance *li)
 
static void ut_lio_fini (struct m0_layout_instance *li)
 
static int ut_m0_ops_instance_build (struct m0_layout *layout, const struct m0_fid *fid, struct m0_layout_instance **linst)
 
void ut_m0_ops_fini (struct m0_ref *ref)
 
M0_INTERNAL void m0_layout__init (struct m0_layout *l, struct m0_layout_domain *dom, uint64_t lid, struct m0_layout_type *lt, const struct m0_layout_ops *ops)
 
M0_INTERNAL void m0_layout__populate (struct m0_layout *l, uint32_t user_count)
 
 M0_BOB_DEFINE (M0_INTERNAL, &enum_bob, m0_layout_enum)
 
 M0_BOB_DEFINE (M0_INTERNAL, &layout_instance_bob, m0_layout_instance)
 
M0_INTERNAL void ut_layout_init (struct m0_layout *layout, struct m0_layout_domain *dom)
 
M0_INTERNAL void ut_striped_layout_init (struct m0_striped_layout *stl, struct m0_layout_domain *dom)
 
static void ut_layout_fini (struct m0_layout *l, struct m0_layout_domain *dom)
 
M0_INTERNAL void ut_striped_layout_fini (struct m0_striped_layout *stl, struct m0_layout_domain *dom)
 
void ut_layout_domain_fill (struct m0_client *cinst)
 
void ut_layout_domain_empty (struct m0_client *cinst)
 
static void ut_test_m0_op_obj_invariant (void)
 
static void ut_test_m0_op_obj_ast_rc_invariant (void)
 
static void ut_test_cob_req_invariant (void)
 
static void ut_test_m0_op_common_invariant (void)
 
static void ut_test_m0__obj_layout_instance_build (void)
 
static void ut_test_m0_fid_print (void)
 
static void ut_test_obj_namei_op_init (void)
 
static void ut_test_obj_op_obj_invariant (void)
 
static void ut_test_obj_op_obj_init (void)
 
static void ut_test_obj_op_prepare (void)
 
static void ut_entity_namei_op (enum m0_entity_opcode opcode)
 
static void ut_test_entity_namei_op_create (void)
 
static void ut_test_entity_namei_op_delete (void)
 
static void ut_test_obj_lid_assign (void)
 
static void ut_test_m0_entity_create (void)
 
static void ut_test_m0_entity_delete (void)
 
static void ut_test_m0__entity_instance (void)
 
static void ut_test_m0__oo_instance (void)
 
static void ut_test_cob_complete_op (void)
 
static void ut_test_cob_fail_op (void)
 
static void ut_test_rpc_item_to_ios_cob_req (void)
 
static void ut_test_icr_ast_complete (void)
 
static void ut_test_icr_ast_fail (void)
 
static void ut_test_icr_ast_ver_mismatch (void)
 
static void ut_test_cob_rio_ios_replied (void)
 
static void ut_test_cob_ios_fop_populate (void)
 
static void ut_test_m0_obj_container_id_to_session (void)
 
static void ut_test_m0_cob_ios_fop_fini (void)
 
static void ut_test_cob_ios_send (void)
 
static void ut_test_rpc_item_to_cr (void)
 
static void ut_test_cob_ast_fail_oo (void)
 
static void ut_test_cob_rio_mds_replied (void)
 
static void ut_test_cob_name_mem2wire (void)
 
static void ut_test_cob_body_mem2wire (void)
 
static void ut_test_cob_mds_fop_populate (void)
 
static void ut_test_cob_mds_send (void)
 
static void ut_test_obj_namei_cb_launch (void)
 
static void ut_test_obj_namei_cb_free (void)
 
static void ut_test_obj_namei_cb_fini (void)
 
M0_INTERNAL int ut_object_init (void)
 
M0_INTERNAL int ut_object_fini (void)
 

Variables

static const struct m0_layout_type_ops ut_layout_type_ops
 
static struct m0_layout_type ut_layout_type
 
static struct m0_layout ut_layout
 
struct m0_fid ut_fid
 
static struct m0_layout_enum_ops ut_layout_enum_ops
 
static struct m0_layout_enum_type ut_layout_enum_type
 
struct m0_layout_enum ut_layout_enum
 
struct m0_layout_instance_ops ut_layout_instance_ops
 
static struct m0_layout_instance ut_layout_instance
 
static struct m0_layout_ops ut_layout_ops
 
static const struct m0_bob_type enum_bob
 
static const struct m0_bob_type layout_instance_bob
 
struct m0_ut_suite ut_suite_obj
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CLIENT

Definition at line 23 of file obj.c.

Function Documentation

◆ M0_BOB_DEFINE() [1/2]

M0_BOB_DEFINE ( M0_INTERNAL  ,
enum_bob,
m0_layout_enum   
)

◆ M0_BOB_DEFINE() [2/2]

M0_BOB_DEFINE ( M0_INTERNAL  ,
layout_instance_bob,
m0_layout_instance   
)

◆ t_max_recsize()

static m0_bcount_t t_max_recsize ( struct m0_layout_domain dom)
static

Definition at line 53 of file obj.c.

◆ t_register()

static int t_register ( struct m0_layout_domain dom,
const struct m0_layout_type lt 
)
static

Definition at line 42 of file obj.c.

◆ t_unregister()

static void t_unregister ( struct m0_layout_domain dom,
const struct m0_layout_type lt 
)
static

Definition at line 48 of file obj.c.

◆ ut_entity_namei_op()

static void ut_entity_namei_op ( enum m0_entity_opcode  opcode)
static

Helper function to test entity_namei_op() client entry point.

Definition at line 585 of file obj.c.

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

◆ ut_layout_domain_empty()

void ut_layout_domain_empty ( struct m0_client cinst)

Empties a layout domain that has been filled via ut_layout_domain_fill().

Parameters
cinstclient instance.

Definition at line 218 of file obj.c.

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

◆ ut_layout_domain_fill()

void ut_layout_domain_fill ( struct m0_client cinst)

Fills the layout_domain of a m0_ instance, so it contains only a layout's id. This only guarantees m0_layout_find(M0_DEFAULT_LAYOUT_ID) returns something.

Parameters
layoutlayout to be added to the domain.
cinstclient instance.
Remarks
This might be seen as a workaround to reduce dependencies with other motr components.
cinst must have been successfully initialised at least until the IL_HA_STATE level.

Definition at line 208 of file obj.c.

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

◆ ut_layout_enum_get()

static void ut_layout_enum_get ( const struct m0_layout_enum e,
uint32_t  idx,
const struct m0_fid gfid,
struct m0_fid out 
)
static

Definition at line 73 of file obj.c.

Here is the call graph for this function:

◆ ut_layout_fini()

static void ut_layout_fini ( struct m0_layout l,
struct m0_layout_domain dom 
)
static

Definition at line 189 of file obj.c.

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

◆ ut_layout_init()

M0_INTERNAL void ut_layout_init ( struct m0_layout layout,
struct m0_layout_domain dom 
)

Definition at line 159 of file obj.c.

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

◆ ut_layout_nr()

static uint32_t ut_layout_nr ( const struct m0_layout_enum e)
static

Definition at line 80 of file obj.c.

◆ ut_lio_fini()

static void ut_lio_fini ( struct m0_layout_instance li)
static

Definition at line 102 of file obj.c.

◆ ut_lio_ops_to_enum()

static struct m0_layout_enum* ut_lio_ops_to_enum ( const struct m0_layout_instance li)
static

Definition at line 95 of file obj.c.

◆ ut_m0_ops_fini()

void ut_m0_ops_fini ( struct m0_ref ref)

Definition at line 125 of file obj.c.

◆ ut_m0_ops_instance_build()

static int ut_m0_ops_instance_build ( struct m0_layout layout,
const struct m0_fid fid,
struct m0_layout_instance **  linst 
)
static

Definition at line 112 of file obj.c.

Here is the call graph for this function:

◆ ut_object_fini()

M0_INTERNAL int ut_object_fini ( void  )

Definition at line 1525 of file obj.c.

Here is the call graph for this function:

◆ ut_object_init()

M0_INTERNAL int ut_object_init ( void  )

Definition at line 1514 of file obj.c.

Here is the call graph for this function:

◆ ut_striped_layout_fini()

M0_INTERNAL void ut_striped_layout_fini ( struct m0_striped_layout stl,
struct m0_layout_domain dom 
)

Definition at line 202 of file obj.c.

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

◆ ut_striped_layout_init()

M0_INTERNAL void ut_striped_layout_init ( struct m0_striped_layout stl,
struct m0_layout_domain dom 
)

Definition at line 180 of file obj.c.

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

◆ ut_test_cob_ast_fail_oo()

static void ut_test_cob_ast_fail_oo ( void  )
static

Definition at line 1274 of file obj.c.

◆ ut_test_cob_body_mem2wire()

static void ut_test_cob_body_mem2wire ( void  )
static

Tests cob_body_mem2wire().

Definition at line 1310 of file obj.c.

Here is the call graph for this function:

◆ ut_test_cob_complete_op()

static void ut_test_cob_complete_op ( void  )
static

Tests cob_complete_op().

Definition at line 808 of file obj.c.

Here is the call graph for this function:

◆ ut_test_cob_fail_op()

static void ut_test_cob_fail_op ( void  )
static

Tests cob_fail_op().

Definition at line 874 of file obj.c.

Here is the call graph for this function:

◆ ut_test_cob_ios_fop_populate()

static void ut_test_cob_ios_fop_populate ( void  )
static

Tests ios_cob_fop_populate().

Definition at line 1156 of file obj.c.

Here is the call graph for this function:

◆ ut_test_cob_ios_send()

static void ut_test_cob_ios_send ( void  )
static

Cannot test the base case without calling to m0_rpc_post().

Definition at line 1251 of file obj.c.

◆ ut_test_cob_mds_fop_populate()

static void ut_test_cob_mds_fop_populate ( void  )
static

Tests cob_mds_fop_populate().

Definition at line 1350 of file obj.c.

Here is the call graph for this function:

◆ ut_test_cob_mds_send()

static void ut_test_cob_mds_send ( void  )
static

Tests obj_filename_to_mds_session().

Definition at line 1435 of file obj.c.

◆ ut_test_cob_name_mem2wire()

static void ut_test_cob_name_mem2wire ( void  )
static

Tests cob_name_mem2wire().

Definition at line 1288 of file obj.c.

Here is the call graph for this function:

◆ ut_test_cob_req_invariant()

static void ut_test_cob_req_invariant ( void  )
static

Tests ios_cob_req_invariant().

Definition at line 291 of file obj.c.

Here is the call graph for this function:

◆ ut_test_cob_rio_ios_replied()

static void ut_test_cob_rio_ios_replied ( void  )
static

Definition at line 1148 of file obj.c.

◆ ut_test_cob_rio_mds_replied()

static void ut_test_cob_rio_mds_replied ( void  )
static

Cannot test the base case without calling m0_rpc_post().

Definition at line 1281 of file obj.c.

◆ ut_test_entity_namei_op_create()

static void ut_test_entity_namei_op_create ( void  )
static

Tests entity_namei_op() as used when creating an object.

Definition at line 648 of file obj.c.

Here is the call graph for this function:

◆ ut_test_entity_namei_op_delete()

static void ut_test_entity_namei_op_delete ( void  )
static

Tests entity_namei_op() as used when deleting an object.

Definition at line 656 of file obj.c.

Here is the call graph for this function:

◆ ut_test_icr_ast_complete()

static void ut_test_icr_ast_complete ( void  )
static

Tests obj_icr_ast_complete().

Definition at line 953 of file obj.c.

Here is the call graph for this function:

◆ ut_test_icr_ast_fail()

static void ut_test_icr_ast_fail ( void  )
static

Tests obj_icr_ast_fail().

Definition at line 1058 of file obj.c.

Here is the call graph for this function:

◆ ut_test_icr_ast_ver_mismatch()

static void ut_test_icr_ast_ver_mismatch ( void  )
static

Definition at line 1144 of file obj.c.

◆ ut_test_m0__entity_instance()

static void ut_test_m0__entity_instance ( void  )
static

Tests m0__entity_instance().

Definition at line 752 of file obj.c.

Here is the call graph for this function:

◆ ut_test_m0__obj_layout_instance_build()

static void ut_test_m0__obj_layout_instance_build ( void  )
static

Tests only the pre-conditions of m0_obj_layout_instance_build().

Definition at line 340 of file obj.c.

Here is the call graph for this function:

◆ ut_test_m0__oo_instance()

static void ut_test_m0__oo_instance ( void  )
static

Tests m0__oo_instance().

Definition at line 779 of file obj.c.

Here is the call graph for this function:

◆ ut_test_m0_cob_ios_fop_fini()

static void ut_test_m0_cob_ios_fop_fini ( void  )
static

Definition at line 1244 of file obj.c.

◆ ut_test_m0_entity_create()

static void ut_test_m0_entity_create ( void  )
static

Definition at line 690 of file obj.c.

Here is the call graph for this function:

◆ ut_test_m0_entity_delete()

static void ut_test_m0_entity_delete ( void  )
static

Definition at line 721 of file obj.c.

Here is the call graph for this function:

◆ ut_test_m0_fid_print()

static void ut_test_m0_fid_print ( void  )
static

Tests obj_fid_make_name().

Definition at line 373 of file obj.c.

Here is the call graph for this function:

◆ ut_test_m0_obj_container_id_to_session()

static void ut_test_m0_obj_container_id_to_session ( void  )
static

Tests m0_obj_container_id_to_session().

Definition at line 1213 of file obj.c.

Here is the call graph for this function:

◆ ut_test_m0_op_common_invariant()

static void ut_test_m0_op_common_invariant ( void  )
static

Tests m0_op_common_invariant().

Definition at line 315 of file obj.c.

Here is the call graph for this function:

◆ ut_test_m0_op_obj_ast_rc_invariant()

static void ut_test_m0_op_obj_ast_rc_invariant ( void  )
static

Tests m0_op_obj_ast_rc_invariant().

Definition at line 267 of file obj.c.

Here is the call graph for this function:

◆ ut_test_m0_op_obj_invariant()

static void ut_test_m0_op_obj_invariant ( void  )
static

Tests m0_op_obj_invariant().

Definition at line 240 of file obj.c.

Here is the call graph for this function:

◆ ut_test_obj_lid_assign()

static void ut_test_obj_lid_assign ( void  )
static

Definition at line 661 of file obj.c.

Here is the call graph for this function:

◆ ut_test_obj_namei_cb_fini()

static void ut_test_obj_namei_cb_fini ( void  )
static

Tests obj_namei_cb_fini().

Definition at line 1476 of file obj.c.

Here is the call graph for this function:

◆ ut_test_obj_namei_cb_free()

static void ut_test_obj_namei_cb_free ( void  )
static

Tests obj_namei_cb_free().

Definition at line 1446 of file obj.c.

Here is the call graph for this function:

◆ ut_test_obj_namei_cb_launch()

static void ut_test_obj_namei_cb_launch ( void  )
static

Definition at line 1439 of file obj.c.

◆ ut_test_obj_namei_op_init()

static void ut_test_obj_namei_op_init ( void  )
static

Tests obj_namei_op_init().

Definition at line 389 of file obj.c.

Here is the call graph for this function:

◆ ut_test_obj_op_obj_init()

static void ut_test_obj_op_obj_init ( void  )
static

Tests pre-conditions and base case for obj_op_obj_init().

Definition at line 489 of file obj.c.

Here is the call graph for this function:

◆ ut_test_obj_op_obj_invariant()

static void ut_test_obj_op_obj_invariant ( void  )
static

Tests obj_op_obj_invariant().

Definition at line 455 of file obj.c.

Here is the call graph for this function:

◆ ut_test_obj_op_prepare()

static void ut_test_obj_op_prepare ( void  )
static

Tests base case and preconditions of obj_op_prepare().

Definition at line 524 of file obj.c.

Here is the call graph for this function:

◆ ut_test_rpc_item_to_cr()

static void ut_test_rpc_item_to_cr ( void  )
static

Tests obj_rpc_item_to_cr().

Definition at line 1258 of file obj.c.

Here is the call graph for this function:

◆ ut_test_rpc_item_to_ios_cob_req()

static void ut_test_rpc_item_to_ios_cob_req ( void  )
static

Definition at line 938 of file obj.c.

Here is the call graph for this function:

Variable Documentation

◆ enum_bob

const struct m0_bob_type enum_bob
static
Initial value:
= {
.bt_name = "enum",
.bt_magix_offset = offsetof(struct m0_layout_enum, le_magic),
.bt_magix = M0_LAYOUT_ENUM_MAGIC,
.bt_check = NULL
}
#define NULL
Definition: misc.h:38
#define offsetof(typ, memb)
Definition: misc.h:29

Definition at line 142 of file obj.c.

◆ layout_instance_bob

const struct m0_bob_type layout_instance_bob
static
Initial value:
= {
.bt_name = "layout_instance",
.bt_magix_offset = offsetof(struct m0_layout_instance, li_magic),
.bt_check = NULL
}
#define NULL
Definition: misc.h:38
#define offsetof(typ, memb)
Definition: misc.h:29

Definition at line 150 of file obj.c.

◆ ut_fid

struct m0_fid ut_fid

Definition at line 71 of file obj.c.

◆ ut_layout

struct m0_layout ut_layout
static

Definition at line 68 of file obj.c.

◆ ut_layout_enum

struct m0_layout_enum ut_layout_enum

Definition at line 92 of file obj.c.

◆ ut_layout_enum_ops

struct m0_layout_enum_ops ut_layout_enum_ops
static
Initial value:
= {
.leo_get = &ut_layout_enum_get,
.leo_nr = &ut_layout_nr,
}
static uint32_t ut_layout_nr(const struct m0_layout_enum *e)
Definition: obj.c:80
static void ut_layout_enum_get(const struct m0_layout_enum *e, uint32_t idx, const struct m0_fid *gfid, struct m0_fid *out)
Definition: obj.c:73

Definition at line 86 of file obj.c.

◆ ut_layout_enum_type

struct m0_layout_enum_type ut_layout_enum_type
static

Definition at line 90 of file obj.c.

◆ ut_layout_instance

struct m0_layout_instance ut_layout_instance
static

Definition at line 111 of file obj.c.

◆ ut_layout_instance_ops

struct m0_layout_instance_ops ut_layout_instance_ops
Initial value:
= {
.lio_to_enum = ut_lio_ops_to_enum,
.lio_fini = ut_lio_fini,
}
static void ut_lio_fini(struct m0_layout_instance *li)
Definition: obj.c:102
static struct m0_layout_enum * ut_lio_ops_to_enum(const struct m0_layout_instance *li)
Definition: obj.c:95

Definition at line 106 of file obj.c.

◆ ut_layout_ops

struct m0_layout_ops ut_layout_ops
static
Initial value:
= {
.lo_instance_build = ut_m0_ops_instance_build,
.lo_fini = ut_m0_ops_fini,
}
void ut_m0_ops_fini(struct m0_ref *ref)
Definition: obj.c:125
static int ut_m0_ops_instance_build(struct m0_layout *layout, const struct m0_fid *fid, struct m0_layout_instance **linst)
Definition: obj.c:112

Definition at line 130 of file obj.c.

◆ ut_layout_type

struct m0_layout_type ut_layout_type
static
Initial value:
= {
.lt_name = "test",
.lt_id = M0_DEFAULT_LAYOUT_ID,
.lt_ops = &ut_layout_type_ops
}
static const struct m0_layout_type_ops ut_layout_type_ops
Definition: obj.c:58

Definition at line 63 of file obj.c.

◆ ut_layout_type_ops

const struct m0_layout_type_ops ut_layout_type_ops
static
Initial value:
= {
.lto_register = t_register,
.lto_unregister = t_unregister,
.lto_max_recsize = t_max_recsize
}
static void t_unregister(struct m0_layout_domain *dom, const struct m0_layout_type *lt)
Definition: obj.c:48
static int t_register(struct m0_layout_domain *dom, const struct m0_layout_type *lt)
Definition: obj.c:42
static m0_bcount_t t_max_recsize(struct m0_layout_domain *dom)
Definition: obj.c:53

Definition at line 58 of file obj.c.

◆ ut_suite_obj

struct m0_ut_suite ut_suite_obj

Definition at line 1512 of file obj.c.