__ret; \
})
-#define l_wait_condition(wq, condition) \
-({ \
- struct l_wait_info lwi = { 0 }; \
- l_wait_event(wq, condition, &lwi); \
-})
-
-#define l_wait_condition_exclusive(wq, condition) \
-({ \
- struct l_wait_info lwi = { 0 }; \
- l_wait_event_exclusive(wq, condition, &lwi); \
-})
-
-#define l_wait_condition_exclusive_head(wq, condition) \
-({ \
- struct l_wait_info lwi = { 0 }; \
- l_wait_event_exclusive_head(wq, condition, &lwi); \
-})
-
/** @} lib */
+
#endif /* _LUSTRE_LIB_H */
ldlm_set_bl_done(lock);
wake_up_all(&lock->l_waitq);
} else if (!ldlm_is_bl_done(lock)) {
- struct l_wait_info lwi = { 0 };
-
/*
* The lock is guaranteed to have been canceled once
* returning from this function.
*/
unlock_res_and_lock(lock);
- l_wait_event(lock->l_waitq, is_bl_done(lock), &lwi);
+ wait_event_idle(lock->l_waitq, is_bl_done(lock));
lock_res_and_lock(lock);
}
}
/* cannot use bltd after this, it is only on caller's stack */
while (1) {
- struct l_wait_info lwi = { 0 };
struct ldlm_bl_work_item *blwi = NULL;
struct obd_export *exp = NULL;
int rc;
rc = ldlm_bl_get_work(blp, &blwi, &exp);
if (!rc)
- l_wait_event_exclusive(blp->blp_waitq,
- ldlm_bl_get_work(blp, &blwi,
- &exp),
- &lwi);
+ wait_event_idle_exclusive(blp->blp_waitq,
+ ldlm_bl_get_work(blp, &blwi,
+ &exp));
atomic_inc(&blp->blp_busy_threads);
if (ldlm_bl_thread_need_create(blp, blwi))
static int ldlm_pools_thread_start(void)
{
- struct l_wait_info lwi = { 0 };
struct task_struct *task;
if (ldlm_pools_thread)
ldlm_pools_thread = NULL;
return PTR_ERR(task);
}
- l_wait_event(ldlm_pools_thread->t_ctl_waitq,
- thread_is_running(ldlm_pools_thread), &lwi);
+ wait_event_idle(ldlm_pools_thread->t_ctl_waitq,
+ thread_is_running(ldlm_pools_thread));
return 0;
}
struct ll_sb_info *sbi = ll_i2sbi(dir);
struct ll_statahead_info *sai;
struct ptlrpc_thread *thread;
- struct l_wait_info lwi = { 0 };
sai = ll_sai_get(dir);
thread = &sai->sai_agl_thread;
wake_up(&thread->t_ctl_waitq);
while (1) {
- l_wait_event(thread->t_ctl_waitq,
- !list_empty(&sai->sai_agls) ||
- !thread_is_running(thread),
- &lwi);
+ wait_event_idle(thread->t_ctl_waitq,
+ !list_empty(&sai->sai_agls) ||
+ !thread_is_running(thread));
if (!thread_is_running(thread))
break;
static void ll_start_agl(struct dentry *parent, struct ll_statahead_info *sai)
{
struct ptlrpc_thread *thread = &sai->sai_agl_thread;
- struct l_wait_info lwi = { 0 };
struct ll_inode_info *plli;
struct task_struct *task;
return;
}
- l_wait_event(thread->t_ctl_waitq,
- thread_is_running(thread) || thread_is_stopped(thread),
- &lwi);
+ wait_event_idle(thread->t_ctl_waitq,
+ thread_is_running(thread) || thread_is_stopped(thread));
}
/* statahead thread main function */
int first = 0;
int rc = 0;
struct md_op_data *op_data;
- struct l_wait_info lwi = { 0 };
sai = ll_sai_get(dir);
sa_thread = &sai->sai_thread;
/* wait for spare statahead window */
do {
- l_wait_event(sa_thread->t_ctl_waitq,
- !sa_sent_full(sai) ||
- sa_has_callback(sai) ||
- !list_empty(&sai->sai_agls) ||
- !thread_is_running(sa_thread),
- &lwi);
+ wait_event_idle(sa_thread->t_ctl_waitq,
+ !sa_sent_full(sai) ||
+ sa_has_callback(sai) ||
+ !list_empty(&sai->sai_agls) ||
+ !thread_is_running(sa_thread));
sa_handle_callback(sai);
spin_lock(&lli->lli_agl_lock);
* for file release to stop me.
*/
while (thread_is_running(sa_thread)) {
- l_wait_event(sa_thread->t_ctl_waitq,
- sa_has_callback(sai) ||
- !agl_list_empty(sai) ||
- !thread_is_running(sa_thread),
- &lwi);
+ wait_event_idle(sa_thread->t_ctl_waitq,
+ sa_has_callback(sai) ||
+ !agl_list_empty(sai) ||
+ !thread_is_running(sa_thread));
sa_handle_callback(sai);
}
CDEBUG(D_READA, "stop agl thread: sai %p pid %u\n",
sai, (unsigned int)agl_thread->t_pid);
- l_wait_event(agl_thread->t_ctl_waitq,
- thread_is_stopped(agl_thread),
- &lwi);
+ wait_event_idle(agl_thread->t_ctl_waitq,
+ thread_is_stopped(agl_thread));
} else {
/* Set agl_thread flags anyway. */
thread_set_flags(agl_thread, SVC_STOPPED);
*/
while (sai->sai_sent != sai->sai_replied) {
/* in case we're not woken up, timeout wait */
- lwi = LWI_TIMEOUT(msecs_to_jiffies(MSEC_PER_SEC >> 3),
- NULL, NULL);
+ struct l_wait_info lwi = LWI_TIMEOUT(msecs_to_jiffies(MSEC_PER_SEC >> 3),
+ NULL, NULL);
l_wait_event(sa_thread->t_ctl_waitq,
sai->sai_sent == sai->sai_replied, &lwi);
}
{
struct ll_inode_info *lli = ll_i2info(dir);
struct ll_statahead_info *sai = NULL;
- struct l_wait_info lwi = { 0 };
struct ptlrpc_thread *thread;
struct task_struct *task;
struct dentry *parent = dentry->d_parent;
goto out;
}
- l_wait_event(thread->t_ctl_waitq,
- thread_is_running(thread) || thread_is_stopped(thread),
- &lwi);
+ wait_event_idle(thread->t_ctl_waitq,
+ thread_is_running(thread) || thread_is_stopped(thread));
ll_sai_put(sai);
/*
static int lov_layout_wait(const struct lu_env *env, struct lov_object *lov)
{
- struct l_wait_info lwi = { 0 };
-
while (atomic_read(&lov->lo_active_ios) > 0) {
CDEBUG(D_INODE, "file:" DFID " wait for active IO, now: %d.\n",
PFID(lu_object_fid(lov2lu(lov))),
atomic_read(&lov->lo_active_ios));
- l_wait_event(lov->lo_waitq,
- atomic_read(&lov->lo_active_ios) == 0, &lwi);
+ wait_event_idle(lov->lo_waitq,
+ atomic_read(&lov->lo_active_ios) == 0);
}
return 0;
}
config_log_put(cld_prev);
/* Wait a bit to see if anyone else needs a requeue */
- lwi = (struct l_wait_info) { 0 };
- l_wait_event(rq_waitq, rq_state & (RQ_NOW | RQ_STOP),
- &lwi);
+ wait_event_idle(rq_waitq, rq_state & (RQ_NOW | RQ_STOP));
spin_lock(&config_list_lock);
}
CERROR("IO failed: %d, still wait for %d remaining entries\n",
rc, atomic_read(&anchor->csi_sync_nr));
- lwi = (struct l_wait_info) { 0 };
- (void)l_wait_event(anchor->csi_waitq,
- atomic_read(&anchor->csi_sync_nr) == 0,
- &lwi);
+ wait_event_idle(anchor->csi_waitq,
+ atomic_read(&anchor->csi_sync_nr) == 0);
} else {
rc = anchor->csi_sync_rc;
}
*/
void obd_zombie_barrier(void)
{
- struct l_wait_info lwi = { 0 };
-
if (obd_zombie_pid == current_pid())
/* don't wait for myself */
return;
- l_wait_event(obd_zombie_waitq, obd_zombie_is_idle(), &lwi);
+ wait_event_idle(obd_zombie_waitq, obd_zombie_is_idle());
}
EXPORT_SYMBOL(obd_zombie_barrier);
obd_zombie_pid = current_pid();
while (!test_bit(OBD_ZOMBIE_STOP, &obd_zombie_flags)) {
- struct l_wait_info lwi = { 0 };
-
- l_wait_event(obd_zombie_waitq,
- !obd_zombie_impexp_check(NULL), &lwi);
+ wait_event_idle(obd_zombie_waitq,
+ !obd_zombie_impexp_check(NULL));
obd_zombie_impexp_cull();
/*
u16 obd_get_mod_rpc_slot(struct client_obd *cli, __u32 opc,
struct lookup_intent *it)
{
- struct l_wait_info lwi = LWI_INTR(NULL, NULL);
bool close_req = false;
u16 i, max;
CDEBUG(D_RPCTRACE, "%s: sleeping for a modify RPC slot opc %u, max %hu\n",
cli->cl_import->imp_obd->obd_name, opc, max);
- l_wait_event(cli->cl_mod_rpcs_waitq,
- obd_mod_rpc_slot_avail(cli, close_req), &lwi);
+ wait_event_idle(cli->cl_mod_rpcs_waitq,
+ obd_mod_rpc_slot_avail(cli, close_req));
} while (true);
}
EXPORT_SYMBOL(obd_get_mod_rpc_slot);
"%s: wait ext to %u timedout, recovery in progress?\n",
cli_name(osc_cli(obj)), state);
- lwi = LWI_INTR(NULL, NULL);
- rc = l_wait_event(ext->oe_waitq, extent_wait_cb(ext, state),
- &lwi);
+ wait_event_idle(ext->oe_waitq, extent_wait_cb(ext, state));
+ rc = 0;
}
if (rc == 0 && ext->oe_rc < 0)
rc = ext->oe_rc;
int osc_object_invalidate(const struct lu_env *env, struct osc_object *osc)
{
- struct l_wait_info lwi = { 0 };
-
CDEBUG(D_INODE, "Invalidate osc object: %p, # of active IOs: %d\n",
osc, atomic_read(&osc->oo_nr_ios));
- l_wait_event(osc->oo_io_waitq, !atomic_read(&osc->oo_nr_ios), &lwi);
+ wait_event_idle(osc->oo_io_waitq, !atomic_read(&osc->oo_nr_ios));
/* Discard all dirty pages of this object. */
osc_cache_truncate_start(env, osc, 0, NULL);
int ptlrpc_start_pinger(void)
{
- struct l_wait_info lwi = { 0 };
struct task_struct *task;
int rc;
CERROR("cannot start pinger thread: rc = %d\n", rc);
return rc;
}
- l_wait_event(pinger_thread.t_ctl_waitq,
- thread_is_running(&pinger_thread), &lwi);
+ wait_event_idle(pinger_thread.t_ctl_waitq,
+ thread_is_running(&pinger_thread));
return 0;
}
int ptlrpc_stop_pinger(void)
{
- struct l_wait_info lwi = { 0 };
int rc = 0;
if (thread_is_init(&pinger_thread) ||
thread_set_flags(&pinger_thread, SVC_STOPPING);
wake_up(&pinger_thread.t_ctl_waitq);
- l_wait_event(pinger_thread.t_ctl_waitq,
- thread_is_stopped(&pinger_thread), &lwi);
+ wait_event_idle(pinger_thread.t_ctl_waitq,
+ thread_is_stopped(&pinger_thread));
return rc;
}
int sptlrpc_gc_init(void)
{
- struct l_wait_info lwi = { 0 };
struct task_struct *task;
mutex_init(&sec_gc_mutex);
return PTR_ERR(task);
}
- l_wait_event(sec_gc_thread.t_ctl_waitq,
- thread_is_running(&sec_gc_thread), &lwi);
+ wait_event_idle(sec_gc_thread.t_ctl_waitq,
+ thread_is_running(&sec_gc_thread));
return 0;
}
void sptlrpc_gc_fini(void)
{
- struct l_wait_info lwi = { 0 };
-
thread_set_flags(&sec_gc_thread, SVC_STOPPING);
wake_up(&sec_gc_thread.t_ctl_waitq);
- l_wait_event(sec_gc_thread.t_ctl_waitq,
- thread_is_stopped(&sec_gc_thread), &lwi);
+ wait_event_idle(sec_gc_thread.t_ctl_waitq,
+ thread_is_stopped(&sec_gc_thread));
}
wake_up(&ptlrpc_hr.hr_waitq);
while (!ptlrpc_hr.hr_stopping) {
- l_wait_condition(hrt->hrt_waitq, hrt_dont_sleep(hrt, &replies));
+ wait_event_idle(hrt->hrt_waitq, hrt_dont_sleep(hrt, &replies));
while (!list_empty(&replies)) {
struct ptlrpc_reply_state *rs;
static void ptlrpc_svcpt_stop_threads(struct ptlrpc_service_part *svcpt)
{
- struct l_wait_info lwi = { 0 };
struct ptlrpc_thread *thread;
LIST_HEAD(zombie);
CDEBUG(D_INFO, "waiting for stopping-thread %s #%u\n",
svcpt->scp_service->srv_thread_name, thread->t_id);
- l_wait_event(thread->t_ctl_waitq,
- thread_is_stopped(thread), &lwi);
+ wait_event_idle(thread->t_ctl_waitq,
+ thread_is_stopped(thread));
spin_lock(&svcpt->scp_lock);
}
int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait)
{
- struct l_wait_info lwi = { 0 };
struct ptlrpc_thread *thread;
struct ptlrpc_service *svc;
struct task_struct *task;
if (!wait)
return 0;
- l_wait_event(thread->t_ctl_waitq,
- thread_is_running(thread) || thread_is_stopped(thread),
- &lwi);
+ wait_event_idle(thread->t_ctl_waitq,
+ thread_is_running(thread) || thread_is_stopped(thread));
rc = thread_is_stopped(thread) ? thread->t_id : 0;
return rc;