Motr  M0
btree.c File Reference
#include "lib/trace.h"
#include "be/tx_group_fom.h"
#include "be/btree.h"
#include "lib/types.h"
#include "lib/misc.h"
#include "lib/memory.h"
#include "lib/errno.h"
#include "be/ut/helper.h"
#include "ut/ut.h"
#include <stdio.h>
Include dependency graph for btree.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT
 

Enumerations

enum  { INSERT_COUNT = BTREE_FAN_OUT * 20, INSERT_KSIZE = 7, INSERT_VSIZE = 11, TXN_OPS_NR = 7 }
 

Functions

void btree_dbg_print (struct m0_be_btree *tree)
 
static int tree_cmp (const void *key0, const void *key1)
 
static m0_bcount_t tree_kv_size (const void *kv)
 
static void check (struct m0_be_btree *tree)
 
static struct m0_be_btreecreate_tree (void)
 
static void destroy_tree (struct m0_be_btree *tree)
 
static void truncate_tree (struct m0_be_btree *tree)
 
void m0_be_ut_btree_create_truncate (void)
 
void m0_be_ut_btree_create_destroy (void)
 
static int btree_insert (struct m0_be_btree *t, struct m0_buf *k, struct m0_buf *v, int nr_left)
 
static int btree_insert_inplace (struct m0_be_btree *t, struct m0_buf *k, int v, int nr_left)
 
static int btree_delete (struct m0_be_btree *t, struct m0_buf *k, int nr_left)
 
static void shuffle_array (int a[], size_t n)
 
static void btree_delete_test (struct m0_be_btree *tree, struct m0_be_tx *tx)
 
static int btree_save (struct m0_be_btree *tree, struct m0_buf *k, struct m0_buf *v, bool overwrite)
 
static void btree_save_test (struct m0_be_btree *tree)
 
static void cursor_test (struct m0_be_btree *tree)
 

Variables

static struct m0_be_ut_backendut_be
 
static struct m0_be_ut_segut_seg
 
static struct m0_be_segseg
 
static const struct m0_be_btree_kv_ops kv_ops
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT

Definition at line 23 of file btree.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
INSERT_COUNT 
INSERT_KSIZE 
INSERT_VSIZE 
TXN_OPS_NR 

Definition at line 61 of file btree.c.

Function Documentation

◆ btree_delete()

static int btree_delete ( struct m0_be_btree t,
struct m0_buf k,
int  nr_left 
)
static

Definition at line 230 of file btree.c.

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

◆ btree_delete_test()

static void btree_delete_test ( struct m0_be_btree tree,
struct m0_be_tx tx 
)
static

Definition at line 278 of file btree.c.

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

◆ btree_insert()

static int btree_insert ( struct m0_be_btree t,
struct m0_buf k,
struct m0_buf v,
int  nr_left 
)
static

Definition at line 142 of file btree.c.

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

◆ btree_insert_inplace()

static int btree_insert_inplace ( struct m0_be_btree t,
struct m0_buf k,
int  v,
int  nr_left 
)
static

Definition at line 180 of file btree.c.

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

◆ btree_save()

static int btree_save ( struct m0_be_btree tree,
struct m0_buf k,
struct m0_buf v,
bool  overwrite 
)
static

Definition at line 386 of file btree.c.

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

◆ btree_save_test()

static void btree_save_test ( struct m0_be_btree tree)
static

Definition at line 414 of file btree.c.

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

◆ check()

static void check ( struct m0_be_btree tree)
static

Definition at line 783 of file btree.c.

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

◆ create_tree()

static struct m0_be_btree * create_tree ( void  )
static

Definition at line 473 of file btree.c.

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

◆ cursor_test()

static void cursor_test ( struct m0_be_btree tree)
static

Definition at line 690 of file btree.c.

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

◆ destroy_tree()

static void destroy_tree ( struct m0_be_btree tree)
static

Definition at line 646 of file btree.c.

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

◆ m0_be_ut_btree_create_destroy()

void m0_be_ut_btree_create_destroy ( void  )

Definition at line 109 of file btree.c.

Here is the call graph for this function:

◆ m0_be_ut_btree_create_truncate()

void m0_be_ut_btree_create_truncate ( void  )

Definition at line 76 of file btree.c.

Here is the call graph for this function:

◆ shuffle_array()

static void shuffle_array ( int  a[],
size_t  n 
)
static

Definition at line 266 of file btree.c.

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

◆ tree_cmp()

static int tree_cmp ( const void *  key0,
const void *  key1 
)
static

Definition at line 44 of file btree.c.

◆ tree_kv_size()

static m0_bcount_t tree_kv_size ( const void *  kv)
static

Definition at line 49 of file btree.c.

◆ truncate_tree()

static void truncate_tree ( struct m0_be_btree tree)
static

Definition at line 605 of file btree.c.

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

Variable Documentation

◆ kv_ops

const struct m0_be_btree_kv_ops kv_ops
static
Initial value:
= {
.ko_type = M0_BBT_UT_KV_OPS,
.ko_ksize = tree_kv_size,
.ko_vsize = tree_kv_size,
.ko_compare = tree_cmp
}
static m0_bcount_t tree_kv_size(const void *kv)
Definition: btree.c:49
static int tree_cmp(const void *key0, const void *key1)
Definition: btree.c:44

Definition at line 54 of file btree.c.

◆ seg

struct m0_be_seg* seg
static

Definition at line 40 of file btree.c.

◆ ut_be

struct m0_be_ut_backend* ut_be
static

Definition at line 38 of file btree.c.

◆ ut_seg

struct m0_be_ut_seg* ut_seg
static

Definition at line 39 of file btree.c.