Motr  M0
storage.c File Reference
#include "lib/trace.h"
#include "lib/memory.h"
#include "lib/misc.h"
#include "lib/semaphore.h"
#include "ut/ut.h"
#include "stob/stob.h"
#include "stob/domain.h"
#include "addb2/addb2.h"
#include "addb2/storage.h"
#include "addb2/internal.h"
#include "addb2/consumer.h"
#include "addb2/identifier.h"
#include "addb2/ut/common.h"
Include dependency graph for storage.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT
 
#define PAYLOAD(seq)
 

Enumerations

enum  { DOMAIN_KEY = 76, STOB_KEY = 2, SIZE = 4 * 1024 * 1024 * 1024ull }
 
enum  { DEPTH_MAX = M0_ADDB2_LABEL_MAX }
 
enum  { NR = 500 * DEPTH_MAX }
 
enum  { THREADS = 8, OUTER = 50, INNER = 100 }
 

Functions

static void stob_get (void)
 
static void stob_put (void)
 
static void once_idle (struct m0_addb2_storage *_stor)
 
static void test_idle (struct m0_addb2_storage *stor)
 
static void write_init_fini (void)
 
static void test_done (struct m0_addb2_storage *_stor, struct m0_addb2_trace_obj *obj)
 
static void test_commit (struct m0_addb2_storage *_stor, const struct m0_addb2_frame_header *_last)
 
static void mach_idle (const struct m0_addb2_mach *mach)
 
static int test_submit (const struct m0_addb2_mach *m, struct m0_addb2_trace *t)
 
static void stor_init (void)
 
static void stor_fini (void)
 
static void submit_one (void)
 
static void write_many (void)
 
static void read_one (void)
 
static void add_one (void)
 
static void check_one (const struct m0_addb2_record *rec)
 
static void read_many (void)
 
static void frame_fill (void)
 
static void context_clean (void)
 
static void wrap (int n)
 
static void wrap1 (void)
 
static void wrap2 (void)
 
static void wrap3 (void)
 
static void wrap7 (void)
 
static void io_thread (int x)
 
static void io_idle (struct m0_addb2_storage *stor)
 
static void io_done (struct m0_addb2_storage *stor, struct m0_addb2_trace_obj *obj)
 
static void fini_io (void)
 

Variables

static struct m0_stob_domaindom
 
static struct m0_stobstob
 
static struct m0_addb2_sitsit
 
static struct m0_addb2_storagestor
 
static struct m0_addb2_machmach
 
const char * location = "linuxstob:./__s"
 
static bool idled
 
static struct m0_semaphore idlewait
 
static unsigned done
 
static unsigned committed
 
static struct m0_addb2_frame_header last
 
static const struct m0_addb2_storage_ops test_ops
 
static struct m0_semaphore machwait
 
static unsigned traces_submitted
 
static m0_bcount_t stob_size = SIZE
 
static unsigned issued
 
static unsigned checked
 
static struct m0_semaphore pump_start
 
static struct m0_semaphore pump_done
 
static bool pump_exit
 
struct m0_ut_suite addb2_storage_ut
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT

Definition at line 22 of file storage.c.

◆ PAYLOAD

#define PAYLOAD (   seq)
Value:
{ \
seq ^ 0xdead, \
seq << 6, \
74, \
8 - seq, \
0x473824622, \
1 + seq, \
2 - seq, \
3 + seq, \
4 - seq, \
5 + seq, \
6 - seq, \
7 + seq, \
8 - seq \
}
uint64_t seq
Definition: common.c:97

Definition at line 264 of file storage.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DOMAIN_KEY 
STOB_KEY 
SIZE 

Definition at line 44 of file storage.c.

◆ anonymous enum

anonymous enum
Enumerator
DEPTH_MAX 

Definition at line 280 of file storage.c.

◆ anonymous enum

anonymous enum
Enumerator
NR 

Definition at line 317 of file storage.c.

◆ anonymous enum

