Motr  M0
io_dummy.c File Reference
#include "layout/layout.h"
#include "lib/trace.h"
#include "ut/ut.h"
#include "motr/ut/client.h"
#include "motr/client_internal.h"
#include "motr/pg.h"
#include "motr/io.h"
#include <stdlib.h>
Include dependency graph for io_dummy.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CLIENT
 
#define DUMMY_PTR   0xdeafdead
 
#define UT_DEFAULT_BLOCK_SHIFT   M0_DEFAULT_BUF_SHIFT
 
#define UT_DEFAULT_BLOCK_SIZE   (1ULL << M0_DEFAULT_BUF_SHIFT)
 

Functions

 M0_BOB_DEFINE (static, &layout_instance_bob, m0_layout_instance)
 
 M0_BOB_DEFINE (static, &pdclust_instance_bob, m0_pdclust_instance)
 
 M0_BOB_DEFINE (static, &pdclust_bob, m0_pdclust_layout)
 
M0_INTERNAL struct m0_objut_dummy_obj_create (void)
 
M0_INTERNAL void ut_dummy_obj_delete (struct m0_obj *obj)
 
M0_INTERNAL struct m0_pdclust_layoutut_dummy_pdclust_layout_create (struct m0_client *instance)
 
M0_INTERNAL void ut_dummy_pdclust_layout_delete (struct m0_pdclust_layout *pl, struct m0_client *instance)
 
M0_INTERNAL struct m0_pdclust_instanceut_dummy_pdclust_instance_create (struct m0_pdclust_layout *pdl)
 
M0_INTERNAL void ut_dummy_pdclust_instance_delete (struct m0_pdclust_instance *pdi)
 
M0_INTERNAL void ut_dummy_xfer_req_init (struct nw_xfer_request *xfer)
 
M0_INTERNAL struct nw_xfer_requestut_dummy_xfer_req_create (void)
 
M0_INTERNAL void ut_dummy_xfer_req_fini (struct nw_xfer_request *xfer)
 
M0_INTERNAL void ut_dummy_xfer_req_delete (struct nw_xfer_request *xfer)
 
M0_INTERNAL struct data_bufut_dummy_data_buf_create (void)
 
M0_INTERNAL void ut_dummy_data_buf_delete (struct data_buf *db)
 
M0_INTERNAL void ut_dummy_data_buf_init (struct data_buf *db)
 
M0_INTERNAL void ut_dummy_data_buf_fini (struct data_buf *db)
 
M0_INTERNAL void ut_dummy_paritybufs_create (struct pargrp_iomap *map, bool do_alloc)
 
M0_INTERNAL void ut_dummy_paritybufs_delete (struct pargrp_iomap *map, bool do_free)
 
M0_INTERNAL struct pargrp_iomaput_dummy_pargrp_iomap_create (struct m0_client *instance, int num_blocks)
 
M0_INTERNAL void ut_dummy_pargrp_iomap_delete (struct pargrp_iomap *map, struct m0_client *instance)
 
M0_INTERNAL struct m0_op_iout_dummy_ioo_create (struct m0_client *instance, int num_io_maps)
 
M0_INTERNAL struct m0_pdclust_layoutut_get_pdclust_layout_from_ioo (struct m0_op_io *ioo)
 
M0_INTERNAL void ut_dummy_ioo_delete (struct m0_op_io *ioo, struct m0_client *instance)
 
