Motr  M0
io.c File Reference
#include "lib/finject.h"
#include "layout/layout.h"
#include "lib/trace.h"
#include "lib/uuid.h"
#include "ut/ut.h"
#include "motr/ut/client.h"
#include "motr/io.c"
#include "motr/utils.c"
#include "layout/layout_internal.h"
Include dependency graph for io.c:

Go to the source code of this file.

Macros

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

Functions

static void ut_test_addr_is_network_aligned (void)
 
static void ut_test_page_size (void)
 
static void ut_helper_page_nr (m0_bcount_t size, m0_bcount_t bshift, uint64_t exp_pg)
 
static void ut_test_page_nr (void)
 
static void ut_test_layout_n (void)
 
static void ut_test_layout_k (void)
 
static void ut_helper_page_id (m0_bindex_t offset, m0_bcount_t bshift, uint64_t exp_pg)
 
static void ut_test_page_id (void)
 
static void ut_test_layout_unit_size (void)
 
static void ut_helper_rows_nr (uint64_t size, m0_bcount_t bshift, uint64_t exp_row_nr)
 
static void ut_test_rows_nr (void)
 
static void ut_test_data_size (void)
 
static void ut_test_pdlayout_instance (void)
 
static void ut_test_layout_instance (void)
 
static void ut_test_target_fid (void)
 
static void ut_test_target_offset (void)
 
static void ut_test_group_id (void)
 
static void ut_test_seg_endpos (void)
 
static void ut_test_indexvec_page_nr (void)
 
static void ut_test_iomap_page_nr (void)
 
static void ut_test_parity_units_page_nr (void)
 
static void ut_test_round_down (void)
 
static void ut_test_round_up (void)
 
static void ut_test_pdlayout_get (void)
 
static void ut_test_page_pos_get (void)
 
static void ut_test_io_desc_size (void)
 
static void ut_test_io_seg_size (void)
 
static void ut_enable_resource_manager (struct m0_client *instance)
 
static void ut_disable_resource_manager (struct m0_client *instance)
 
static void ut_test_rm_domain_get (void)
 
static int ut_mock_io_launch_prepare (struct m0_op_io *ioo)
 
static int ut_mock_io_launch_distribute (struct nw_xfer_request *xfer)
 
