Motr  M0
crate_io.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/time.h>
#include <assert.h>
#include <stdarg.h>
#include <unistd.h>
#include "lib/finject.h"
#include "lib/trace.h"
#include "motr/client.h"
#include "motr/client_internal.h"
#include "motr/idx.h"
#include "motr/m0crate/logger.h"
#include "motr/m0crate/workload.h"
#include "motr/m0crate/crate_client.h"
#include "motr/m0crate/crate_client_utils.h"
Include dependency graph for crate_io.c:

Go to the source code of this file.

Data Structures

struct  m0_op_context
 

Typedefs

typedef int(* cr_operation_t) (struct m0_workload_io *cwi, struct m0_task_io *cti, struct m0_op_context *op_ctx, struct m0_obj *obj, int free_slot, int obj_idx, int op_index)
 

Functions

void integrity (struct m0_uint128 object_id, unsigned char **md5toverify, int block_count, int idx_op)
 
void list_index_return (struct workload *w)
 
static size_t cr_rand___range_l (size_t end)
 
void cr_time_acc (m0_time_t *t1, m0_time_t t2)
 
void cr_op_stable (struct m0_op *op)
 
void cr_op_failed (struct m0_op *op)
 
static void cti_cleanup_op (struct m0_task_io *cti, int i)
 
int cr_free_op_idx (struct m0_task_io *cti, uint32_t nr_ops)
 
static void cr_cti_cleanup (struct m0_task_io *cti, int nr_ops)
 
int cr_io_vector_prep (struct m0_workload_io *cwi, struct m0_task_io *cti, struct m0_op_context *op_ctx, int obj_idx, int op_index)
 
static struct m0_fidcheck_fid (struct m0_fid *id)
 
int cr_namei_create (struct m0_workload_io *cwi, struct m0_task_io *cti, struct m0_op_context *op_ctx, struct m0_obj *obj, int free_slot, int obj_idx, int op_index)
 
int cr_namei_open (struct m0_workload_io *cwi, struct m0_task_io *cti, struct m0_op_context *op_ctx, struct m0_obj *obj, int free_slot, int obj_idx, int op_index)
 
int cr_namei_delete (struct m0_workload_io *cwi, struct m0_task_io *cti, struct m0_op_context *op_ctx, struct m0_obj *obj, int free_slot, int obj_idx, int op_index)
 
int cr_io_write (struct m0_workload_io *cwi, struct m0_task_io *cti, struct m0_op_context *op_ctx, struct m0_obj *obj, int free_slot, int obj_idx, int op_index)
 
int cr_io_read (struct m0_workload_io *cwi, struct m0_task_io *cti, struct m0_op_context *op_ctx, struct m0_obj *obj, int free_slot, int obj_idx, int op_index)
 
int cr_execute_ops (struct m0_workload_io *cwi, struct m0_task_io *cti, struct m0_obj *obj, struct m0_op_ops *cbs, enum m0_operations op_code, int obj_idx)
 
void cr_cti_report (struct m0_task_io *cti, enum m0_operations op_code)
 
int cr_op_namei (struct m0_workload_io *cwi, struct m0_task_io *cti, enum m0_operations op_code)
 
int cr_op_io (struct m0_workload_io *cwi, struct m0_task_io *cti, enum m0_operations op_code)
 
int cr_task_share_execute (struct m0_task_io *cti)
 
int cr_task_execute (struct m0_task_io *cti)
 
static int cr_adopt_motr_thread (struct m0_task_io *cti)
 
static int cr_release_motr_thread (struct m0_task_io *cti)
 
int cr_buffer_read (char *buffer, const char *filename, uint64_t size)
 
static uint64_t nz_rand (void)
 
void cr_get_oids (struct m0_uint128 *ids, uint32_t nr_objs)
 
void cr_task_bufs_free (struct m0_task_io *cti, int idx)
 
void cr_task_io_cleanup (struct m0_task_io **cti_p)
 
int cr_task_prep_bufs (struct m0_workload_io *cwi, struct m0_task_io *cti)
 
int cr_task_prep_one (struct m0_workload_io *cwi, struct m0_task_io **cti_out)
 
int cr_tasks_prepare (struct workload *w, struct workload_task *tasks)
 
int cr_tasks_release (struct workload *w, struct workload_task *tasks)
 
bool cr_time_not_expired (struct workload *w)
 
static uint64_t bw (uint64_t bytes, m0_time_t time)
 
void run (struct workload *w, struct workload_task *tasks)
 
