63 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_ADDB 82 #include "addb2/addb2_xc.h" 83 #include "addb2/storage_xc.h" 228 static,
struct frame, f_linkage, f_magix,
273 uint64_t
key,
bool mkfs,
bool force)
276 const char *str_cfg_init;
282 str_cfg_init =
"directio=true";
287 if ((
rc == 0 && force) || !M0_IN(
rc, (0, -ENOENT))) {
294 if (
rc != 0 || force)
303 rc = (rc1 == 0 ?
rc : rc1);
365 goto cleanup_stob_domain;
373 size != h.he_stob_size)
506 force |=
obj->o_force;
619 return M0_RC(result);
625 frame_tlist_remove(
frame);
626 frame_tlink_fini(
frame);
692 #define PLACE(cur, obj, count) \ 694 M0_PRE(M0_IS_8ALIGNED(cur)); \ 695 size_t __nob = (count) * sizeof *(obj); \ 696 memcpy((cur), (obj), __nob); \ 698 M0_POST(M0_IS_8ALIGNED(cur)); \ 737 return M0_RC(result);
868 return _0C(frame_tlink_is_in(
frame)) &&
902 #undef M0_TRACE_SUBSYSTEM static struct frame * frame_cur(const struct m0_addb2_storage *stor)
m0_bindex_t f_index[IO_FRAG]
static struct m0_addb2_storage * stor
struct m0_stob_domain * as_stob_dom
M0_TL_DEFINE(frame, static, struct frame)
static void frame_io_pack(struct frame *frame)
static bool stor_rounded(const struct m0_addb2_storage *stor, m0_bindex_t index)
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
M0_INTERNAL void m0_stob_io_fini(struct m0_stob_io *io)
const struct m0_addb2_storage_ops * as_ops
static void stor_stob_fini(struct m0_addb2_storage *stor)
M0_INTERNAL void m0_clink_init(struct m0_clink *link, m0_chan_cb_t cb)
m0_bindex_t as_prev_offset
M0_INTERNAL int m0_stob_locate(struct m0_stob *stob)
M0_INTERNAL void m0_clink_del_lock(struct m0_clink *link)
static struct buffer * cur(struct m0_addb2_mach *mach, m0_bcount_t space)
#define M0_LOG(level,...)
M0_INTERNAL bool m0_mutex_is_not_locked(const struct m0_mutex *mutex)
M0_INTERNAL int m0_stob_domain_destroy(struct m0_stob_domain *dom)
void(* sto_idle)(struct m0_addb2_storage *stor)
M0_INTERNAL void * m0_addb2_storage_cookie(const struct m0_addb2_storage *stor)
M0_INTERNAL void m0_addb2_storage_stop(struct m0_addb2_storage *stor)
M0_INTERNAL void m0_free_aligned(void *data, size_t size, unsigned shift)
static bool frame_invariant(const struct frame *frame)
M0_INTERNAL const struct m0_fid * m0_stob_fid_get(struct m0_stob *stob)
#define container_of(ptr, type, member)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
M0_INTERNAL const uint64_t m0_addb2_stob_key
M0_INTERNAL uint64_t m0_addb2__dummy_payload[1]
M0_INTERNAL bool m0_addb2_storage__is_not_locked(const struct m0_addb2_storage *stor)
static int stor_stob_init(struct m0_addb2_storage *stor, uint64_t key)
static bool trace_fits(const struct frame *frame, const struct m0_addb2_trace *trace)
struct frame as_prealloc[MAX_INFLIGHT+1]
M0_INTERNAL uint64_t m0_round_up(uint64_t val, uint64_t size)
static void stor_drain(struct m0_addb2_storage *stor)
struct m0_addb2_trace o_tr
M0_INTERNAL uint32_t m0_stob_block_shift(struct m0_stob *stob)
static void stor_dom_fini(struct m0_addb2_storage *stor)
M0_TL_DESCR_DEFINE(frame, "addb2 frames", static, struct frame, f_linkage, f_magix, M0_ADDB2_FRAME_MAGIC, M0_ADDB2_FRAME_HEAD_MAGIC)
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)
#define PLACE(cur, obj, count)
void m0_addb2_trace_done(const struct m0_addb2_trace *ctrace)
M0_INTERNAL void m0_addb2_storage_fini(struct m0_addb2_storage *stor)
return M0_ERR(-EOPNOTSUPP)
#define M0_AMB(obj, ptr, field)
#define m0_tl_teardown(name, head, obj)
static int frame_init(struct frame *frame, struct m0_addb2_storage *stor)
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)
static void frame_done(struct frame *frame)
static void frame_idle(struct frame *frame)
struct m0_indexvec si_stob
static struct m0_stob * stob
static int stor_dom_init(struct m0_addb2_storage *stor, const char *location, uint64_t key, bool mkfs, bool force)
struct m0_addb2_frame_header f_header
m0_time_t m0_time_now(void)
M0_INTERNAL uint64_t m0_addb2__dummy_payload_size
static struct m0_stob_domain * dom
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)
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
static m0_bindex_t stor_round(const struct m0_addb2_storage *stor, m0_bindex_t index)
struct m0_addb2_storage * f_stor
static bool frame_endio(struct m0_clink *link)
void(* sto_commit)(struct m0_addb2_storage *stor, const struct m0_addb2_frame_header *anchor)
struct m0_addb2_trace * f_trace[FRAME_TRACE_MAX]
static struct m0_stob_io io
static bool stor_invariant(const struct m0_addb2_storage *stor)
static void frame_submit(struct frame *frame)
static void trace_add(struct frame *frame, struct m0_addb2_trace *trace)
M0_INTERNAL void m0_stob_domain_fini(struct m0_stob_domain *dom)
M0_INTERNAL int m0_stob_create(struct m0_stob *stob, struct m0_dtx *dtx, const char *str_cfg)
#define m0_forall(var, nr,...)
void(* sto_done)(struct m0_addb2_storage *stor, struct m0_addb2_trace_obj *obj)
void m0_clink_add_lock(struct m0_chan *chan, struct m0_clink *link)
M0_INTERNAL int m0_stob_domain_destroy_location(const char *location)
M0_INTERNAL enum m0_stob_state m0_stob_state_get(struct m0_stob *stob)
M0_INTERNAL struct m0_addb2_storage * m0_addb2_storage_init(const char *location, uint64_t key, bool mkfs, bool force, const struct m0_addb2_storage_ops *ops, m0_bcount_t size, void *cookie)
M0_INTERNAL int m0_stob_domain_init(const char *location, const char *str_cfg_init, struct m0_stob_domain **out)
static void stor_update(struct m0_addb2_storage *stor, const struct m0_addb2_frame_header *header)
static void frame_clear(struct frame *frame)
M0_INTERNAL void * m0_stob_addr_open(const void *buf, uint32_t shift)
#define M0_ALLOC_PTR(ptr)
M0_INTERNAL m0_bcount_t m0_addb2_trace_size(const struct m0_addb2_trace *trace)
M0_INTERNAL int m0_addb2_storage_submit(struct m0_addb2_storage *stor, struct m0_addb2_trace_obj *obj)
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
M0_INTERNAL void m0_clink_fini(struct m0_clink *link)
struct m0_addb2_trace_obj as_marker
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 int frame_try(struct frame *frame)
struct m0_tlink f_linkage
static void stor_balance(struct m0_addb2_storage *stor, int delta)
m0_bcount_t f_count[IO_FRAG]
static void frame_io_open(struct frame *frame)
M0_INTERNAL void * m0_alloc_aligned(size_t size, unsigned shift)
static bool trace_tryadd(struct m0_addb2_storage *stor, struct m0_addb2_trace *trace)
static const struct m0_format_tag frame_tag
#define offsetof(typ, memb)
M0_INTERNAL void m0_stob_put(struct m0_stob *stob)
static void stor_fini(struct m0_addb2_storage *stor)
static void frame_fini(struct frame *frame)
M0_INTERNAL int m0_addb2_storage_header(struct m0_stob *stob, struct m0_addb2_frame_header *h)
enum m0_stob_io_opcode si_opcode