78 head = m0_lll_tlist_head(&
lock->l_waiters);
99 head = m0_lll_tlist_head(&
lock->l_owners);
102 m0_lll_tlist_length(&
lock->l_owners) == 1;
113 size_t owners_min,
size_t owners_max,
size_t waiters)
120 owners_len = m0_lll_tlist_length(&
lock->l_owners);
121 result = owners_min <= owners_len && owners_len <= owners_max &&
122 m0_lll_tlist_length(&
lock->l_waiters) == waiters &&
251 {.tr_type =
RQ_READ, .tr_owners = {1, 1}, .tr_waiters = 8},
252 {.tr_type =
RQ_WRITE, .tr_owners = {1, 1}, .tr_waiters = 7},
253 {.tr_type =
RQ_READ, .tr_owners = {1, 3}, .tr_waiters = 4},
254 {.tr_type =
RQ_READ, .tr_owners = {1, 3}, .tr_waiters = 4},
255 {.tr_type =
RQ_READ, .tr_owners = {1, 3}, .tr_waiters = 4},
256 {.tr_type =
RQ_WRITE, .tr_owners = {1, 1}, .tr_waiters = 3},
257 {.tr_type =
RQ_READ, .tr_owners = {1, 3}, .tr_waiters = 0},
258 {.tr_type =
RQ_READ, .tr_owners = {1, 3}, .tr_waiters = 0},
259 {.tr_type =
RQ_READ, .tr_owners = {1, 3}, .tr_waiters = 0},
261 {.tr_type =
RQ_WAKE_UP, .tr_owners = {0, 0}, .tr_waiters = 0},
262 {.tr_type =
RQ_LAST, .tr_owners = {0, 0}, .tr_waiters = 0},
265 {.tr_type =
RQ_WRITE, .tr_owners = {1, 1}, .tr_waiters = 9},
266 {.tr_type =
RQ_READ, .tr_owners = {1, 1}, .tr_waiters = 8},
267 {.tr_type =
RQ_WRITE, .tr_owners = {1, 1}, .tr_waiters = 7},
268 {.tr_type =
RQ_READ, .tr_owners = {1, 3}, .tr_waiters = 4},
269 {.tr_type =
RQ_READ, .tr_owners = {1, 3}, .tr_waiters = 4},
270 {.tr_type =
RQ_READ, .tr_owners = {1, 3}, .tr_waiters = 4},
271 {.tr_type =
RQ_WRITE, .tr_owners = {1, 1}, .tr_waiters = 3},
272 {.tr_type =
RQ_READ, .tr_owners = {1, 3}, .tr_waiters = 0},
273 {.tr_type =
RQ_READ, .tr_owners = {1, 3}, .tr_waiters = 0},
274 {.tr_type =
RQ_READ, .tr_owners = {1, 3}, .tr_waiters = 0},
276 {.tr_type =
RQ_WAKE_UP, .tr_owners = {0, 0}, .tr_waiters = 0},
277 {.tr_type =
RQ_LAST, .tr_owners = {0, 0}, .tr_waiters = 0},
280 {.tr_type =
RQ_WRITE, .tr_owners = {1, 1}, .tr_waiters = 9},
281 {.tr_type =
RQ_READ, .tr_owners = {1, 1}, .tr_waiters = 8},
282 {.tr_type =
RQ_WRITE, .tr_owners = {1, 1}, .tr_waiters = 7},
283 {.tr_type =
RQ_WRITE, .tr_owners = {1, 1}, .tr_waiters = 6},
284 {.tr_type =
RQ_WRITE, .tr_owners = {1, 1}, .tr_waiters = 5},
285 {.tr_type =
RQ_READ, .tr_owners = {1, 1}, .tr_waiters = 4},
286 {.tr_type =
RQ_WRITE, .tr_owners = {1, 1}, .tr_waiters = 3},
287 {.tr_type =
RQ_READ, .tr_owners = {1, 3}, .tr_waiters = 0},
288 {.tr_type =
RQ_READ, .tr_owners = {1, 3}, .tr_waiters = 0},
289 {.tr_type =
RQ_READ, .tr_owners = {1, 3}, .tr_waiters = 0},
291 {.tr_type =
RQ_WAKE_UP, .tr_owners = {0, 0}, .tr_waiters = 0},
292 {.tr_type =
RQ_LAST, .tr_owners = {0, 0}, .tr_waiters = 0},
M0_INTERNAL void m0_long_lock_fini(struct m0_long_lock *lock)
static struct m0_mutex lock
M0_INTERNAL void m0_chan_wait(struct m0_clink *link)
M0_INTERNAL void m0_fom_wakeup(struct m0_fom *fom)
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
#define M0_FOM_LONG_LOCK_RETURN(rc)
M0_INTERNAL void m0_clink_init(struct m0_clink *link, m0_chan_cb_t cb)
M0_INTERNAL void m0_clink_del_lock(struct m0_clink *link)
struct m0_long_lock_link fr_link
M0_TL_DECLARE(m0_lll, M0_INTERNAL, struct m0_long_lock_link)
M0_INTERNAL void m0_long_write_unlock(struct m0_long_lock *lock, struct m0_long_lock_link *link)
static struct m0_long_lock long_lock
#define container_of(ptr, type, member)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
struct m0_rwlock rh_rwlock
M0_TL_DESCR_DECLARE(m0_lll, M0_EXTERN)
static int head(struct m0_sm *mach)
M0_INTERNAL bool m0_long_write_lock(struct m0_long_lock *lk, struct m0_long_lock_link *link, int next_phase)
M0_INTERNAL void m0_chan_init(struct m0_chan *chan, struct m0_mutex *ch_guard)
static bool readers_check(struct m0_long_lock *lock)
static bool lock_check(struct m0_long_lock *lock, enum tb_request_type type, size_t owners_min, size_t owners_max, size_t waiters)
static bool writer_check(struct m0_long_lock *lock)
static int rdwr_fom_create(struct m0_fom **m, struct m0_reqh *reqh)
static struct m0_clink clink[RDWR_REQUEST_MAX]
static struct m0_clink l[NR]
M0_INTERNAL void m0_chan_signal_lock(struct m0_chan *chan)
M0_INTERNAL bool m0_long_is_read_locked(struct m0_long_lock *lock, const struct m0_fom *fom)
M0_INTERNAL bool m0_long_is_write_locked(struct m0_long_lock *lock, const struct m0_fom *fom)
M0_INTERNAL int m0_reqh_state_get(struct m0_reqh *reqh)
void m0_clink_add_lock(struct m0_chan *chan, struct m0_clink *link)
M0_INTERNAL void m0_long_lock_init(struct m0_long_lock *lock)
static int fom_rdwr_tick(struct m0_fom *fom)
struct test_min_max tr_owners
static void reqh_fop_handle(struct m0_reqh *reqh, struct m0_fom *fom)
static void test_req_handle(struct m0_reqh *reqh, struct test_request *rq, int seqn)
static struct m0_chan chan[RDWR_REQUEST_MAX]
static void rdwr_send_fop(struct m0_reqh **reqh, size_t reqh_nr)
M0_INTERNAL void m0_clink_fini(struct m0_clink *link)
M0_INTERNAL void m0_rwlock_read_lock(struct m0_rwlock *lock)
M0_INTERNAL void m0_fom_queue(struct m0_fom *fom)
enum tb_request_type tr_type
M0_INTERNAL void m0_rwlock_read_unlock(struct m0_rwlock *lock)
M0_INTERNAL void m0_long_read_unlock(struct m0_long_lock *lock, struct m0_long_lock_link *link)
M0_INTERNAL bool m0_long_read_lock(struct m0_long_lock *lk, struct m0_long_lock_link *link, int next_phase)
void m0_fom_phase_set(struct m0_fom *fom, int phase)
M0_INTERNAL void m0_chan_fini_lock(struct m0_chan *chan)
static struct m0_fom * sleeper
#define m0_tl_forall(name, var, head,...)
#define M0_IMPOSSIBLE(fmt,...)
struct test_request * fr_req