void m0_op_run (struct workload *w, struct workload_task *task, const struct workload_op *op)
 

Variables

cr_operation_t opcode_operation_map []
 

Typedef Documentation

◆ cr_operation_t

typedef int(* cr_operation_t) (struct m0_workload_io *cwi, struct m0_task_io *cti, struct m0_op_context *op_ctx, struct m0_obj *obj, int free_slot, int obj_idx, int op_index)

Definition at line 121 of file crate_io.c.

Function Documentation

◆ bw()

static uint64_t bw ( uint64_t  bytes,
m0_time_t  time 
)
static

Returns bandwidth in bytes / sec.

Definition at line 1004 of file crate_io.c.

Here is the caller graph for this function:

◆ check_fid()

static struct m0_fid* check_fid ( struct m0_fid id)
static

Definition at line 339 of file crate_io.c.

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

◆ cr_adopt_motr_thread()

static int cr_adopt_motr_thread ( struct m0_task_io cti)
static

Definition at line 739 of file crate_io.c.

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

◆ cr_buffer_read()

int cr_buffer_read ( char *  buffer,
const char *  filename,
uint64_t  size 
)

Definition at line 765 of file crate_io.c.

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

◆ cr_cti_cleanup()

static void cr_cti_cleanup ( struct m0_task_io cti,
int  nr_ops 
)
static

Definition at line 235 of file crate_io.c.

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

◆ cr_cti_report()

void cr_cti_report ( struct m0_task_io cti,
enum m0_operations  op_code 
)

Definition at line 483 of file crate_io.c.

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

◆ cr_execute_ops()

int cr_execute_ops ( struct m0_workload_io cwi,
struct m0_task_io cti,
struct m0_obj obj,
struct m0_op_ops cbs,
enum m0_operations  op_code,
int  obj_idx 
)

Definition at line 445 of file crate_io.c.

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

◆ cr_free_op_idx()

int cr_free_op_idx ( struct m0_task_io cti,
uint32_t  nr_ops 
)

Definition at line 217 of file crate_io.c.

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

◆ cr_get_oids()

void cr_get_oids ( struct m0_uint128 ids,
uint32_t  nr_objs 
)

Definition at line 796 of file crate_io.c.

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

◆ cr_io_read()

int cr_io_read ( struct m0_workload_io cwi,
struct m0_task_io cti,
struct m0_op_context op_ctx,
struct m0_obj obj,
int  free_slot,
int  obj_idx,
int  op_index 
)

Create object index and buffer vectors.

Definition at line 414 of file crate_io.c.

Here is the call graph for this function:

◆ cr_io_vector_prep()

int cr_io_vector_prep ( struct m0_workload_io cwi,
struct m0_task_io cti,
struct m0_op_context op_ctx,
int  obj_idx,
int  op_index 
)

TODO: set attr to NULL to disable cksum, enable after addding cksum in ST

Definition at line 244 of file crate_io.c.

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

◆ cr_io_write()

int cr_io_write ( struct m0_workload_io cwi,
struct m0_task_io cti,
struct m0_op_context op_ctx,
struct m0_obj obj,
int  free_slot,
int  obj_idx,
int  op_index 
)

Create object index and buffer vectors.

Definition at line 391 of file crate_io.c.

Here is the call graph for this function:

◆ cr_namei_create()

int cr_namei_create ( struct m0_workload_io cwi,
struct m0_task_io cti,
struct m0_op_context op_ctx,
struct m0_obj obj,
int  free_slot,
int  obj_idx,
int  op_index 
)

Definition at line 347 of file crate_io.c.

Here is the call graph for this function:

◆ cr_namei_delete()

int cr_namei_delete ( struct m0_workload_io cwi,
struct m0_task_io cti,
struct m0_op_context op_ctx,
struct m0_obj obj,
int  free_slot,
int  obj_idx,
int  op_index 
)

Definition at line 379 of file crate_io.c.

Here is the call graph for this function:

◆ cr_namei_open()

int cr_namei_open ( struct m0_workload_io cwi,
struct m0_task_io cti,
struct m0_op_context op_ctx,
struct m0_obj obj,
int  free_slot,
int  obj_idx,
int  op_index 
)

Open a created object, Refer EOS-285

Definition at line 363 of file crate_io.c.

Here is the call graph for this function:

◆ cr_op_failed()

void cr_op_failed ( struct m0_op op)

Definition at line 173 of file crate_io.c.

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

◆ cr_op_io()

int cr_op_io ( struct m0_workload_io cwi,
struct m0_task_io cti,
enum m0_operations  op_code 
)

