29 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CLIENT 46 #include <linux/delay.h> 187 enum { CREATE_MULTIPLE_N_OBJS = 20 };
195 for (
i = 0;
i < CREATE_MULTIPLE_N_OBJS; ++
i) {
201 for (
i = 0;
i < CREATE_MULTIPLE_N_OBJS; ++
i) {
206 for (
i = 0;
i < CREATE_MULTIPLE_N_OBJS; ++
i) {
218 for (
i = 0;
i < CREATE_MULTIPLE_N_OBJS; ++
i) {
231 for (
i = 0;
i < CREATE_MULTIPLE_N_OBJS; ++
i) {
237 for (
i = 0;
i < CREATE_MULTIPLE_N_OBJS; ++
i) {
253 int nr_objs_per_pool = 10;
257 struct m0_fid pool_fids[2];
265 pool_fids[0].
f_key = 0x9;
267 pool_fids[1].
f_key = 0x1;
269 for (
i = 0;
i < nr_pools;
i++) {
270 for (j = 0; j < nr_objs_per_pool; j++) {
275 pool = pool_fids +
i;
324 for (
i = 0;
i < rounds;
i++) {
370 uint32_t rounds = 20;
371 uint32_t max_ops = 4;
375 bool *obj_used =
NULL;
376 bool *obj_exists =
NULL;
377 bool *already_chosen =
NULL;
400 for (
i = 0;
i < max_ops;
i++)
404 for (
i = 0;
i < n_objs; ++
i)
407 memset(obj_exists, 0, n_objs*
sizeof(obj_exists[0]));
409 for (
i = 0;
i < rounds; ++
i) {
412 memset(already_chosen, 0, n_objs*
sizeof(already_chosen[0]));
415 for (j = 0; j < n_ops; ++j) {
419 }
while(already_chosen[idx]);
420 already_chosen[idx] =
true;
421 obj_used[idx] =
true;
427 if (obj_exists[idx]) {
430 &objs[idx].ob_entity, &
ops[j]);
431 obj_exists[idx] =
false;
435 NULL, &objs[idx].ob_entity, &
ops[j]);
436 obj_exists[idx] =
true;
446 for (j = 0; j < n_ops; ++j) {
460 for (
i = 0;
i < max_ops; ++
i) {
466 for (
i = 0;
i < n_objs; ++
i) {
467 if (obj_used[
i] ==
true)
607 val = (
int *)
op->op_datum;
615 val = (
int *)
op->op_datum;
652 ops[0]->op_datum = (
void *)&
val;
672 memset(
obj, 0,
sizeof *
obj);
680 ops[0]->op_datum = (
void *)&
val;
740 {
"obj_create_simple",
742 {
"obj_create_error_handling",
744 {
"obj_open_non_existent",
746 {
"obj_create_multiple_objects",
748 {
"obj_create_on_multiple_pools",
750 {
"obj_create_then_delete",
752 {
"obj_delete_multiple",
758 {
"obj_wait_no_launch",
766 #undef M0_TRACE_SUBSYSTEM
static struct m0_uint128 test_id
int st_entity_create(struct m0_fid *pool, struct m0_entity *entity, struct m0_op **op)
static void obj_create_then_delete(void)
static int st_obj_suite_fini(void)
void st_op_free(struct m0_op *op)
static void obj_wait_twice(void)
static void mock_op_cb_stable(struct m0_op *op)
const m0_time_t M0_TIME_NEVER
void(* oop_executed)(struct m0_op *op)
#define MEM_ALLOC_PTR(arr)
uint64_t m0_client_layout_id(const struct m0_client *instance)
struct m0_container st_obj_container
const struct m0_uint128 M0_UBER_REALM
#define ST_ASSERT_FATAL(a)
const struct m0_uint128 M0_ID_APP
static void obj_create_multiple_objects(void)
static int st_obj_suite_init(void)
struct st_suite st_suite_obj
M0_INTERNAL void m0_fi_disable(const char *fp_func, const char *fp_tag)
void(* oop_stable)(struct m0_op *op)
struct m0_entity re_entity
static void m0_fi_enable(const char *func, const char *tag)
int oid_get(struct m0_uint128 *oid)
static void obj_create_error_handling(void)
static uint64_t layout_id
void console_printf(const char *fmt,...)
void(* oop_failed)(struct m0_op *op)
static void mem_free(const struct m0_be_btree *btree, struct m0_be_tx *tx, void *ptr)
struct m0_addb2__id_intrp ids[]
static void obj_wait_no_launch(void)
void st_obj_init(struct m0_obj *obj, struct m0_realm *parent, const struct m0_uint128 *id, uint64_t layout_id)
static struct m0_pool pool
static void obj_op_setup(void)
static void mock_op_cb_failed(struct m0_op *op)
static void obj_create_simple(void)
#define MEM_ALLOC_ARR(arr, nr)
static void obj_delete_multiple(void)
m0_time_t m0_time_from_now(uint64_t secs, long ns)
struct m0_client * st_get_instance()
void st_op_launch(struct m0_op **op, uint32_t nr)
void st_entity_fini(struct m0_entity *entity)
uint32_t generate_random(uint32_t max)
int st_entity_delete(struct m0_entity *entity, struct m0_op **op)
void m0_container_init(struct m0_container *con, struct m0_realm *parent, const struct m0_uint128 *id, struct m0_client *instance)
static void obj_no_wait(void)
void st_entity_open(struct m0_entity *entity)
int m0_entity_open(struct m0_entity *entity, struct m0_op **op)
static void obj_create_on_multiple_pools(void)
int32_t st_op_wait(struct m0_op *op, uint64_t bits, m0_time_t to)
void st_op_fini(struct m0_op *op)
static void obj_open_non_existent(void)
void m0_op_setup(struct m0_op *op, const struct m0_op_ops *cbs, m0_time_t linger)