static void ut_mock_iosm_handle_launch (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static void ut_test_obj_io_cb_launch (void)
 
static void ut_test_obj_io_ast_fini (void)
 
static void ut_test_obj_io_cb_fini (void)
 
static void ut_test_m0_op_io_invariant (void)
 
static void ut_helper_sort_init (struct m0_indexvec *ivec, uint32_t *arr, uint32_t len)
 
static bool ut_helper_sort_is_sorted (struct m0_indexvec *ivec)
 
static void ut_helper_sort (struct m0_indexvec *ivec, uint32_t *arr, uint32_t len)
 
static void ut_test_segments_sort (void)
 
static void ut_test_obj_io_cb_free (void)
 
static void ut_test_m0_obj_op (void)
 
M0_INTERNAL int m0_io_ut_init (void)
 
M0_INTERNAL int m0_io_ut_fini (void)
 

Variables

static struct m0_clientdummy_instance
 
static struct m0_pdclust_layoutdummy_pdclust_layout
 
struct m0_ut_suite ut_suite_io
 
static struct m0_reqh_serviceut_service
 

Macro Definition Documentation

◆ DUMMY_PTR

#define DUMMY_PTR   0xdeafdead

Definition at line 53 of file io.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CLIENT

Definition at line 27 of file io.c.

◆ UT

#define UT

Definition at line 22 of file io.c.

◆ UT_DEFAULT_BLOCK_SIZE

#define UT_DEFAULT_BLOCK_SIZE   (1ULL << M0_DEFAULT_BUF_SHIFT)

Definition at line 55 of file io.c.

Function Documentation

◆ m0_io_ut_fini()

M0_INTERNAL int m0_io_ut_fini ( void  )

Definition at line 780 of file io.c.

Here is the call graph for this function:

◆ m0_io_ut_init()

M0_INTERNAL int m0_io_ut_init ( void  )

Definition at line 758 of file io.c.

Here is the call graph for this function:

◆ ut_disable_resource_manager()

static void ut_disable_resource_manager ( struct m0_client instance)
static

Releases memory allocated by enable().

Definition at line 488 of file io.c.

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

◆ ut_enable_resource_manager()

static void ut_enable_resource_manager ( struct m0_client instance)
static

Enables the access to the resource manager service. This can be considered a workaround, necessary just because client' initialisation lift does not reach levels above the confd setup.

Definition at line 471 of file io.c.

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

◆ ut_helper_page_id()

static void ut_helper_page_id ( m0_bindex_t  offset,
m0_bcount_t  bshift,
uint64_t  exp_pg 
)
static

Definition at line 174 of file io.c.

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

◆ ut_helper_page_nr()

static void ut_helper_page_nr ( m0_bcount_t  size,
m0_bcount_t  bshift,
uint64_t  exp_pg 
)
static

Definition at line 110 of file io.c.

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

◆ ut_helper_rows_nr()

static void ut_helper_rows_nr ( uint64_t  size,
m0_bcount_t  bshift,
uint64_t  exp_row_nr 
)
static

Definition at line 221 of file io.c.

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

◆ ut_helper_sort()

static void ut_helper_sort ( struct m0_indexvec ivec,
uint32_t *  arr,
uint32_t  len 
)
static

Helper function for ut_test_indexvec_sort(). Initialises an indexvec and checks it is correctly sorted by segments_sort().

Parameters
ivecIndex vector that will be sorted.
arrSequence of numbers to fill the vector with before sorting.
lenLength of the array of numbers.

Definition at line 644 of file io.c.

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

◆ ut_helper_sort_init()

static void ut_helper_sort_init ( struct m0_indexvec ivec,
uint32_t *  arr,
uint32_t  len 
)
static

Helper function: Initialises an indexvec with a specific sequence of numbers.

Parameters
ivecVector being initialised.
arrSequence of numbers to initialise the vector with.
lenNumber of numbers in the provided sequence.

Definition at line 607 of file io.c.

Here is the caller graph for this function:

◆ ut_helper_sort_is_sorted()

static bool ut_helper_sort_is_sorted ( struct m0_indexvec ivec)
static

Helper function: Checks if the indices of an indexvec are sorted from lowest to highest.

Parameters
ivecVector being checked.
Returns
true if the indices are sorted or false otherwise.

Definition at line 623 of file io.c.

Here is the caller graph for this function:

◆ ut_mock_io_launch_distribute()

static int ut_mock_io_launch_distribute ( struct nw_xfer_request xfer)
static

Helper callback for ut_test_obj_io_cb_launch().

Definition at line 519 of file io.c.

Here is the caller graph for this function:

◆ ut_mock_io_launch_prepare()

static int ut_mock_io_launch_prepare ( struct m0_op_io ioo)
static

Helper callback for ut_test_obj_io_cb_launch().

Definition at line 510 of file io.c.

Here is the caller graph for this function:

◆ ut_mock_iosm_handle_launch()

static void ut_mock_iosm_handle_launch ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)
static

Definition at line 524 of file io.c.

Here is the caller graph for this function:

◆ ut_test_addr_is_network_aligned()

static void ut_test_addr_is_network_aligned ( void  )
static

Tests addr_is_network_aligned().

Definition at line 60 of file io.c.

Here is the call graph for this function:

◆ ut_test_data_size()

static void ut_test_data_size ( void  )
static

Tests data_size().

Definition at line 258 of file io.c.

Here is the call graph for this function:

◆ ut_test_group_id()

static void ut_test_group_id ( void  )
static

Tests group_id().

Definition at line 327 of file io.c.

Here is the call graph for this function:

◆ ut_test_indexvec_page_nr()

static void ut_test_indexvec_page_nr ( void  )
static

Definition at line 360 of file io.c.

◆ ut_test_io_desc_size()

static void ut_test_io_desc_size ( void  )
static

Tests pre-conditions for io_desc_size().

Definition at line 449 of file io.c.

◆ ut_test_io_seg_size()

static void ut_test_io_seg_size ( void  )
static

Tests io_seg_size().

Definition at line 456 of file io.c.

Here is the call graph for this function:

◆ ut_test_iomap_page_nr()

static void ut_test_iomap_page_nr ( void  )
static

Definition at line 364 of file io.c.

◆ ut_test_layout_instance()

static void ut_test_layout_instance ( void  )
static

Tests layout_instance().

Definition at line 287 of file io.c.

Here is the call graph for this function:

◆ ut_test_layout_k()

static void ut_test_layout_k ( void  )
static

Definition at line 157 of file io.c.

Here is the call graph for this function:

◆ ut_test_layout_n()

static void ut_test_layout_n ( void  )
static