anonymous enum
Enumerator
THREADS 
OUTER 
INNER 

Definition at line 444 of file storage.c.

Function Documentation

◆ add_one()

static void add_one ( void  )
static

Definition at line 282 of file storage.c.

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

◆ check_one()

static void check_one ( const struct m0_addb2_record rec)
static

Definition at line 300 of file storage.c.

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

◆ context_clean()

static void context_clean ( void  )
static

Definition at line 367 of file storage.c.

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

◆ fini_io()

static void fini_io ( void  )
static

"fini-io" test: test storage finalisation concurrent with IO.

Definition at line 483 of file storage.c.

Here is the call graph for this function:

◆ frame_fill()

static void frame_fill ( void  )
static

Definition at line 354 of file storage.c.

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

◆ io_done()

static void io_done ( struct m0_addb2_storage stor,
struct m0_addb2_trace_obj obj 
)
static

Definition at line 475 of file storage.c.

Here is the caller graph for this function:

◆ io_idle()

static void io_idle ( struct m0_addb2_storage stor)
static

Definition at line 470 of file storage.c.

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

◆ io_thread()

static void io_thread ( int  x)
static

Definition at line 450 of file storage.c.

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

◆ mach_idle()

static void mach_idle ( const struct m0_addb2_mach mach)
static

Definition at line 153 of file storage.c.

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

◆ once_idle()

static void once_idle ( struct m0_addb2_storage _stor)
static

Definition at line 83 of file storage.c.

Here is the caller graph for this function:

◆ read_many()

static void read_many ( void  )
static

"read-one" test: create storage machine, add a number of records; check that storage iterator returns all of them.

Definition at line 323 of file storage.c.

Here is the call graph for this function:

◆ read_one()

static void read_one ( void  )
static

"read-one" test: create storage machine, add one record; check that storage iterator returns the record.

Definition at line 223 of file storage.c.

Here is the call graph for this function:

◆ stob_get()

static void stob_get ( void  )
static

Definition at line 52 of file storage.c.

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

◆ stob_put()

static void stob_put ( void  )
static

Definition at line 69 of file storage.c.

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

◆ stor_fini()

static void stor_fini ( void  )
static

Definition at line 187 of file storage.c.

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

◆ stor_init()

static void stor_init ( void  )
static

Definition at line 171 of file storage.c.

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

◆ submit_one()

static void submit_one ( void  )
static

Definition at line 202 of file storage.c.

Here is the call graph for this function:

◆ test_commit()

static void test_commit ( struct m0_addb2_storage _stor,
const struct m0_addb2_frame_header _last 
)
static

Definition at line 137 of file storage.c.

◆ test_done()

static void test_done ( struct m0_addb2_storage _stor,
struct m0_addb2_trace_obj obj 
)
static

Definition at line 130 of file storage.c.

◆ test_idle()

static void test_idle ( struct m0_addb2_storage stor)
static

Definition at line 95 of file storage.c.

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

◆ test_submit()

static int test_submit ( const struct m0_addb2_mach m,
struct m0_addb2_trace t 
)
static

Definition at line 160 of file storage.c.

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

◆ wrap()

static void wrap ( int  n)
static

Force storage stob wrap-around "n" times.

Definition at line 377 of file storage.c.

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

◆ wrap1()

static void wrap1 ( void  )
static

"wrap-1" test: wrap stob once.

Definition at line 415 of file storage.c.

Here is the call graph for this function:

◆ wrap2()

static void wrap2 ( void  )
static

"wrap-2" test: wrap stob twice.

Definition at line 423 of file storage.c.

Here is the call graph for this function:

◆ wrap3()

static void wrap3 ( void  )
static

"wrap-3" test: wrap stob thrice.

Definition at line 431 of file storage.c.

Here is the call graph for this function:

◆ wrap7()

static void wrap7 ( void  )
static

"wrap-7" test: wrap stob 7 times.

Definition at line 439 of file storage.c.

Here is the call graph for this function:

◆ write_init_fini()

static void write_init_fini ( void  )
static

"write-init-fini" test: create storage machine, stop it and finalise.

Definition at line 104 of file storage.c.

Here is the call graph for this function:

◆ write_many()

static void write_many ( void  )
static

Definition at line 209 of file storage.c.

Here is the call graph for this function:

Variable Documentation

◆ addb2_storage_ut

struct m0_ut_suite addb2_storage_ut
Initial value:
= {
.ts_name = "addb2-storage",
.ts_init = NULL,
.ts_fini = NULL,
.ts_tests = {
{ "write-init-fini", &write_init_fini },
{ "submit-one", &submit_one },
{ "read-one", &read_one },
{ "read-many", &read_many },
{ "write-many", &write_many},
{ "wrap-1", &wrap1 },
{ "wrap-2", &wrap2 },
{ "wrap-3", &wrap3 },
{ "wrap-7", &wrap7 },
{ "fini-io", &fini_io },
{ NULL, NULL }
}
}
#define NULL
Definition: misc.h:38
static void wrap3(void)
Definition: storage.c:431
static void wrap2(void)
Definition: storage.c:423
static void read_many(void)
Definition: storage.c:323
static void fini_io(void)
Definition: storage.c:483
static void submit_one(void)
Definition: storage.c:202
static void read_one(void)
Definition: storage.c:223
static void write_init_fini(void)
Definition: storage.c:104
static void write_many(void)
Definition: storage.c:209
static void wrap1(void)
Definition: storage.c:415
static void wrap7(void)
Definition: storage.c:439

Definition at line 526 of file storage.c.

◆ checked

unsigned checked
static

Definition at line 298 of file storage.c.

◆ committed

unsigned committed
static

Definition at line 92 of file storage.c.

◆ dom

struct m0_stob_domain* dom
static

Definition at line 38 of file storage.c.

◆ done

unsigned done
static

Definition at line 91 of file storage.c.

◆ idled

bool idled
static

Definition at line 81 of file storage.c.

◆ idlewait

struct m0_semaphore idlewait
static

Definition at line 90 of file storage.c.

◆ issued

unsigned issued
static

Definition at line 262 of file storage.c.

◆ last

struct m0_addb2_frame_header last
static

Definition at line 93 of file storage.c.

◆ location

const char* location = "linuxstob:./__s"

Definition at line 50 of file storage.c.

◆ mach

struct m0_addb2_mach* mach
static

Definition at line 42 of file storage.c.

◆ machwait

struct m0_semaphore machwait
static

Definition at line 151 of file storage.c.

◆ pump_done

struct m0_semaphore pump_done
static

Definition at line 447 of file storage.c.

◆ pump_exit

bool pump_exit
static

Definition at line 448 of file storage.c.

◆ pump_start

struct m0_semaphore pump_start
static

Definition at line 446 of file storage.c.

◆ sit

struct m0_addb2_sit* sit
static

Definition at line 40 of file storage.c.

◆ stob

struct m0_stob* stob
static

Definition at line 39 of file storage.c.

◆ stob_size

m0_bcount_t stob_size = SIZE
static

Definition at line 169 of file storage.c.

◆ stor

struct m0_addb2_storage* stor
static

Definition at line 41 of file storage.c.

◆ test_ops

const struct m0_addb2_storage_ops test_ops
static
Initial value:
= {
.sto_idle = &test_idle,
.sto_done = &test_done,
.sto_commit = &test_commit
}
static void test_idle(struct m0_addb2_storage *stor)
Definition: storage.c:95
static void test_commit(struct m0_addb2_storage *_stor, const struct m0_addb2_frame_header *_last)
Definition: storage.c:137
static void test_done(struct m0_addb2_storage *_stor, struct m0_addb2_trace_obj *obj)
Definition: storage.c:130

Definition at line 145 of file storage.c.

◆ traces_submitted

unsigned traces_submitted
static

Definition at line 158 of file storage.c.