Motr  M0
stobio.c File Reference
#include <stdlib.h>
#include "lib/arith.h"
#include "lib/memory.h"
#include "lib/misc.h"
#include "lib/mutex.h"
#include "lib/string.h"
#include "ut/stob.h"
#include "ut/ut.h"
#include "stob/domain.h"
#include "stob/io.h"
#include "stob/stob.h"
Include dependency graph for stobio.c:

Go to the source code of this file.

Data Structures

struct  stobio_test
 

Macros

#define WITH_LOCK(lock, action, args...)
 
#define ST_ID(id)   .st_stob_key = id
 

Enumerations

enum  { RW_BUFF_NR = 10, MIN_BUFF_SIZE = 4096, MIN_BUFF_SIZE_IN_BLOCKS = 4, TEST_NR = 10 }
 
enum  { M0_STOB_UT_DOM_KEY = 0xec0de, M0_STOB_UT_DOM_DIO_KEY = 0xeba5e }
 

Functions

static char * stob_backingfile_get (const struct stobio_test *test)
 
static void stob_dev_init (const struct stobio_test *test)
 
static void stob_dev_fini (const struct stobio_test *test)
 
static void stobio_io_prepare (struct stobio_test *test, struct m0_stob_io *io)
 
static void stobio_write_prepare (struct stobio_test *test, struct m0_stob_io *io)
 
static void stobio_read_prepare (struct stobio_test *test, struct m0_stob_io *io)
 
static void stobio_write (struct stobio_test *test)
 
static void stobio_read (struct stobio_test *test)
 
static void stobio_rw_buffs_init (struct stobio_test *test)
 
static void stobio_rw_buffs_fini (struct stobio_test *test)
 
static int stobio_storage_init (void)
 
static void stobio_storage_fini (void)
 
static int stobio_init (struct stobio_test *test)
 
static void stobio_fini (struct stobio_test *test)
 
static void stobio_rwsegs_prepare (struct stobio_test *test, int starts_from)
 
static void stobio_rwsegs_overlapped_prepare (struct stobio_test *test, int starts_from)
 
static void overlapped_rw_test (struct stobio_test *test, int starts_from)
 
static void test_stobio (void)
 
static void test_short_read (void)
 
static void test_single_ivec ()
 
void m0_stob_ut_stobio_linux (void)
 
void m0_stob_ut_stobio_perf (void)
 

Variables

static const char test_blkdev [] = "/dev/loop0"
 
static const char * test_location
 
static const char * test_location_dio
 
static const char linux_location [] = "linuxstob:./__s"
 
static const char linux_location_dio [] = "linuxstob:./__s_dio"
 
static const char perf_location [] = "perfstob:./__s"
 
static const char perf_location_dio [] = "perfstob:./__s_dio"
 
static struct m0_stob_domaintest_dom
 
static struct m0_stob_domaintest_dom_dio
 
static struct m0_mutex lock
 
static struct m0_thread thread [TEST_NR]
 
static struct stobio_test tests [TEST_NR]
 

Macro Definition Documentation

◆ ST_ID

#define ST_ID (   id)    .st_stob_key = id

Definition at line 100 of file stobio.c.

◆ WITH_LOCK

#define WITH_LOCK (   lock,
  action,
  args... 
)
Value:
({ \
struct m0_mutex *lk = lock; \
m0_mutex_lock(lk); \
action(args); \
m0_mutex_unlock(lk); \
})
static struct m0_mutex lock
Definition: stobio.c:97
Definition: ub.c:49
Definition: mutex.h:47

Definition at line 36 of file stobio.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
RW_BUFF_NR 
MIN_BUFF_SIZE 
MIN_BUFF_SIZE_IN_BLOCKS 
TEST_NR 

Definition at line 43 of file stobio.c.

◆ anonymous enum

anonymous enum
Enumerator
M0_STOB_UT_DOM_KEY 
M0_STOB_UT_DOM_DIO_KEY 

Definition at line 50 of file stobio.c.

Function Documentation

◆ m0_stob_ut_stobio_linux()

void m0_stob_ut_stobio_linux ( void  )

Definition at line 612 of file stobio.c.

Here is the call graph for this function:

◆ m0_stob_ut_stobio_perf()

void m0_stob_ut_stobio_perf ( void  )

Definition at line 624 of file stobio.c.

Here is the call graph for this function:

◆ overlapped_rw_test()

static void overlapped_rw_test ( struct stobio_test test,
int  starts_from 
)
static

Definition at line 406 of file stobio.c.

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

◆ stob_backingfile_get()

static char* stob_backingfile_get ( const struct stobio_test test)
static

Definition at line 119 of file stobio.c.

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

◆ stob_dev_fini()

static void stob_dev_fini ( const struct stobio_test test)
static