Definition at line 140 of file io.c.

Here is the call graph for this function:

◆ ut_test_layout_unit_size()

static void ut_test_layout_unit_size ( void  )
static

Definition at line 204 of file io.c.

Here is the call graph for this function:

◆ ut_test_m0_obj_op()

static void ut_test_m0_obj_op ( void  )
static

Tests m0_obj_op, covering READ.

Definition at line 697 of file io.c.

Here is the call graph for this function:

◆ ut_test_m0_op_io_invariant()

static void ut_test_m0_op_io_invariant ( void  )
static

Tests m0_op_io_invariant().

Definition at line 583 of file io.c.

Here is the call graph for this function:

◆ ut_test_obj_io_ast_fini()

static void ut_test_obj_io_ast_fini ( void  )
static

Definition at line 572 of file io.c.

◆ ut_test_obj_io_cb_fini()

static void ut_test_obj_io_cb_fini ( void  )
static

Definition at line 576 of file io.c.

◆ ut_test_obj_io_cb_free()

static void ut_test_obj_io_cb_free ( void  )
static

Tests obj_io_cb_free().

Definition at line 684 of file io.c.

Here is the call graph for this function:

◆ ut_test_obj_io_cb_launch()

static void ut_test_obj_io_cb_launch ( void  )
static

Tests obj_io_cb_launch().

Definition at line 533 of file io.c.

Here is the call graph for this function:

◆ ut_test_page_id()

static void ut_test_page_id ( void  )
static

Definition at line 188 of file io.c.

Here is the call graph for this function:

◆ ut_test_page_nr()

static void ut_test_page_nr ( void  )
static

Definition at line 124 of file io.c.

Here is the call graph for this function:

◆ ut_test_page_pos_get()

static void ut_test_page_pos_get ( void  )
static

Tests page_pos_get().

Definition at line 442 of file io.c.

◆ ut_test_page_size()

static void ut_test_page_size ( void  )
static

Definition at line 79 of file io.c.

Here is the call graph for this function:

◆ ut_test_parity_units_page_nr()

static void ut_test_parity_units_page_nr ( void  )
static

Tests parity_units_page_nr().

Definition at line 371 of file io.c.

Here is the call graph for this function:

◆ ut_test_pdlayout_get()

static void ut_test_pdlayout_get ( void  )
static

Tests pdlayout_get().

Definition at line 420 of file io.c.

Here is the call graph for this function:

◆ ut_test_pdlayout_instance()

static void ut_test_pdlayout_instance ( void  )
static

Tests pdlayout_instance().

Definition at line 273 of file io.c.

Here is the call graph for this function:

◆ ut_test_rm_domain_get()

static void ut_test_rm_domain_get ( void  )
static

Tests rm_domain_get().

Definition at line 497 of file io.c.

Here is the call graph for this function:

◆ ut_test_round_down()

static void ut_test_round_down ( void  )
static

Tests round_down().

Definition at line 388 of file io.c.

Here is the call graph for this function:

◆ ut_test_round_up()

static void ut_test_round_up ( void  )
static

Tests round_up().

Definition at line 404 of file io.c.

Here is the call graph for this function:

◆ ut_test_rows_nr()

static void ut_test_rows_nr ( void  )
static

Definition at line 237 of file io.c.

Here is the call graph for this function:

◆ ut_test_seg_endpos()

static void ut_test_seg_endpos ( void  )
static

Tests seg_endpos().

Definition at line 343 of file io.c.

Here is the call graph for this function:

◆ ut_test_segments_sort()

static void ut_test_segments_sort ( void  )
static

Tests segments_sort().

Definition at line 663 of file io.c.

Here is the call graph for this function:

◆ ut_test_target_fid()

static void ut_test_target_fid ( void  )
static

Tests the pre-conditions of target_fid().

Definition at line 302 of file io.c.

◆ ut_test_target_offset()

static void ut_test_target_offset ( void  )
static

Tests target_offset().

Definition at line 309 of file io.c.

Here is the call graph for this function:

Variable Documentation

◆ dummy_instance

struct m0_client* dummy_instance
static

Definition at line 49 of file io.c.

◆ dummy_pdclust_layout

struct m0_pdclust_layout* dummy_pdclust_layout
static

Definition at line 50 of file io.c.

◆ ut_service

struct m0_reqh_service* ut_service
static

Definition at line 465 of file io.c.

◆ ut_suite_io

struct m0_ut_suite ut_suite_io

Definition at line 51 of file io.c.