24 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_STOB 249 chunks, frags, lio->
si_nr);
263 while (result == 0) {
264 struct iocb *iocb = &qev->
iq_iocb;
274 iocb->aio_fildes = lstob->
sl_fd;
275 iocb->u.v.nr =
min32u(frags, IOV_MAX);
277 iocb->aio_lio_opcode =
opcode;
279 for (
i = 0;
i < iocb->u.v.nr; ++
i) {
286 if (prev_off != ~0 && prev_off + frag_size != off)
292 if (frag_size > (
size_t)~0ULL) {
293 result =
M0_ERR(-EOVERFLOW);
300 chunk_size += frag_size;
310 (
unsigned long)off, (
unsigned long)chunk_size, result);
408 for (
i = 0;
i < got; ++
i) {
421 for (
i =
put;
i < got; ++
i)
470 .sie_fd = lstob->
sl_fd,
500 struct iocb *iocb = &qev->
iq_iocb;
503 static bool emulate_disk_error_found =
false;
515 const struct iovec *iov = iocb->u.v.vec;
518 for (
i = 0;
i < iocb->u.v.nr; ++
i) {
519 if (iov->iov_len <
res) {
522 memset(iov->iov_base +
res, 0,
536 if (res < 0 && io->si_rc == 0)
540 static struct m0_fid disk = {};
550 if (!emulate_disk_error_found)
552 emulate_disk_error_found =
false;
560 emulate_disk_error_found =
true;
566 if (emulate_disk_error_found)
662 for (
i = 0;
i < got; ++
i) {
664 struct io_event *iev;
758 #undef M0_TRACE_SUBSYSTEM M0_INTERNAL void m0_timer_locality_fini(struct m0_timer_locality *loc)
M0_INTERNAL void m0_stob_ioq_fini(struct m0_stob_ioq *ioq)
static void ioq_queue_unlock(struct m0_stob_ioq *ioq)
M0_INTERNAL int m0_timer_thread_attach(struct m0_timer_locality *loc)
struct m0_queue ioq_queue
void m0_addb2_force(m0_time_t delay)
struct m0_stob_io * iq_io
struct m0_timer ioq_stop_timer[M0_STOB_IOQ_NR_THREADS]
#define M0_ALLOC_ARR(arr, nr)
enum m0_stob_io_flags si_flags
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
static void stob_linux_io_fini(struct m0_stob_io *io)
M0_INTERNAL void m0_chan_broadcast_lock(struct m0_chan *chan)
static struct m0_semaphore inflight
M0_INTERNAL bool m0_semaphore_trydown(struct m0_semaphore *semaphore)
int m0_thread_join(struct m0_thread *q)
static uint64_t tag(uint8_t code, uint64_t id)
M0_INTERNAL uint32_t m0_stob_ioq_bshift(struct m0_stob_ioq *ioq)
static void ioq_queue_lock(struct m0_stob_ioq *ioq)
#define M0_LOG(level,...)
struct m0_atomic64 ioq_avail
static void m0_atomic64_sub(struct m0_atomic64 *a, int64_t num)
#define M0_ADDB2_PUSH(id,...)
struct m0_semaphore ioq_stop_sem[M0_STOB_IOQ_NR_THREADS]
struct m0_queue_link iq_linkage
M0_INTERNAL bool m0_stob_ioq_directio(struct m0_stob_ioq *ioq)
M0_INTERNAL void m0_ha_send(struct m0_ha *ha, struct m0_ha_link *hl, const struct m0_ha_msg *msg, uint64_t *tag)
const struct m0_stob_io_op * si_op
M0_INTERNAL void m0_timer_thread_detach(struct m0_timer_locality *loc)
static void ioq_queue_submit(struct m0_stob_ioq *ioq)
#define M0_THREAD_INIT(thread, TYPE, init, func, arg, namefmt,...)
M0_INTERNAL int m0_timer_init(struct m0_timer *timer, enum m0_timer_type type, struct m0_timer_locality *loc, m0_timer_callback_t callback, unsigned long data)
M0_INTERNAL struct m0 * m0_get(void)
M0_INTERNAL const struct m0_fid * m0_stob_fid_get(struct m0_stob *stob)
void m0_addb2_hist_mod(struct m0_addb2_hist *hist, int64_t val)
#define container_of(ptr, type, member)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
M0_ADDB2_ADD(M0_AVI_FS_CREATE, new_fid.f_container, new_fid.f_key, mode, rc)
M0_INTERNAL bool m0_fid_is_set(const struct m0_fid *fid)
int(* sio_launch)(struct m0_stob_io *io)
struct m0_fid sl_conf_sdev
M0_INTERNAL bool m0_queue_is_empty(const struct m0_queue *q)
static int head(struct m0_sm *mach)
#define M0_ASSERT_EX(cond)
M0_INTERNAL void m0_timer_fini(struct m0_timer *timer)
M0_INTERNAL m0_bcount_t m0_stob_ioq_bmask(struct m0_stob_ioq *ioq)
M0_INTERNAL struct m0_stob_linux * m0_stob_linux_container(struct m0_stob *stob)
M0_INTERNAL bool m0_vec_is_empty(const struct m0_vec *vec)
return M0_ERR(-EOPNOTSUPP)
static void ioq_queue_put(struct m0_stob_ioq *ioq, struct ioq_qev *qev)
struct m0_timer_locality ioq_stop_timer_loc[M0_STOB_IOQ_NR_THREADS]
M0_INTERNAL void m0_stob_ioq_directio_setup(struct m0_stob_ioq *ioq, bool use_directio)
M0_INTERNAL void m0_vec_cursor_init(struct m0_vec_cursor *cur, const struct m0_vec *vec)
M0_INTERNAL void m0_timer_stop(struct m0_timer *timer)
struct m0_indexvec si_stob
static struct m0_stob * stob
struct m0_atomic64 si_done
static void stob_ioq_thread(struct m0_stob_ioq *ioq)
M0_INTERNAL bool m0_mutex_is_locked(const struct m0_mutex *mutex)
M0_INTERNAL void m0_timer_start(struct m0_timer *timer, m0_time_t expire)
m0_time_t m0_time_now(void)
static unsigned long stob_ioq_timer_cb(unsigned long data)
M0_INTERNAL void m0_queue_link_init(struct m0_queue_link *ql)
M0_INTERNAL int m0_semaphore_init(struct m0_semaphore *semaphore, unsigned value)
static const struct timespec ioq_timeout_default
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
int64_t emulate_disk_errors_nr
struct m0_atomic64 si_bdone
static void ioq_complete(struct m0_stob_ioq *ioq, struct ioq_qev *qev, long res, long res2)
enum m0_stob_io_state si_state
static void ioq_io_error(struct m0_stob_ioq *ioq, struct ioq_qev *qev)
static bool m0_atomic64_dec_and_test(struct m0_atomic64 *a)
M0_INTERNAL int m0_stob_ioq_init(struct m0_stob_ioq *ioq)
static struct m0_stob_io io
void m0_addb2_pop(uint64_t id)
void m0_addb2_hist_add_auto(struct m0_addb2_hist *hist, int skip, uint64_t label, int idx)
static int64_t m0_atomic64_get(const struct m0_atomic64 *a)
M0_INTERNAL bool m0_fid_eq(const struct m0_fid *fid0, const struct m0_fid *fid1)
static int stob_linux_io_launch(struct m0_stob_io *io)
M0_INTERNAL struct m0_queue_link * m0_queue_get(struct m0_queue *q)
static struct ioq_qev * ioq_queue_get(struct m0_stob_ioq *ioq)
struct m0_stob_ioq * si_ioq
M0_INTERNAL void m0_queue_put(struct m0_queue *q, struct m0_queue_link *ql)
static uint32_t min32u(uint32_t a, uint32_t b)
M0_INTERNAL m0_bcount_t m0_vec_cursor_step(const struct m0_vec_cursor *cur)
static const struct m0_stob_io_op stob_linux_io_op
M0_INTERNAL void * m0_stob_addr_open(const void *buf, uint32_t shift)
#define M0_ALLOC_PTR(ptr)
M0_INTERNAL void m0_semaphore_fini(struct m0_semaphore *semaphore)
M0_INTERNAL bool m0_vec_cursor_move(struct m0_vec_cursor *cur, m0_bcount_t count)
M0_INTERNAL struct m0_thread * m0_thread_self(void)
m0_time_t m0_time_sub(const m0_time_t t1, const m0_time_t t2)
M0_INTERNAL size_t m0_queue_length(const struct m0_queue *q)
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
M0_INTERNAL void m0_queue_init(struct m0_queue *q)
M0_INTERNAL m0_bcount_t m0_stob_ioq_bsize(struct m0_stob_ioq *ioq)
M0_INTERNAL int m0_stob_linux_io_init(struct m0_stob *stob, struct m0_stob_io *io)
#define M0_MKTIME(secs, ns)
M0_INTERNAL void m0_timer_locality_init(struct m0_timer_locality *loc)
M0_INTERNAL void m0_semaphore_up(struct m0_semaphore *semaphore)
static int32_t min32(int32_t a, int32_t b)
M0_INTERNAL void m0_queue_fini(struct m0_queue *q)
static void m0_atomic64_add(struct m0_atomic64 *a, int64_t num)
struct m0_thread ioq_thread[M0_STOB_IOQ_NR_THREADS]
struct m0_stob_ioq sld_ioq
static void stob_linux_io_release(struct stob_linux_io *lio)
struct m0_pdclust_src_addr src
const m0_time_t M0_TIME_IMMEDIATELY
static int64_t m0_atomic64_add_return(struct m0_atomic64 *a, int64_t d)
M0_INTERNAL bool m0_queue_link_is_in(const struct m0_queue_link *ql)
static void m0_atomic64_set(struct m0_atomic64 *a, int64_t num)
static int stob_ioq_thread_init(struct m0_stob_ioq *ioq)
struct m0_stob_linux_domain * sl_dom
enum m0_stob_io_opcode si_opcode