36 #define WITH_LOCK(lock, action, args...) ({ \ 37 struct m0_mutex *lk = lock; \ 40 m0_mutex_unlock(lk); \ 100 #define ST_ID(id) .st_stob_key = id 103 [0] = {
ST_ID(0x01), .st_directio =
false },
104 [1] = {
ST_ID(0x02), .st_directio =
false },
105 [2] = {
ST_ID(0x03), .st_directio =
false },
106 [3] = {
ST_ID(0x04), .st_directio =
false },
107 [4] = {
ST_ID(0x05), .st_directio =
false },
110 [5] = {
ST_ID(0x06), .st_directio =
true },
111 [6] = {
ST_ID(0x07), .st_directio =
true },
112 [7] = {
ST_ID(0x08), .st_directio =
true },
113 [8] = {
ST_ID(0x09), .st_directio =
true },
114 [9] = {
ST_ID(0x0a), .st_directio =
true, .st_dev_path=
"/dev/loop0" },
121 char backingfile[PATH_MAX];
127 test->st_dom->sd_location_data,
142 char sysbuf[PATH_MAX];
153 dev_sz = dev_sz/1024 + 1;
156 sprintf(sysbuf,
"dd if=/dev/zero of=%s bs=1M count=%lu >/dev/null 2>&1",
157 backingfile, (
unsigned long)dev_sz);
158 result = system(sysbuf);
161 sprintf(sysbuf,
"losetup -d %s >/dev/null 2>&1",
test->st_dev_path);
162 result = system(sysbuf);
164 sprintf(sysbuf,
"losetup %s %s",
test->st_dev_path, backingfile);
165 result = system(sysbuf);
174 char sysbuf[PATH_MAX];
181 sprintf(sysbuf,
"losetup -d %s",
test->st_dev_path);
182 result = system(sysbuf);
185 result = sprintf(sysbuf,
"rm -f %s", backingfile);
187 result = system(sysbuf);
281 test->st_block_shift);
283 ,
test->st_block_shift);
289 test->st_block_shift);
291 test->st_block_shift);
302 test->st_rdbuf_packed[
i] = 0;
307 test->st_wrbuf_packed[
i] = 0;
361 test->st_block_size = 1 <<
test->st_block_shift;
366 test->st_rw_buf_size_in_blocks =
test->st_rw_buf_size /
test->st_block_size;
387 test->st_wrvec[
i] =
test->st_rw_buf_size_in_blocks;
388 test->st_rdvec[
i] =
test->st_rw_buf_size_in_blocks
389 * (2 *
i + 1 + starts_from);
390 memset(
test->st_wrbuf[
i], (
'a' +
i) | 1,
test->st_rw_buf_size);
399 test->st_wrvec[
i] =
test->st_rw_buf_size_in_blocks;
400 test->st_rdvec[
i] =
test->st_rw_buf_size_in_blocks
401 * (
i + 1 + starts_from);
402 memset(
test->st_wrbuf[
i], (
'A' +
i) | 1,
test->st_rw_buf_size);
426 for (j = 0; j <
test->st_rw_buf_size; ++j)
431 for (j = 0; j <
test->st_rw_buf_size; ++j)
453 "overlap_test%d",
i);
491 for (j = 0; j <
test->st_rw_buf_size -
test->st_block_size; ++j)
493 for (; j <
test->st_rw_buf_size; ++j)
519 OFFSET_OR_SIZE = 1048576,
522 char *st_rdbuf[VEC_NR];
523 char *st_rdbuf_packed[VEC_NR];
524 char *st_wrbuf[VEC_NR];
525 char *st_wrbuf_packed[VEC_NR];
540 for (
i = 0;
i < VEC_NR; ++
i) {
599 for (
i = 0;
i < VEC_NR; ++
i)
606 for (
i = 0;
i < VEC_NR; ++
i) {
M0_INTERNAL void m0_chan_wait(struct m0_clink *link)
static void stobio_rwsegs_overlapped_prepare(struct stobio_test *test, int starts_from)
enum m0_stob_io_flags si_flags
char * st_rdbuf_packed[RW_BUFF_NR]
M0_INTERNAL void m0_stob_io_fini(struct m0_stob_io *io)
struct m0_stob_domain * st_dom
M0_INTERNAL void m0_clink_init(struct m0_clink *link, m0_chan_cb_t cb)
M0_INTERNAL int m0_stob_locate(struct m0_stob *stob)
M0_INTERNAL void m0_clink_del_lock(struct m0_clink *link)
int m0_thread_join(struct m0_thread *q)
static void stobio_read(struct stobio_test *test)
static void stobio_rw_buffs_init(struct stobio_test *test)
static const char perf_location_dio[]
M0_INTERNAL const struct m0_fid * m0_stob_domain_id_get(const struct m0_stob_domain *dom)
M0_INTERNAL int m0_stob_domain_destroy(struct m0_stob_domain *dom)
static m0_bcount_t stob_size
static struct m0_mutex lock
static void stob_dev_init(const struct stobio_test *test)
static void test_single_ivec()
#define M0_THREAD_INIT(thread, TYPE, init, func, arg, namefmt,...)
static void stobio_io_prepare(struct stobio_test *test, struct m0_stob_io *io)
static void stobio_rw_buffs_fini(struct stobio_test *test)
static const char * test_location
static int stobio_storage_init(void)
M0_INTERNAL uint32_t m0_stob_block_shift(struct m0_stob *stob)
#define WITH_LOCK(lock, action, args...)
char * st_wrbuf[RW_BUFF_NR]
M0_INTERNAL int m0_stob_domain_create(const char *location, const char *str_cfg_init, uint64_t dom_key, const char *str_cfg_create, struct m0_stob_domain **out)
M0_INTERNAL void m0_fid_set(struct m0_fid *fid, uint64_t container, uint64_t key)
static struct stobio_test tests[TEST_NR]
static void stobio_storage_fini(void)
static int stobio_init(struct stobio_test *test)
static void stobio_rwsegs_prepare(struct stobio_test *test, int starts_from)
M0_INTERNAL int m0_stob_io_prepare_and_launch(struct m0_stob_io *io, struct m0_stob *obj, struct m0_dtx *tx, struct m0_io_scope *scope)
struct m0_indexvec si_stob
static const char * test_location_dio
static void stobio_write(struct stobio_test *test)
char * st_rdbuf[RW_BUFF_NR]
void m0_thread_fini(struct m0_thread *q)
static void stobio_fini(struct stobio_test *test)
M0_INTERNAL void m0_stob_id_make(uint64_t container, uint64_t key, const struct m0_fid *dom_id, struct m0_stob_id *stob_id)
M0_INTERNAL void * m0_stob_addr_pack(const void *buf, uint32_t shift)
static void test_stobio(void)
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
static char * stob_backingfile_get(const struct stobio_test *test)
static struct m0_stob_domain * test_dom
static struct m0_thread thread[TEST_NR]
static struct m0_clink clink[RDWR_REQUEST_MAX]
static struct m0_stob_io io
void m0_clink_add_lock(struct m0_chan *chan, struct m0_clink *link)
M0_INTERNAL int m0_stob_destroy(struct m0_stob *stob, struct m0_dtx *dtx)
char * st_wrbuf_packed[RW_BUFF_NR]
static void stobio_write_prepare(struct stobio_test *test, struct m0_stob_io *io)
static const char test_blkdev[]
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
M0_INTERNAL void m0_clink_fini(struct m0_clink *link)
void m0_stob_ut_stobio_linux(void)
size_t st_rw_buf_size_in_blocks
M0_INTERNAL void m0_stob_io_init(struct m0_stob_io *io)
M0_INTERNAL int m0_stob_find(const struct m0_stob_id *id, struct m0_stob **out)
static void test_short_read(void)
static const char linux_location[]
m0_bcount_t st_wrvec[RW_BUFF_NR]
static void stob_dev_fini(const struct stobio_test *test)
static const char perf_location[]
M0_INTERNAL int m0_ut_stob_create(struct m0_stob *stob, const char *str_cfg, struct m0_be_domain *be_dom)
static void stobio_read_prepare(struct stobio_test *test, struct m0_stob_io *io)
static void overlapped_rw_test(struct stobio_test *test, int starts_from)
M0_INTERNAL void * m0_alloc_aligned(size_t size, unsigned shift)
void m0_stob_ut_stobio_perf(void)
static struct m0_stob_domain * test_dom_dio
static const char linux_location_dio[]
enum m0_stob_io_opcode si_opcode
m0_bcount_t st_rdvec[RW_BUFF_NR]