Definition at line 171 of file stobio.c.

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

◆ stob_dev_init()

static void stob_dev_init ( const struct stobio_test test)
static

Definition at line 138 of file stobio.c.

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

◆ stobio_fini()

static void stobio_fini ( struct stobio_test test)
static

Definition at line 373 of file stobio.c.

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

◆ stobio_init()

static int stobio_init ( struct stobio_test test)
static

Definition at line 341 of file stobio.c.

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

◆ stobio_io_prepare()

static void stobio_io_prepare ( struct stobio_test test,
struct m0_stob_io io 
)
static

Definition at line 192 of file stobio.c.

Here is the caller graph for this function:

◆ stobio_read()

static void stobio_read ( struct stobio_test test)
static

Definition at line 248 of file stobio.c.

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

◆ stobio_read_prepare()

static void stobio_read_prepare ( struct stobio_test test,
struct m0_stob_io io 
)
static

Definition at line 212 of file stobio.c.

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

◆ stobio_rw_buffs_fini()

static void stobio_rw_buffs_fini ( struct stobio_test test)
static

Definition at line 296 of file stobio.c.

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

◆ stobio_rw_buffs_init()

static void stobio_rw_buffs_init ( struct stobio_test test)
static

Definition at line 275 of file stobio.c.

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

◆ stobio_rwsegs_overlapped_prepare()

static void stobio_rwsegs_overlapped_prepare ( struct stobio_test test,
int  starts_from 
)
static

Definition at line 394 of file stobio.c.

Here is the caller graph for this function:

◆ stobio_rwsegs_prepare()

static void stobio_rwsegs_prepare ( struct stobio_test test,
int  starts_from 
)
static

Definition at line 383 of file stobio.c.

Here is the caller graph for this function:

◆ stobio_storage_fini()

static void stobio_storage_fini ( void  )
static

Definition at line 331 of file stobio.c.

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

◆ stobio_storage_init()

static int stobio_storage_init ( void  )
static

Definition at line 311 of file stobio.c.

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

◆ stobio_write()

static void stobio_write ( struct stobio_test test)
static

Definition at line 220 of file stobio.c.

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

◆ stobio_write_prepare()

static void stobio_write_prepare ( struct stobio_test test,
struct m0_stob_io io 
)
static

Definition at line 204 of file stobio.c.

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

◆ test_short_read()

static void test_short_read ( void  )
static

Definition at line 467 of file stobio.c.

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

◆ test_single_ivec()

static void test_single_ivec ( )
static

Definition at line 509 of file stobio.c.

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

◆ test_stobio()

static void test_stobio ( void  )
static

Definition at line 438 of file stobio.c.

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

Variable Documentation

◆ linux_location

const char linux_location[] = "linuxstob:./__s"
static

Definition at line 89 of file stobio.c.

◆ linux_location_dio

const char linux_location_dio[] = "linuxstob:./__s_dio"
static

Definition at line 90 of file stobio.c.

◆ lock

struct m0_mutex lock
static

Definition at line 97 of file stobio.c.

◆ perf_location

const char perf_location[] = "perfstob:./__s"
static

Definition at line 91 of file stobio.c.

◆ perf_location_dio

const char perf_location_dio[] = "perfstob:./__s_dio"
static

Definition at line 92 of file stobio.c.

◆ test_blkdev

const char test_blkdev[] = "/dev/loop0"
static

Definition at line 85 of file stobio.c.

◆ test_dom

struct m0_stob_domain* test_dom
static

Definition at line 93 of file stobio.c.

◆ test_dom_dio

struct m0_stob_domain* test_dom_dio
static

Definition at line 94 of file stobio.c.

◆ test_location

const char* test_location
static

Definition at line 87 of file stobio.c.

◆ test_location_dio

const char* test_location_dio
static

Definition at line 88 of file stobio.c.

◆ tests

struct stobio_test tests[TEST_NR]
static
Initial value:
= {
[0] = { ST_ID(0x01), .st_directio = false },
[1] = { ST_ID(0x02), .st_directio = false },
[2] = { ST_ID(0x03), .st_directio = false },
[3] = { ST_ID(0x04), .st_directio = false },
[4] = { ST_ID(0x05), .st_directio = false },
[5] = { ST_ID(0x06), .st_directio = true },
[6] = { ST_ID(0x07), .st_directio = true },
[7] = { ST_ID(0x08), .st_directio = true },
[8] = { ST_ID(0x09), .st_directio = true },
[9] = { ST_ID(0x0a), .st_directio = true, .st_dev_path="/dev/loop0" },
}
#define ST_ID(id)
Definition: stobio.c:100

Definition at line 101 of file stobio.c.

◆ thread

struct m0_thread thread[TEST_NR]
static

Definition at line 98 of file stobio.c.