Definition at line 584 of file crate_io.c.

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

◆ cr_op_namei()

int cr_op_namei ( struct m0_workload_io cwi,
struct m0_task_io cti,
enum m0_operations  op_code 
)

Close object only for create opcode

Definition at line 496 of file crate_io.c.

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

◆ cr_op_stable()

void cr_op_stable ( struct m0_op op)

Definition at line 151 of file crate_io.c.

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

◆ cr_rand___range_l()

static size_t cr_rand___range_l ( size_t  end)
static

Get pseudo-random uint64 in positive range [0;end) client index workload has a similar function. That function should be in utility and this should be deleted.

Definition at line 134 of file crate_io.c.

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

◆ cr_release_motr_thread()

static int cr_release_motr_thread ( struct m0_task_io cti)
static

Definition at line 756 of file crate_io.c.

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

◆ cr_task_bufs_free()

void cr_task_bufs_free ( struct m0_task_io cti,
int  idx 
)

Definition at line 809 of file crate_io.c.

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

◆ cr_task_execute()

int cr_task_execute ( struct m0_task_io cti)

IO workflow : Create an object - creates an object and close it. For io operation - open object, perform io and delete it.

Definition at line 672 of file crate_io.c.

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

◆ cr_task_io_cleanup()

void cr_task_io_cleanup ( struct m0_task_io **  cti_p)

Definition at line 817 of file crate_io.c.

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

◆ cr_task_prep_bufs()

int cr_task_prep_bufs ( struct m0_workload_io cwi,
struct m0_task_io cti 
)

Definition at line 838 of file crate_io.c.

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

◆ cr_task_prep_one()

int cr_task_prep_one ( struct m0_workload_io cwi,
struct m0_task_io **  cti_out 
)

Definition at line 869 of file crate_io.c.

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

◆ cr_task_share_execute()

int cr_task_share_execute ( struct m0_task_io cti)

Creates a global object shared by all the tasks in the workload. Object operation supported is READ/WRITE.

Only parallel writes are supported.

Definition at line 639 of file crate_io.c.

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

◆ cr_tasks_prepare()

int cr_tasks_prepare ( struct workload w,
struct workload_task tasks 
)

Definition at line 938 of file crate_io.c.

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

◆ cr_tasks_release()

int cr_tasks_release ( struct workload w,
struct workload_task tasks 
)

Definition at line 972 of file crate_io.c.

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

◆ cr_time_acc()

void cr_time_acc ( m0_time_t t1,
m0_time_t  t2 
)

Definition at line 146 of file crate_io.c.

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

◆ cr_time_not_expired()

bool cr_time_not_expired ( struct workload w)

Definition at line 989 of file crate_io.c.

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

◆ cti_cleanup_op()

static void cti_cleanup_op ( struct m0_task_io cti,
int  i 
)
static

Definition at line 190 of file crate_io.c.

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

◆ integrity()

void integrity ( struct m0_uint128  object_id,
unsigned char **  md5toverify,
int  block_count,
int  idx_op 
)

◆ list_index_return()

void list_index_return ( struct workload w)

◆ nz_rand()

static uint64_t nz_rand ( void  )
static

Definition at line 785 of file crate_io.c.

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

Variable Documentation

◆ opcode_operation_map

cr_operation_t opcode_operation_map[]
Initial value:
= {
}
int cr_namei_open(struct m0_workload_io *cwi, struct m0_task_io *cti, struct m0_op_context *op_ctx, struct m0_obj *obj, int free_slot, int obj_idx, int op_index)
Definition: crate_io.c:363
int cr_io_read(struct m0_workload_io *cwi, struct m0_task_io *cti, struct m0_op_context *op_ctx, struct m0_obj *obj, int free_slot, int obj_idx, int op_index)
Definition: crate_io.c:414
int cr_namei_delete(struct m0_workload_io *cwi, struct m0_task_io *cti, struct m0_op_context *op_ctx, struct m0_obj *obj, int free_slot, int obj_idx, int op_index)
Definition: crate_io.c:379
int cr_io_write(struct m0_workload_io *cwi, struct m0_task_io *cti, struct m0_op_context *op_ctx, struct m0_obj *obj, int free_slot, int obj_idx, int op_index)
Definition: crate_io.c:391
int cr_namei_create(struct m0_workload_io *cwi, struct m0_task_io *cti, struct m0_op_context *op_ctx, struct m0_obj *obj, int free_slot, int obj_idx, int op_index)
Definition: crate_io.c:347

Definition at line 437 of file crate_io.c.