void dummy_ioreq_fop_cb (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
M0_INTERNAL struct ioreq_foput_dummy_ioreq_fop_create (void)
 
M0_INTERNAL void ut_dummy_ioreq_fop_delete (struct ioreq_fop *fop)
 
M0_INTERNAL struct target_iorequt_dummy_target_ioreq_create (void)
 
M0_INTERNAL void ut_dummy_target_ioreq_delete (struct target_ioreq *ti)
 
M0_INTERNAL int ut_dummy_poolmach_create (struct m0_pool_version *pv)
 
M0_INTERNAL void ut_dummy_poolmach_delete (struct m0_pool_version *pv)
 
static int mock_pargrp_iomap_parity_recalc (struct pargrp_iomap *map)
 
static int mock_pargrp_iomap_dgmode_process (struct pargrp_iomap *map, struct target_ioreq *tio, m0_bindex_t *index, uint32_t count)
 
static int mock_pargrp_iomap_dgmode_recover (struct pargrp_iomap *map)
 

Variables

static const struct m0_bob_type layout_instance_bob
 
static const struct m0_bob_type pdclust_instance_bob
 
static const struct m0_bob_type pdclust_bob
 
const struct pargrp_iomap_ops mock_iomap_ops
 

Macro Definition Documentation

◆ DUMMY_PTR

#define DUMMY_PTR   0xdeafdead

Definition at line 34 of file io_dummy.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CLIENT

Definition at line 25 of file io_dummy.c.

◆ UT_DEFAULT_BLOCK_SHIFT

#define UT_DEFAULT_BLOCK_SHIFT   M0_DEFAULT_BUF_SHIFT

Definition at line 36 of file io_dummy.c.

◆ UT_DEFAULT_BLOCK_SIZE

#define UT_DEFAULT_BLOCK_SIZE   (1ULL << M0_DEFAULT_BUF_SHIFT)

Definition at line 37 of file io_dummy.c.

Function Documentation

◆ dummy_ioreq_fop_cb()

void dummy_ioreq_fop_cb ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)

Callback for a ioreq_fop. Executed when an rpc reply is received.

Definition at line 508 of file io_dummy.c.

Here is the caller graph for this function:

◆ M0_BOB_DEFINE() [1/3]

M0_BOB_DEFINE ( static  ,
layout_instance_bob,
m0_layout_instance   
)

◆ M0_BOB_DEFINE() [2/3]

M0_BOB_DEFINE ( static  ,
pdclust_instance_bob,
m0_pdclust_instance   
)

◆ M0_BOB_DEFINE() [3/3]

M0_BOB_DEFINE ( static  ,
pdclust_bob,
m0_pdclust_layout   
)

◆ mock_pargrp_iomap_dgmode_process()

static int mock_pargrp_iomap_dgmode_process ( struct pargrp_iomap map,
struct target_ioreq tio,
m0_bindex_t index,
uint32_t  count 
)
static

Definition at line 657 of file io_dummy.c.

◆ mock_pargrp_iomap_dgmode_recover()

static int mock_pargrp_iomap_dgmode_recover ( struct pargrp_iomap map)
static

Definition at line 665 of file io_dummy.c.

◆ mock_pargrp_iomap_parity_recalc()

static int mock_pargrp_iomap_parity_recalc ( struct pargrp_iomap map)
static

Mock operation for Calculating parity.

Parameters
mapThe parity group to calculate the parity for.

Definition at line 652 of file io_dummy.c.

◆ ut_dummy_data_buf_create()

M0_INTERNAL struct data_buf* ut_dummy_data_buf_create ( void  )

Creates a UT dummy data_buf. This allows passing some invariants() forced by the lower layers of Motr.

Definition at line 200 of file io_dummy.c.

Here is the caller graph for this function:

◆ ut_dummy_data_buf_delete()

M0_INTERNAL void ut_dummy_data_buf_delete ( struct data_buf db)

Deletes a UT dummy data_buf. Call this function once for each dummy created.

Definition at line 209 of file io_dummy.c.

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

◆ ut_dummy_data_buf_fini()

M0_INTERNAL void ut_dummy_data_buf_fini ( struct data_buf db)

Finalises a UT dummy data_buf.

Definition at line 232 of file io_dummy.c.

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

◆ ut_dummy_data_buf_init()

M0_INTERNAL void ut_dummy_data_buf_init ( struct data_buf db)

Initialises a UT dummy data_buf.

Definition at line 215 of file io_dummy.c.

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

◆ ut_dummy_ioo_create()

M0_INTERNAL struct m0_op_io* ut_dummy_ioo_create ( struct m0_client instance,
int  num_io_maps 
)

Creates a UT dummy m0_op_io. This allows passing some invariants() forced by the lower layers of Motr.

Definition at line 366 of file io_dummy.c.

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

◆ ut_dummy_ioo_delete()

M0_INTERNAL void ut_dummy_ioo_delete ( struct m0_op_io ioo,
struct m0_client instance 
)

