Motr  M0
util.c File Reference
#include <stdio.h>
#include "lib/trace.h"
#include "rpc/rpclib.h"
#include "motr/client_internal.h"
#include "layout/plan.h"
#include "iscservice/isc.h"
#include "util.h"
Include dependency graph for util.c:

Go to the source code of this file.

Macros

#define DEBUG   0
 

Functions

uint64_t isc_m0gs (struct m0_obj *obj, struct m0_client *cinst)
 
void free_segs (struct m0_bufvec *data, struct m0_indexvec *ext, struct m0_bufvec *attr)
 
int alloc_segs (struct m0_bufvec *data, struct m0_indexvec *ext, struct m0_bufvec *attr, uint64_t bsz, uint32_t cnt)
 
uint64_t set_exts (struct m0_indexvec *ext, uint64_t off, uint64_t bsz)
 
int isc_req_prepare (struct isc_req *req, struct m0_buf *args, const struct m0_fid *comp_fid, struct m0_layout_io_plop *iop, uint32_t reply_len)
 
void isc_req_replied (struct m0_rpc_item *item)
 
static void ireqs_list_add_in_order (struct isc_req *req)
 
int isc_req_send (struct isc_req *req)
 
static void fop_fini_lock (struct m0_fop *fop)
 
void isc_req_fini (struct isc_req *req)
 
int isc_init (struct m0_config *conf, struct m0_client **cinst)
 
void isc_fini (struct m0_client *cinst)
 

Variables

static struct m0_container container
 
static struct m0_idx_dix_config dix_conf = {}
 
struct m0_realm uber_realm
 
int trace_level = 0
 
bool m0trace_on = false
 
struct m0_semaphore isc_sem
 
struct m0_list isc_reqs
 
static const struct m0_rpc_item_ops isc_item_ops
 

Macro Definition Documentation

◆ DEBUG

#define DEBUG   0

Definition at line 32 of file util.c.

Function Documentation

◆ alloc_segs()

int alloc_segs ( struct m0_bufvec data,
struct m0_indexvec ext,
struct m0_bufvec attr,
uint64_t  bsz,
uint32_t  cnt 
)

Definition at line 75 of file util.c.

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

◆ fop_fini_lock()

static void fop_fini_lock ( struct m0_fop fop)
static

Definition at line 220 of file util.c.

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

◆ free_segs()

void free_segs ( struct m0_bufvec data,
struct m0_indexvec ext,
struct m0_bufvec attr 
)

Definition at line 67 of file util.c.

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

◆ ireqs_list_add_in_order()

static void ireqs_list_add_in_order ( struct isc_req req)
static

Definition at line 180 of file util.c.

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

◆ isc_fini()

void isc_fini ( struct m0_client cinst)

Definition at line 281 of file util.c.

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

◆ isc_init()

int isc_init ( struct m0_config ,
struct m0_client **   
)

Initialise Motr-related stuff.

Definition at line 247 of file util.c.

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

◆ isc_m0gs()

uint64_t isc_m0gs ( struct m0_obj obj,
struct m0_client cinst 
)

Return parity group size for object.

Definition at line 49 of file util.c.

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

◆ isc_req_fini()

void isc_req_fini ( struct isc_req req)

Finalizes the request, including input and result buffers.

Definition at line 229 of file util.c.

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

◆ isc_req_prepare()

int isc_req_prepare ( struct isc_req ,
struct m0_buf args,
const struct m0_fid comp,
struct m0_layout_io_plop iopl,
uint32_t  reply_len 
)

Prepares a request using provided parameters.

Parameters
[in]argsHolds arguments for the computation.
[in]compThe unique fid associated with the computation.
[in]ioplIO plop associated with the request.
[in]reply_lenExpected length of reply buffer. This is allowed to be greater than the actual length of reply.

Definition at line 108 of file util.c.

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

◆ isc_req_replied()

void isc_req_replied ( struct m0_rpc_item item)

Definition at line 143 of file util.c.

Here is the call graph for this function:

◆ isc_req_send()

int isc_req_send ( struct isc_req req)

Sends a request asynchronously.

The request is added to the isc_reqs list maintaining the order by the object unit offset. On reply receipt, isc_sem(aphore) is up-ped. The received reply is populated at req->cir_result. The error code is returned at req->cir_rc.

Note: the isc_reqs list is unprotected, so all the requests should be sent from the same thread.

Definition at line 198 of file util.c.

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

◆ set_exts()

uint64_t set_exts ( struct m0_indexvec ext,
uint64_t  off,
uint64_t  bsz 
)

Definition at line 95 of file util.c.

Here is the caller graph for this function:

Variable Documentation

◆ container

struct m0_container container
static

Definition at line 36 of file util.c.

◆ dix_conf

struct m0_idx_dix_config dix_conf = {}
static

Definition at line 37 of file util.c.

◆ isc_item_ops

const struct m0_rpc_item_ops isc_item_ops
static
Initial value:
= {
.rio_replied = isc_req_replied,
}
void isc_req_replied(struct m0_rpc_item *item)
Definition: util.c:143

Definition at line 176 of file util.c.

◆ isc_reqs

struct m0_list isc_reqs

Definition at line 44 of file util.c.

◆ isc_sem

struct m0_semaphore isc_sem

Definition at line 43 of file util.c.

◆ m0trace_on

bool m0trace_on = false

Definition at line 42 of file util.c.

◆ trace_level

int trace_level = 0

Definition at line 41 of file util.c.

◆ uber_realm

struct m0_realm uber_realm

Definition at line 40 of file util.c.