62 .lsc_stob_domain_init_cfg =
"directio=true",
63 .lsc_stob_domain_key = 0x1000,
64 .lsc_stob_domain_create_cfg =
NULL,
67 .lsc_stob_create_cfg =
NULL,
134 int lio_nr =
ctx->bult_lio_nr;
145 for (
i = 0;
i < lio_nr; ++
i)
153 for (
i = 0;
i < lio_nr; ++
i) {
164 if (
ctx->bult_discard)
202 for (
i = 0;
i < thread_nr; ++
i) {
209 .bult_discard = discard,
210 .bult_lio_nr = lio_nr,
211 .bult_lio_size = lio_size,
212 .bult_reserve_size = reserve_size * lio_nr,
218 c =
c < 10 ?
c +
'0' :
219 c < 36 ?
c - 10 +
'a' :
221 memset(ctxs[
i].bult_data,
c, lio_size);
225 for (j = 0; j < lio_nr; ++j) {
242 for (
i = 0;
i < thread_nr; ++
i) {
261 for (
i = 0;
i < lio_nr; ++
i) {
267 for (
i = 0;
i < thread_nr; ++
i) {
282 for (j = 0; j < lio_nr; ++j) {
300 for (
i = 0;
i < thread_nr; ++
i) {
408 M0_PRE(new_nr <= header_nr);
409 M0_PRE(valid_index < header_nr);
413 for (
i = 0;
i < header_nr; ++
i) {
416 rc = m0_be_fmt_log_header_init(hdrs[
i],
NULL);
423 rc = m0_be_fmt_log_header_init(&valid,
NULL);
430 for (
i = 0;
i < header_nr; ++
i) {
431 m0_be_fmt_log_header_fini(hdrs[
i]);
435 m0_be_fmt_log_header_fini(&valid);
505 memset(records, 0,
sizeof(records));
506 memset(
ops, 0,
sizeof(
ops));
507 for (
i = 0;
i < 4; ++
i) {
530 memset(records, 0,
sizeof(records));
531 memset(
ops, 0,
sizeof(
ops));
532 for (
i = 0;
i < 3; ++
i) {
556 memset(records, 0,
sizeof(records));
557 memset(
ops, 0,
sizeof(
ops));
558 for (
i = 0;
i < 3; ++
i) {
596 header.flh_group_size == 0);
632 m0_be_fmt_log_header_fini(&
header);
M0_INTERNAL void m0_be_log_record_io_size_set(struct m0_be_log_record *record, int index, m0_bcount_t size)
static struct m0_mutex lock
M0_INTERNAL struct m0_bufvec * m0_be_log_record_io_bufvec(struct m0_be_log_record *record, int index)
static void be_ut_log_record_init_write_one(struct m0_be_log_record *record, struct m0_be_log *log, struct m0_mutex *lock, struct m0_be_op *op)
#define M0_ALLOC_ARR(arr, nr)
struct m0_be_fmt_log_record_header lri_header
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
static void be_ut_log_cfg_set(struct m0_be_log_cfg *log_cfg, struct m0_mutex *lock)
M0_INTERNAL int m0_be_log_record_iter_init(struct m0_be_log_record_iter *iter)
char * lsc_stob_domain_location
M0_INTERNAL bool m0_be_log_recovery_record_available(struct m0_be_log *log)
M0_INTERNAL int m0_be_log_record_allocate(struct m0_be_log_record *record)
M0_INTERNAL int m0_be_log_record_initial(struct m0_be_log *log, struct m0_be_log_record_iter *curr)
M0_INTERNAL void m0_be_log_record_io_launch(struct m0_be_log_record *record, struct m0_be_op *op)
M0_INTERNAL const struct m0_fid * m0_stob_domain_id_get(const struct m0_stob_domain *dom)
m0_bcount_t bult_reserve_size
M0_INTERNAL int m0_stob_domain_destroy(struct m0_stob_domain *dom)
void m0_be_ut_log_header(void)
M0_INTERNAL int m0_be_log_open(struct m0_be_log *log, struct m0_be_log_cfg *log_cfg)
M0_INTERNAL m0_bcount_t m0_be_log_reserved_size(struct m0_be_log *log, m0_bcount_t *lio_size, int lio_nr)
M0_INTERNAL void m0_be_log_record_io_prepare(struct m0_be_log_record *record, enum m0_stob_io_opcode opcode, m0_bcount_t size_reserved)
struct m0_be_log_record bult_record
static int be_ut_log_open(struct m0_be_log *log, struct m0_mutex *lock)
static void be_ut_log_curr_pos_check(struct m0_be_log *log, m0_bindex_t pos)
m0_bcount_t bult_lio_size
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
static void be_ut_log_fini(struct m0_be_log *log)
void m0_be_ut_log_api(void)
void m0_be_ut_log_multi(void)
M0_INTERNAL uint64_t m0_round_up(uint64_t val, uint64_t size)
M0_INTERNAL int m0_be_log_record_io_create(struct m0_be_log_record *record, m0_bcount_t size_max)
M0_INTERNAL bool m0_be_log_header__repair(struct m0_be_fmt_log_header **hdrs, int nr, struct m0_be_fmt_log_header *out)
M0_INTERNAL int m0_be_log_record_next(struct m0_be_log *log, const struct m0_be_log_record_iter *curr, struct m0_be_log_record_iter *next)
struct m0_be_log_store_cfg lc_store_cfg
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_be_log_record_assign(struct m0_be_log_record *record, struct m0_be_log_record_iter *iter, bool need_discard)
const char * be_ut_log_sdom_init_cfg
M0_INTERNAL void m0_be_log_close(struct m0_be_log *log)
#define M0_BE_OP_SYNC_RET(op_obj, action, member)
static struct m0_addb2_callback c
struct m0_mutex * bult_lock
static struct m0_bufvec bvec
M0_INTERNAL void m0_be_log_record_fini(struct m0_be_log_record *record)
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)
static void be_ut_log_record_wait_fini_one(struct m0_be_log_record *record, struct m0_mutex *lock, struct m0_be_op *op, bool discard)
void * m0_alloc(size_t size)
M0_INTERNAL int m0_be_log_create(struct m0_be_log *log, struct m0_be_log_cfg *log_cfg)
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
static void be_ut_log_init(struct m0_be_log *log, struct m0_mutex *lock)
M0_INTERNAL void m0_be_log_header__set(struct m0_be_fmt_log_header *hdr, m0_bindex_t discarded, m0_bindex_t lsn, m0_bcount_t size)
M0_INTERNAL void m0_be_log_record_discard(struct m0_be_log *log, m0_bcount_t size)
M0_UT_THREADS_DEFINE(be_ut_log, be_ut_log_multi_thread)
M0_INTERNAL void m0_be_log_record_reset(struct m0_be_log_record *record)
M0_INTERNAL int m0_be_log_reserve(struct m0_be_log *log, m0_bcount_t size)
M0_INTERNAL void m0_be_log_recovery_record_get(struct m0_be_log *log, struct m0_be_log_record_iter *iter)
static void be_ut_log_record_write_sync(struct m0_be_log *log, struct m0_mutex *lock, m0_bindex_t *index, m0_bcount_t *size)
static void be_ut_log_multi_ut(int thread_nr, bool discard, int lio_nr, m0_bcount_t lio_size)
#define M0_ALLOC_PTR(ptr)
M0_INTERNAL bool m0_be_log_header__is_eq(struct m0_be_fmt_log_header *hdr1, struct m0_be_fmt_log_header *hdr2)
M0_INTERNAL void m0_be_log_destroy(struct m0_be_log *log)
void m0_be_ut_log_unplaced(void)
void m0_be_ut_log_user(void)
M0_INTERNAL int m0_be_log_header_read(struct m0_be_log *log, struct m0_be_fmt_log_header *log_hdr)
M0_INTERNAL void m0_be_op_fini(struct m0_be_op *op)
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
const char * be_ut_log_sdom_location
#define M0_UT_THREADS_STOP(name)
static void be_ut_log_recover_and_discard(struct m0_be_log *log, struct m0_mutex *lock)
M0_INTERNAL void m0_be_log_record_iter_fini(struct m0_be_log_record_iter *iter)
struct m0_atomic64 * bult_atom
const char * be_ut_log_sdom_create_cfg
static void be_ut_log_multi_thread(struct be_ut_log_thread_ctx *ctx)
#define M0_UT_THREADS_START(name, thread_nr, param_array)
struct m0_be_log * bult_log
M0_INTERNAL void m0_be_log_record_deallocate(struct m0_be_log_record *record)
static void be_ut_log_got_space_cb(struct m0_be_log *log)
struct m0_stob_domain * be_ut_log_stob_domain
M0_INTERNAL void m0_be_log_record_skip_discard(struct m0_be_log_record *record)
static void be_ut_log_header_repair_test(int header_nr, int new_nr, m0_bindex_t lsn_old, m0_bcount_t size_old, m0_bindex_t lsn_new, m0_bcount_t size_new, int valid_index)
M0_INTERNAL void m0_be_op_init(struct m0_be_op *op)
M0_INTERNAL void m0_be_log_record_init(struct m0_be_log_record *record, struct m0_be_log *log)
M0_INTERNAL uint32_t m0_be_log_bshift(struct m0_be_log *log)
static int64_t m0_atomic64_add_return(struct m0_atomic64 *a, int64_t d)
M0_INTERNAL void m0_be_op_wait(struct m0_be_op *op)
struct m0_stob_id lsc_stob_id
static void m0_atomic64_set(struct m0_atomic64 *a, int64_t num)
M0_INTERNAL void m0_be_log_unreserve(struct m0_be_log *log, m0_bcount_t size)