Deletes a UT dummy m0_op_io. Call this function once for each dummy created.

Definition at line 463 of file io_dummy.c.

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

◆ ut_dummy_ioreq_fop_create()

M0_INTERNAL struct ioreq_fop* ut_dummy_ioreq_fop_create ( void  )

Creates a UT dummy ioreq_fop. This allows passing some invariants() forced by the lower layers of Motr.

Definition at line 512 of file io_dummy.c.

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

◆ ut_dummy_ioreq_fop_delete()

M0_INTERNAL void ut_dummy_ioreq_fop_delete ( struct ioreq_fop fop)

Deletes a UT dummy ioreq_fop. Call this function once for each dummy created.

Definition at line 526 of file io_dummy.c.

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

◆ ut_dummy_obj_create()

M0_INTERNAL struct m0_obj* ut_dummy_obj_create ( void  )

Creates a UT dummy m0_obj. This allows passing some invariants() forced by the lower layers of Motr.

Definition at line 64 of file io_dummy.c.

Here is the caller graph for this function:

◆ ut_dummy_obj_delete()

M0_INTERNAL void ut_dummy_obj_delete ( struct m0_obj obj)

Deletes a UT dummy m0_obj. Call this function once for each dummy created.

Definition at line 73 of file io_dummy.c.

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

◆ ut_dummy_pargrp_iomap_create()

M0_INTERNAL struct pargrp_iomap* ut_dummy_pargrp_iomap_create ( struct m0_client instance,
int  num_blocks 
)

Allocate an iomap structure, to be freed by ut_dummy_pargrp_iomap_delete.

Parameters
instanceThe client instance to use.
num_blocksThe number of 4K blocks you will read/write with this map. This value must be <= M0T1FS_LAYOUT_N;
Returns
the allocated structure
Remarks
Need to set the pargrp_iomap's pi_ioo to point to a real ioo if invariant(pargrp_iomap) has to pass.

Definition at line 301 of file io_dummy.c.

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

◆ ut_dummy_pargrp_iomap_delete()

M0_INTERNAL void ut_dummy_pargrp_iomap_delete ( struct pargrp_iomap map,
struct m0_client instance 
)

Deletes a UT dummy pargrp_iomap. Call this function once for each dummy created.

Definition at line 340 of file io_dummy.c.

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

◆ ut_dummy_paritybufs_create()

M0_INTERNAL void ut_dummy_paritybufs_create ( struct pargrp_iomap map,
bool  do_alloc 
)

Definition at line 251 of file io_dummy.c.

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

◆ ut_dummy_paritybufs_delete()

M0_INTERNAL void ut_dummy_paritybufs_delete ( struct pargrp_iomap map,
bool  do_free 
)

Definition at line 281 of file io_dummy.c.

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

◆ ut_dummy_pdclust_instance_create()

M0_INTERNAL struct m0_pdclust_instance* ut_dummy_pdclust_instance_create ( struct m0_pdclust_layout pdl)

Creates a UT dummy m0_pdclust_instance. This allows passing some invariants() forced by the lower layers of Motr.

Definition at line 118 of file io_dummy.c.

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

◆ ut_dummy_pdclust_instance_delete()

M0_INTERNAL void ut_dummy_pdclust_instance_delete ( struct m0_pdclust_instance pdi)

Deletes a UT dummy m0_pdclust_instance. Call this function once for each dummy created.

Definition at line 158 of file io_dummy.c.

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

◆ ut_dummy_pdclust_layout_create()

M0_INTERNAL struct m0_pdclust_layout* ut_dummy_pdclust_layout_create ( struct m0_client instance)

Creates a UT dummy m0_pdclust_layout. This allows passing some invariants() forced by the lower layers of Motr.

Definition at line 79 of file io_dummy.c.

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

◆ ut_dummy_pdclust_layout_delete()

M0_INTERNAL void ut_dummy_pdclust_layout_delete ( struct m0_pdclust_layout pl,
struct m0_client instance 
)

Deletes a UT dummy pdclust_layout. Call this function once for each dummy created.

Definition at line 108 of file io_dummy.c.

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

◆ ut_dummy_poolmach_create()

M0_INTERNAL int ut_dummy_poolmach_create ( struct m0_pool_version pv)

Creates a UT dummy pool machine.

Definition at line 563 of file io_dummy.c.

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

◆ ut_dummy_poolmach_delete()

M0_INTERNAL void ut_dummy_poolmach_delete ( struct m0_pool_version pv)

Deletes a UT dummy pool machine.

Definition at line 628 of file io_dummy.c.

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

◆ ut_dummy_target_ioreq_create()

M0_INTERNAL struct target_ioreq* ut_dummy_target_ioreq_create ( void  )

Creates a UT dummy target_ioreq. This allows passing some invariants() forced by the lower layers of Motr.

Definition at line 532 of file io_dummy.c.

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

◆ ut_dummy_target_ioreq_delete()

M0_INTERNAL void ut_dummy_target_ioreq_delete ( struct target_ioreq ti)

Deletes a UT dummy target_ioreq. Call this function once for each dummy created.

Definition at line 552 of file io_dummy.c.

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

◆ ut_dummy_xfer_req_create()

M0_INTERNAL struct nw_xfer_request* ut_dummy_xfer_req_create ( void  )

Creates a UT dummy nw_xfer_request. This allows passing some invariants() forced by the lower layers of Motr.

Definition at line 178 of file io_dummy.c.

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

◆ ut_dummy_xfer_req_delete()

M0_INTERNAL void ut_dummy_xfer_req_delete ( struct nw_xfer_request xfer)

Deletes a UT dummy nw_xfer_request. Call this function once for each dummy created.

Definition at line 193 of file io_dummy.c.

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

◆ ut_dummy_xfer_req_fini()

M0_INTERNAL void ut_dummy_xfer_req_fini ( struct nw_xfer_request xfer)

Finalises a UT dummy nw_xfer_request.

Definition at line 187 of file io_dummy.c.

Here is the caller graph for this function:

◆ ut_dummy_xfer_req_init()

M0_INTERNAL void ut_dummy_xfer_req_init ( struct nw_xfer_request xfer)

Initialises a UT dummy nw_xfer_request.

Definition at line 171 of file io_dummy.c.

Here is the caller graph for this function:

◆ ut_get_pdclust_layout_from_ioo()

M0_INTERNAL struct m0_pdclust_layout* ut_get_pdclust_layout_from_ioo ( struct m0_op_io ioo)

Returns the pdclust_layout of an ioo.

Definition at line 456 of file io_dummy.c.

Here is the caller graph for this function:

Variable Documentation

◆ 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 39 of file io_dummy.c.

◆ mock_iomap_ops

const struct pargrp_iomap_ops mock_iomap_ops
Initial value:
= {
.pi_parity_recalc = mock_pargrp_iomap_parity_recalc,
.pi_dgmode_process = mock_pargrp_iomap_dgmode_process,
.pi_dgmode_recover = mock_pargrp_iomap_dgmode_recover,
}
static int mock_pargrp_iomap_parity_recalc(struct pargrp_iomap *map)
Definition: io_dummy.c:652
static int mock_pargrp_iomap_dgmode_process(struct pargrp_iomap *map, struct target_ioreq *tio, m0_bindex_t *index, uint32_t count)
Definition: io_dummy.c:657
static int mock_pargrp_iomap_dgmode_recover(struct pargrp_iomap *map)
Definition: io_dummy.c:665

Definition at line 670 of file io_dummy.c.

◆ pdclust_bob

const struct m0_bob_type pdclust_bob
static
Initial value:
= {
.bt_name = "pdclust",
.bt_magix_offset = offsetof(struct m0_pdclust_layout , pl_magic),
.bt_check = NULL
}
#define NULL
Definition: misc.h:38
#define offsetof(typ, memb)
Definition: misc.h:29

Definition at line 56 of file io_dummy.c.

◆ pdclust_instance_bob

const struct m0_bob_type pdclust_instance_bob
static
Initial value:
= {
.bt_name = "pd_instance",
.bt_magix_offset = offsetof(struct m0_pdclust_instance, pi_magic),
.bt_check = NULL
}
#define NULL
Definition: misc.h:38
#define offsetof(typ, memb)
Definition: misc.h:29

Definition at line 47 of file io_dummy.c.