From: Mr NeilBrown Date: Mon, 26 Aug 2019 05:34:17 +0000 (+1000) Subject: LU-10467 lustre: use wait_event_idle() where appropriate. X-Git-Tag: 2.13.51~180 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=fa9c4d0fee01d30d538a819f370f281431a43f68 LU-10467 lustre: use wait_event_idle() where appropriate. When l_wait_event() is passed an 'lwi' which is initialised to all zeroes, it behaves exactly like wait_event_idle(): - no timeout - not interrupted by any signal - doesn't add to load average. So change all these instances to wait_event_idle(), or in two cases, to wait_event_idle_exclusive(). There are three ways that lwi gets set to all zeros: struct l_wait_info lwi = { 0 }; lwi = LWI_INTR(NULL, NULL); memset(&lwi, 0, sizeof(lwi)); Change-Id: Ia6723cbe248ce067331a002e5e9d54796739c08a Signed-off-by: Mr NeilBrown Reviewed-on: https://review.whamcloud.com/35971 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Petros Koutoupis Reviewed-by: Yang Sheng Reviewed-by: Shaun Tancheff Reviewed-by: Oleg Drokin --- diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 0d95dd6..30d2fd5 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -2113,12 +2113,10 @@ repeat: * yet, let's wait those threads stopped */ if (next_update_transno == 0) { - struct l_wait_info lwi = { 0 }; - - l_wait_event(tdtd->tdtd_recovery_threads_waitq, - atomic_read( - &tdtd->tdtd_recovery_threads_count) == 0, - &lwi); + wait_event_idle( + tdtd->tdtd_recovery_threads_waitq, + atomic_read(&tdtd->tdtd_recovery_threads_count) + == 0); next_update_transno = distribute_txn_get_next_transno( @@ -2159,16 +2157,15 @@ repeat: if (obd->obd_abort_recovery) { CWARN("recovery is aborted, evict exports in recovery\n"); if (lut->lut_tdtd != NULL) { - struct l_wait_info lwi = { 0 }; - tdtd = lut->lut_tdtd; /* * Let's wait all of the update log recovery thread * finished */ - l_wait_event(tdtd->tdtd_recovery_threads_waitq, - atomic_read(&tdtd->tdtd_recovery_threads_count) == 0, - &lwi); + wait_event_idle( + tdtd->tdtd_recovery_threads_waitq, + atomic_read(&tdtd->tdtd_recovery_threads_count) + == 0); /* Then abort the update recovery list */ dtrq_list_destroy(lut->lut_tdtd); } @@ -3329,12 +3326,9 @@ int target_bulk_io(struct obd_export *exp, struct ptlrpc_bulk_desc *desc) ENTRY; /* If there is eviction in progress, wait for it to finish. */ - if (unlikely(atomic_read(&exp->exp_obd->obd_evict_inprogress))) { - lwi = LWI_INTR(NULL, NULL); - rc = l_wait_event(exp->exp_obd->obd_evict_inprogress_waitq, - !atomic_read(&exp->exp_obd->obd_evict_inprogress), - &lwi); - } + wait_event_idle( + exp->exp_obd->obd_evict_inprogress_waitq, + !atomic_read(&exp->exp_obd->obd_evict_inprogress)); /* Check if client was evicted or reconnected already. */ if (exp->exp_failed || diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index c3f7577..4bde252 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -2420,12 +2420,10 @@ void ldlm_cancel_callback(struct ldlm_lock *lock) 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); } } diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 0dc552d..b337009 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -173,7 +173,6 @@ static inline int have_expired_locks(void) static int expired_lock_main(void *arg) { struct list_head *expired = &expired_lock_list; - struct l_wait_info lwi = { 0 }; int do_dump; ENTRY; @@ -182,10 +181,9 @@ static int expired_lock_main(void *arg) wake_up(&expired_lock_wait_queue); while (1) { - l_wait_event(expired_lock_wait_queue, - have_expired_locks() || - expired_lock_thread_state == ELT_TERMINATE, - &lwi); + wait_event_idle(expired_lock_wait_queue, + have_expired_locks() || + expired_lock_thread_state == ELT_TERMINATE); spin_lock_bh(&waiting_locks_spinlock); if (expired_lock_dump) { @@ -2855,7 +2853,6 @@ static int ldlm_bl_thread_main(void *arg) /* 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; @@ -2863,10 +2860,9 @@ static int ldlm_bl_thread_main(void *arg) rc = ldlm_bl_get_work(blp, &blwi, &exp); if (rc == 0) - 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)) diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 3e01725..520ec17 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -1601,10 +1601,8 @@ int ldlm_cli_cancel(const struct lustre_handle *lockh, if (cancel_flags & LCF_ASYNC) { unlock_res_and_lock(lock); } else { - struct l_wait_info lwi = { 0 }; - 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)); } LDLM_LOCK_RELEASE(lock); RETURN(0); diff --git a/lustre/lfsck/lfsck_engine.c b/lustre/lfsck/lfsck_engine.c index a1763a6..520ff35 100644 --- a/lustre/lfsck/lfsck_engine.c +++ b/lustre/lfsck/lfsck_engine.c @@ -634,7 +634,6 @@ static int lfsck_double_scan(const struct lu_env *env, { struct lfsck_component *com; struct lfsck_component *next; - struct l_wait_info lwi = { 0 }; int rc = 0; int rc1 = 0; @@ -644,9 +643,8 @@ static int lfsck_double_scan(const struct lu_env *env, rc1 = rc; } - l_wait_event(lfsck->li_thread.t_ctl_waitq, - atomic_read(&lfsck->li_double_scan_count) == 0, - &lwi); + wait_event_idle(lfsck->li_thread.t_ctl_waitq, + atomic_read(&lfsck->li_double_scan_count) == 0); if (lfsck->li_status != LS_PAUSED && lfsck->li_status != LS_CO_PAUSED) { @@ -1026,7 +1024,6 @@ int lfsck_master_engine(void *args) struct dt_object *oit_obj = lfsck->li_obj_oit; const struct dt_it_ops *oit_iops = &oit_obj->do_index_ops->dio_it; struct dt_it *oit_di; - struct l_wait_info lwi = { 0 }; int rc; ENTRY; @@ -1086,10 +1083,9 @@ int lfsck_master_engine(void *args) spin_unlock(&lfsck->li_lock); wake_up_all(&thread->t_ctl_waitq); - l_wait_event(thread->t_ctl_waitq, - lfsck->li_start_unplug || - !thread_is_running(thread), - &lwi); + wait_event_idle(thread->t_ctl_waitq, + lfsck->li_start_unplug || + !thread_is_running(thread)); if (!thread_is_running(thread)) GOTO(fini_oit, rc = 0); diff --git a/lustre/lfsck/lfsck_layout.c b/lustre/lfsck/lfsck_layout.c index c66358e..9e93013 100644 --- a/lustre/lfsck/lfsck_layout.c +++ b/lustre/lfsck/lfsck_layout.c @@ -5366,7 +5366,6 @@ static int lfsck_layout_scan_stripes(const struct lu_env *env, struct lfsck_tgt_descs *ltds = &lfsck->li_ost_descs; struct ptlrpc_thread *mthread = &lfsck->li_thread; struct ptlrpc_thread *athread = &lad->lad_thread; - struct l_wait_info lwi = { 0 }; struct lu_buf buf; int rc = 0; int i; @@ -5396,11 +5395,10 @@ static int lfsck_layout_scan_stripes(const struct lu_env *env, if (unlikely(lovea_slot_is_dummy(objs))) continue; - l_wait_event(mthread->t_ctl_waitq, - lad->lad_prefetched < bk->lb_async_windows || - !thread_is_running(mthread) || - thread_is_stopped(athread), - &lwi); + wait_event_idle(mthread->t_ctl_waitq, + lad->lad_prefetched < bk->lb_async_windows || + !thread_is_running(mthread) || + thread_is_stopped(athread)); if (unlikely(!thread_is_running(mthread)) || thread_is_stopped(athread)) diff --git a/lustre/lfsck/lfsck_lib.c b/lustre/lfsck/lfsck_lib.c index e7a7b77..db9ca31 100644 --- a/lustre/lfsck/lfsck_lib.c +++ b/lustre/lfsck/lfsck_lib.c @@ -2554,13 +2554,10 @@ int lfsck_start_assistant(const struct lu_env *env, struct lfsck_component *com, "rc = %d\n", lfsck_lfsck2name(lfsck), lad->lad_name, rc); lfsck_thread_args_fini(lta); } else { - struct l_wait_info lwi = { 0 }; - - l_wait_event(mthread->t_ctl_waitq, - thread_is_running(athread) || - thread_is_stopped(athread) || - !thread_is_starting(mthread), - &lwi); + wait_event_idle(mthread->t_ctl_waitq, + thread_is_running(athread) || + thread_is_stopped(athread) || + !thread_is_starting(mthread)); if (unlikely(!thread_is_starting(mthread))) /* stopped by race */ rc = -ESRCH; @@ -2579,13 +2576,11 @@ int lfsck_checkpoint_generic(const struct lu_env *env, struct lfsck_assistant_data *lad = com->lc_data; struct ptlrpc_thread *mthread = &com->lc_lfsck->li_thread; struct ptlrpc_thread *athread = &lad->lad_thread; - struct l_wait_info lwi = { 0 }; - l_wait_event(mthread->t_ctl_waitq, - list_empty(&lad->lad_req_list) || - !thread_is_running(mthread) || - thread_is_stopped(athread), - &lwi); + wait_event_idle(mthread->t_ctl_waitq, + list_empty(&lad->lad_req_list) || + !thread_is_running(mthread) || + thread_is_stopped(athread)); if (!thread_is_running(mthread) || thread_is_stopped(athread)) return LFSCK_CHECKPOINT_SKIP; @@ -2599,7 +2594,6 @@ void lfsck_post_generic(const struct lu_env *env, struct lfsck_assistant_data *lad = com->lc_data; struct ptlrpc_thread *athread = &lad->lad_thread; struct ptlrpc_thread *mthread = &com->lc_lfsck->li_thread; - struct l_wait_info lwi = { 0 }; lad->lad_post_result = *result; if (*result <= 0) @@ -2610,10 +2604,9 @@ void lfsck_post_generic(const struct lu_env *env, lfsck_lfsck2name(com->lc_lfsck), lad->lad_name, *result); wake_up_all(&athread->t_ctl_waitq); - l_wait_event(mthread->t_ctl_waitq, - (*result > 0 && list_empty(&lad->lad_req_list)) || - thread_is_stopped(athread), - &lwi); + wait_event_idle(mthread->t_ctl_waitq, + (*result > 0 && list_empty(&lad->lad_req_list)) || + thread_is_stopped(athread)); if (lad->lad_assistant_status < 0) *result = lad->lad_assistant_status; @@ -2628,7 +2621,6 @@ int lfsck_double_scan_generic(const struct lu_env *env, struct lfsck_assistant_data *lad = com->lc_data; struct ptlrpc_thread *mthread = &com->lc_lfsck->li_thread; struct ptlrpc_thread *athread = &lad->lad_thread; - struct l_wait_info lwi = { 0 }; if (status != LS_SCANNING_PHASE2) set_bit(LAD_EXIT, &lad->lad_flags); @@ -2640,10 +2632,9 @@ int lfsck_double_scan_generic(const struct lu_env *env, lfsck_lfsck2name(com->lc_lfsck), lad->lad_name, status); wake_up_all(&athread->t_ctl_waitq); - l_wait_event(mthread->t_ctl_waitq, - test_bit(LAD_IN_DOUBLE_SCAN, &lad->lad_flags) || - thread_is_stopped(athread), - &lwi); + wait_event_idle(mthread->t_ctl_waitq, + test_bit(LAD_IN_DOUBLE_SCAN, &lad->lad_flags) || + thread_is_stopped(athread)); CDEBUG(D_LFSCK, "%s: the assistant has done %s double_scan, " "status %d\n", lfsck_lfsck2name(com->lc_lfsck), lad->lad_name, @@ -2661,14 +2652,12 @@ void lfsck_quit_generic(const struct lu_env *env, struct lfsck_assistant_data *lad = com->lc_data; struct ptlrpc_thread *mthread = &com->lc_lfsck->li_thread; struct ptlrpc_thread *athread = &lad->lad_thread; - struct l_wait_info lwi = { 0 }; set_bit(LAD_EXIT, &lad->lad_flags); wake_up_all(&athread->t_ctl_waitq); - l_wait_event(mthread->t_ctl_waitq, - thread_is_init(athread) || - thread_is_stopped(athread), - &lwi); + wait_event_idle(mthread->t_ctl_waitq, + thread_is_init(athread) || + thread_is_stopped(athread)); } int lfsck_load_one_trace_file(const struct lu_env *env, @@ -3107,7 +3096,6 @@ int lfsck_start(const struct lu_env *env, struct dt_device *key, struct lfsck_bookmark *bk; struct ptlrpc_thread *thread; struct lfsck_component *com; - struct l_wait_info lwi = { 0 }; struct lfsck_thread_args *lta; struct task_struct *task; struct lfsck_tgt_descs *ltds; @@ -3342,10 +3330,9 @@ trigger: GOTO(out, rc); } - 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)); if (start == NULL || !(start->ls_flags & LPF_BROADCAST)) { lfsck->li_start_unplug = 1; wake_up_all(&thread->t_ctl_waitq); @@ -3368,9 +3355,8 @@ trigger: lfsck->li_start_unplug = 1; wake_up_all(&thread->t_ctl_waitq); - l_wait_event(thread->t_ctl_waitq, - thread_is_stopped(thread), - &lwi); + wait_event_idle(thread->t_ctl_waitq, + thread_is_stopped(thread)); } } else { lfsck->li_start_unplug = 1; @@ -3394,7 +3380,6 @@ int lfsck_stop(const struct lu_env *env, struct dt_device *key, { struct lfsck_instance *lfsck; struct ptlrpc_thread *thread; - struct l_wait_info lwi = { 0 }; int rc = 0; int rc1 = 0; ENTRY; @@ -3464,9 +3449,8 @@ int lfsck_stop(const struct lu_env *env, struct dt_device *key, /* It was me set the status as 'stopping' just now, if it is not * 'stopping' now, then either stopped, or re-started by race. */ - l_wait_event(thread->t_ctl_waitq, - !thread_is_stopping(thread), - &lwi); + wait_event_idle(thread->t_ctl_waitq, + !thread_is_stopping(thread)); GOTO(put, rc = 0); diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c index 973ca5c..f5a30bd 100644 --- a/lustre/lfsck/lfsck_namespace.c +++ b/lustre/lfsck/lfsck_namespace.c @@ -4668,14 +4668,12 @@ static int lfsck_namespace_exec_dir(const struct lu_env *env, struct lfsck_bookmark *bk = &lfsck->li_bookmark_ram; struct ptlrpc_thread *mthread = &lfsck->li_thread; struct ptlrpc_thread *athread = &lad->lad_thread; - struct l_wait_info lwi = { 0 }; bool wakeup = false; - l_wait_event(mthread->t_ctl_waitq, - lad->lad_prefetched < bk->lb_async_windows || - !thread_is_running(mthread) || - !thread_is_running(athread), - &lwi); + wait_event_idle(mthread->t_ctl_waitq, + lad->lad_prefetched < bk->lb_async_windows || + !thread_is_running(mthread) || + !thread_is_running(athread)); if (unlikely(!thread_is_running(mthread) || !thread_is_running(athread))) diff --git a/lustre/llite/pcc.c b/lustre/llite/pcc.c index f5e4cae..86a74cf 100644 --- a/lustre/llite/pcc.c +++ b/lustre/llite/pcc.c @@ -2075,13 +2075,12 @@ int pcc_fault(struct vm_area_struct *vma, struct vm_fault *vmf, static void pcc_layout_wait(struct pcc_inode *pcci) { - struct l_wait_info lwi = { 0 }; while (atomic_read(&pcci->pcci_active_ios) > 0) { CDEBUG(D_CACHE, "Waiting for IO completion: %d\n", atomic_read(&pcci->pcci_active_ios)); - l_wait_event(pcci->pcci_waitq, - atomic_read(&pcci->pcci_active_ios) == 0, &lwi); + wait_event_idle(pcci->pcci_waitq, + atomic_read(&pcci->pcci_active_ios) == 0); } } diff --git a/lustre/llite/statahead.c b/lustre/llite/statahead.c index 9317eeb..9ab4854 100644 --- a/lustre/llite/statahead.c +++ b/lustre/llite/statahead.c @@ -888,7 +888,6 @@ static int ll_agl_thread(void *arg) struct ll_sb_info *sbi = ll_i2sbi(dir); struct ll_statahead_info *sai; struct ptlrpc_thread *thread; - struct l_wait_info lwi = { 0 }; ENTRY; sai = ll_sai_get(dir); @@ -909,11 +908,10 @@ static int ll_agl_thread(void *arg) wake_up(&thread->t_ctl_waitq); while (1) { - l_wait_event(thread->t_ctl_waitq, - !agl_list_empty(sai) || - !thread_is_running(thread), - &lwi); - if (!thread_is_running(thread)) + wait_event_idle(thread->t_ctl_waitq, + !agl_list_empty(sai) || + !thread_is_running(thread)); + if (!thread_is_running(thread)) break; spin_lock(&plli->lli_agl_lock); @@ -953,7 +951,6 @@ static int ll_agl_thread(void *arg) 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; ENTRY; @@ -970,9 +967,8 @@ static void ll_start_agl(struct dentry *parent, struct ll_statahead_info *sai) RETURN_EXIT; } - 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)); EXIT; } @@ -1099,12 +1095,11 @@ static int ll_statahead_thread(void *arg) /* wait for spare statahead window */ do { - l_wait_event(sa_thread->t_ctl_waitq, - !sa_sent_full(sai) || - sa_has_callback(sai) || - !agl_list_empty(sai) || - !thread_is_running(sa_thread), - &lwi); + wait_event_idle(sa_thread->t_ctl_waitq, + !sa_sent_full(sai) || + sa_has_callback(sai) || + !agl_list_empty(sai) || + !thread_is_running(sa_thread)); sa_handle_callback(sai); @@ -1159,10 +1154,9 @@ static int ll_statahead_thread(void *arg) /* statahead is finished, but statahead entries need to be cached, wait * for file release to stop me. */ while (thread_is_running(sa_thread)) { - l_wait_event(sa_thread->t_ctl_waitq, - sa_has_callback(sai) || - !thread_is_running(sa_thread), - &lwi); + wait_event_idle(sa_thread->t_ctl_waitq, + sa_has_callback(sai) || + !thread_is_running(sa_thread)); sa_handle_callback(sai); } @@ -1177,9 +1171,8 @@ out: 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); @@ -1561,7 +1554,6 @@ static int start_statahead_thread(struct inode *dir, struct dentry *dentry) struct ll_statahead_info *sai = NULL; struct dentry *parent = dentry->d_parent; struct ptlrpc_thread *thread; - struct l_wait_info lwi = { 0 }; struct task_struct *task; struct ll_sb_info *sbi = ll_i2sbi(parent->d_inode); int first = LS_FIRST_DE; @@ -1616,9 +1608,8 @@ static int start_statahead_thread(struct inode *dir, struct dentry *dentry) GOTO(out, rc); } - 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); /* diff --git a/lustre/lod/lod_dev.c b/lustre/lod/lod_dev.c index a857df1..e4bbf62 100644 --- a/lustre/lod/lod_dev.c +++ b/lustre/lod/lod_dev.c @@ -595,7 +595,6 @@ int lod_sub_init_llog(const struct lu_env *env, struct lod_device *lod, struct lod_recovery_data *lrd = NULL; struct ptlrpc_thread *thread; struct task_struct *task; - struct l_wait_info lwi = { 0 }; struct lod_tgt_desc *subtgt = NULL; u32 index; u32 master_index; @@ -660,8 +659,8 @@ int lod_sub_init_llog(const struct lu_env *env, struct lod_device *lod, GOTO(out_llog, rc); } - l_wait_event(thread->t_ctl_waitq, thread->t_flags & SVC_RUNNING || - thread->t_flags & SVC_STOPPED, &lwi); + wait_event_idle(thread->t_ctl_waitq, thread->t_flags & SVC_RUNNING || + thread->t_flags & SVC_STOPPED); RETURN(0); out_llog: diff --git a/lustre/lov/lov_object.c b/lustre/lov/lov_object.c index 846d454..64c99b3 100644 --- a/lustre/lov/lov_object.c +++ b/lustre/lov/lov_object.c @@ -1232,7 +1232,6 @@ static void lov_conf_unlock(struct lov_object *lov) static int lov_layout_wait(const struct lu_env *env, struct lov_object *lov) { - struct l_wait_info lwi = { 0 }; ENTRY; while (atomic_read(&lov->lo_active_ios) > 0) { @@ -1240,8 +1239,8 @@ static int lov_layout_wait(const struct lu_env *env, struct lov_object *lov) 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); } diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 200720c..d6fb942 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -685,9 +685,7 @@ static int mgc_requeue_thread(void *data) 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); } diff --git a/lustre/mgs/mgs_nids.c b/lustre/mgs/mgs_nids.c index b285e1f..c3b7528 100644 --- a/lustre/mgs/mgs_nids.c +++ b/lustre/mgs/mgs_nids.c @@ -434,12 +434,10 @@ static int mgs_ir_notify(void *arg) set_user_nice(current, -2); mgc_fsname2resid(fsdb->fsdb_name, &resid, CONFIG_T_RECOVER); while (1) { - struct l_wait_info lwi = { 0 }; + wait_event_idle(fsdb->fsdb_notify_waitq, + fsdb->fsdb_notify_stop || + atomic_read(&fsdb->fsdb_notify_phase)); - l_wait_event(fsdb->fsdb_notify_waitq, - fsdb->fsdb_notify_stop || - atomic_read(&fsdb->fsdb_notify_phase), - &lwi); if (fsdb->fsdb_notify_stop) break; diff --git a/lustre/obdclass/cl_io.c b/lustre/obdclass/cl_io.c index 661b26e..c4a0fd7 100644 --- a/lustre/obdclass/cl_io.c +++ b/lustre/obdclass/cl_io.c @@ -1155,10 +1155,8 @@ int cl_sync_io_wait(const struct lu_env *env, struct cl_sync_io *anchor, 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; } diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index e622041..729cdd0 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -2311,7 +2311,6 @@ static inline bool obd_skip_mod_rpc_slot(const struct lookup_intent *it) __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; @@ -2355,9 +2354,9 @@ __u16 obd_get_mod_rpc_slot(struct client_obd *cli, __u32 opc, "opc %u, max %hu\n", cli->cl_import->imp_obd->obd_name, opc, max); - l_wait_event_exclusive(cli->cl_mod_rpcs_waitq, - obd_mod_rpc_slot_avail(cli, close_req), - &lwi); + wait_event_idle_exclusive(cli->cl_mod_rpcs_waitq, + obd_mod_rpc_slot_avail(cli, + close_req)); } while (true); } EXPORT_SYMBOL(obd_get_mod_rpc_slot); diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index b6279f0..980aacc 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -728,7 +728,6 @@ struct lu_object *lu_object_find_at(const struct lu_env *env, struct cfs_hash *hs; struct cfs_hash_bd bd; struct lu_site_bkt_data *bkt; - struct l_wait_info lwi = { 0 }; __u64 version = 0; int rc; @@ -769,9 +768,9 @@ struct lu_object *lu_object_find_at(const struct lu_env *env, if (likely(lu_object_is_inited(o->lo_header))) RETURN(o); - l_wait_event(bkt->lsb_waitq, - lu_object_is_inited(o->lo_header) || - lu_object_is_dying(o->lo_header), &lwi); + wait_event_idle(bkt->lsb_waitq, + lu_object_is_inited(o->lo_header) || + lu_object_is_dying(o->lo_header)); if (lu_object_is_dying(o->lo_header)) { lu_object_put(env, o); @@ -832,9 +831,9 @@ struct lu_object *lu_object_find_at(const struct lu_env *env, if (!(conf && conf->loc_flags & LOC_F_NEW) && !lu_object_is_inited(shadow->lo_header)) { - l_wait_event(bkt->lsb_waitq, - lu_object_is_inited(shadow->lo_header) || - lu_object_is_dying(shadow->lo_header), &lwi); + wait_event_idle(bkt->lsb_waitq, + lu_object_is_inited(shadow->lo_header) || + lu_object_is_dying(shadow->lo_header)); if (lu_object_is_dying(shadow->lo_header)) { lu_object_put(env, shadow); diff --git a/lustre/obdclass/scrub.c b/lustre/obdclass/scrub.c index c828bb6..eee95c6 100644 --- a/lustre/obdclass/scrub.c +++ b/lustre/obdclass/scrub.c @@ -275,7 +275,6 @@ int scrub_start(int (*threadfn)(void *data), struct lustre_scrub *scrub, void *data, __u32 flags) { struct ptlrpc_thread *thread = &scrub->os_thread; - struct l_wait_info lwi = { 0 }; struct task_struct *task; int rc; ENTRY; @@ -290,9 +289,8 @@ again: if (unlikely(thread_is_stopping(thread))) { spin_unlock(&scrub->os_lock); - l_wait_event(thread->t_ctl_waitq, - thread_is_stopped(thread), - &lwi); + wait_event_idle(thread->t_ctl_waitq, + thread_is_stopped(thread)); goto again; } spin_unlock(&scrub->os_lock); @@ -317,9 +315,8 @@ again: RETURN(rc); } - 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)); RETURN(0); } @@ -328,7 +325,6 @@ EXPORT_SYMBOL(scrub_start); void scrub_stop(struct lustre_scrub *scrub) { struct ptlrpc_thread *thread = &scrub->os_thread; - struct l_wait_info lwi = { 0 }; /* os_lock: sync status between stop and scrub thread */ spin_lock(&scrub->os_lock); @@ -336,9 +332,8 @@ void scrub_stop(struct lustre_scrub *scrub) thread_set_flags(thread, SVC_STOPPING); spin_unlock(&scrub->os_lock); wake_up_all(&thread->t_ctl_waitq); - l_wait_event(thread->t_ctl_waitq, - thread_is_stopped(thread), - &lwi); + wait_event_idle(thread->t_ctl_waitq, + thread_is_stopped(thread)); /* Do not skip the last lock/unlock, which can guarantee that * the caller cannot return until the OI scrub thread exit. */ spin_lock(&scrub->os_lock); diff --git a/lustre/ofd/ofd_io.c b/lustre/ofd/ofd_io.c index a5d49e1..b17014a 100644 --- a/lustre/ofd/ofd_io.c +++ b/lustre/ofd/ofd_io.c @@ -165,7 +165,6 @@ static int ofd_inconsistency_verification_main(void *args) struct ptlrpc_thread *thread = &ofd->ofd_inconsistency_thread; struct ofd_inconsistency_item *oii; struct lfsck_req_local *lrl = NULL; - struct l_wait_info lwi = { 0 }; int rc; ENTRY; @@ -200,10 +199,9 @@ static int ofd_inconsistency_verification_main(void *args) } spin_unlock(&ofd->ofd_inconsistency_lock); - l_wait_event(thread->t_ctl_waitq, - !list_empty(&ofd->ofd_inconsistency_list) || - !thread_is_running(thread), - &lwi); + wait_event_idle(thread->t_ctl_waitq, + !list_empty(&ofd->ofd_inconsistency_list) || + !thread_is_running(thread)); spin_lock(&ofd->ofd_inconsistency_lock); } @@ -254,7 +252,6 @@ out: int ofd_start_inconsistency_verification_thread(struct ofd_device *ofd) { struct ptlrpc_thread *thread = &ofd->ofd_inconsistency_thread; - struct l_wait_info lwi = { 0 }; struct task_struct *task; int rc; @@ -275,10 +272,9 @@ int ofd_start_inconsistency_verification_thread(struct ofd_device *ofd) ofd_name(ofd), rc); } else { rc = 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)); } return rc; @@ -295,7 +291,6 @@ int ofd_start_inconsistency_verification_thread(struct ofd_device *ofd) int ofd_stop_inconsistency_verification_thread(struct ofd_device *ofd) { struct ptlrpc_thread *thread = &ofd->ofd_inconsistency_thread; - struct l_wait_info lwi = { 0 }; spin_lock(&ofd->ofd_inconsistency_lock); if (thread_is_init(thread) || thread_is_stopped(thread)) { @@ -307,9 +302,8 @@ int ofd_stop_inconsistency_verification_thread(struct ofd_device *ofd) thread_set_flags(thread, SVC_STOPPING); spin_unlock(&ofd->ofd_inconsistency_lock); wake_up_all(&thread->t_ctl_waitq); - l_wait_event(thread->t_ctl_waitq, - thread_is_stopped(thread), - &lwi); + wait_event_idle(thread->t_ctl_waitq, + thread_is_stopped(thread)); return 0; } diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 665a63a..460587c 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -961,9 +961,8 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext, "%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; diff --git a/lustre/osc/osc_object.c b/lustre/osc/osc_object.c index a99747c..d12b42e 100644 --- a/lustre/osc/osc_object.c +++ b/lustre/osc/osc_object.c @@ -476,13 +476,12 @@ struct lu_object *osc_object_alloc(const struct lu_env *env, int osc_object_invalidate(const struct lu_env *env, struct osc_object *osc) { - struct l_wait_info lwi = { 0 }; ENTRY; 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) == 0, &lwi); + wait_event_idle(osc->oo_io_waitq, atomic_read(&osc->oo_nr_ios) == 0); /* Discard all dirty pages of this object. */ osc_cache_truncate_start(env, osc, 0, NULL); diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c index 9166eda..f6d7e4a 100644 --- a/lustre/osd-ldiskfs/osd_scrub.c +++ b/lustre/osd-ldiskfs/osd_scrub.c @@ -882,7 +882,6 @@ static int osd_scrub_exec(struct osd_thread_info *info, struct osd_device *dev, struct osd_iit_param *param, struct osd_idmap_cache *oic, bool *noslot, int rc) { - struct l_wait_info lwi = { 0 }; struct lustre_scrub *scrub = &dev->od_scrub.os_scrub; struct scrub_file *sf = &scrub->os_file; struct ptlrpc_thread *thread = &scrub->os_thread; @@ -937,8 +936,8 @@ wait: } if (it != NULL) - l_wait_event(thread->t_ctl_waitq, osd_scrub_wakeup(scrub, it), - &lwi); + wait_event_idle(thread->t_ctl_waitq, + osd_scrub_wakeup(scrub, it)); if (!ooc || osd_scrub_has_window(scrub, ooc)) *noslot = false; @@ -1042,7 +1041,6 @@ static int osd_inode_iteration(struct osd_thread_info *info, __u64 *pos; __u64 *count; struct osd_iit_param *param; - struct l_wait_info lwi = { 0 }; __u32 limit; int rc; bool noslot = true; @@ -1105,12 +1103,12 @@ wait: sf->sf_flags &= ~(SF_RECREATED | SF_INCONSISTENT | SF_UPGRADE | SF_AUTO); sf->sf_status = SS_COMPLETED; - l_wait_event(thread->t_ctl_waitq, - !thread_is_running(thread) || - !scrub->os_partial_scan || - scrub->os_in_join || - !list_empty(&scrub->os_inconsistent_items), - &lwi); + wait_event_idle( + thread->t_ctl_waitq, + !thread_is_running(thread) || + !scrub->os_partial_scan || + scrub->os_in_join || + !list_empty(&scrub->os_inconsistent_items)); sf->sf_flags = saved_flags; sf->sf_status = SS_SCANNING; @@ -1132,9 +1130,9 @@ wait: full: if (!preload) { - l_wait_event(thread->t_ctl_waitq, - !thread_is_running(thread) || !scrub->os_in_join, - &lwi); + wait_event_idle(thread->t_ctl_waitq, + !thread_is_running(thread) || + !scrub->os_in_join); if (unlikely(!thread_is_running(thread))) RETURN(0); @@ -1288,13 +1286,12 @@ static int osd_scrub_main(void *args) } if (!scrub->os_full_speed && !scrub->os_partial_scan) { - struct l_wait_info lwi = { 0 }; struct osd_otable_it *it = dev->od_otable_it; struct osd_otable_cache *ooc = &it->ooi_cache; - l_wait_event(thread->t_ctl_waitq, - it->ooi_user_ready || !thread_is_running(thread), - &lwi); + wait_event_idle(thread->t_ctl_waitq, + it->ooi_user_ready || + !thread_is_running(thread)); if (unlikely(!thread_is_running(thread))) GOTO(post, rc = 0); @@ -2871,7 +2868,6 @@ static int osd_otable_it_next(const struct lu_env *env, struct dt_it *di) struct lustre_scrub *scrub = &dev->od_scrub.os_scrub; struct osd_otable_cache *ooc = &it->ooi_cache; struct ptlrpc_thread *thread = &scrub->os_thread; - struct l_wait_info lwi = { 0 }; int rc; ENTRY; @@ -2889,9 +2885,8 @@ again: } if (it->ooi_all_cached) { - l_wait_event(thread->t_ctl_waitq, - !thread_is_running(thread), - &lwi); + wait_event_idle(thread->t_ctl_waitq, + !thread_is_running(thread)); RETURN(1); } @@ -2903,9 +2898,8 @@ again: } if (it->ooi_cache.ooc_pos_preload >= scrub->os_pos_current) - l_wait_event(thread->t_ctl_waitq, - osd_otable_it_wakeup(scrub, it), - &lwi); + wait_event_idle(thread->t_ctl_waitq, + osd_otable_it_wakeup(scrub, it)); if (!thread_is_running(thread) && !it->ooi_used_outside) RETURN(1); diff --git a/lustre/osd-zfs/osd_scrub.c b/lustre/osd-zfs/osd_scrub.c index 8758ebd..5b6f3a0 100644 --- a/lustre/osd-zfs/osd_scrub.c +++ b/lustre/osd-zfs/osd_scrub.c @@ -470,12 +470,9 @@ again: spin_unlock(&scrub->os_lock); } - if (!scrub->os_full_speed && !osd_scrub_has_window(it)) { - memset(&lwi, 0, sizeof(lwi)); - l_wait_event(thread->t_ctl_waitq, - osd_scrub_wakeup(scrub, it), - &lwi); - } + if (!scrub->os_full_speed && !osd_scrub_has_window(it)) + wait_event_idle(thread->t_ctl_waitq, + osd_scrub_wakeup(scrub, it)); if (unlikely(!thread_is_running(thread))) GOTO(out, rc = SCRUB_NEXT_EXIT); @@ -585,12 +582,12 @@ static int osd_scrub_main(void *args) } if (!scrub->os_full_speed) { - struct l_wait_info lwi = { 0 }; struct osd_otable_it *it = dev->od_otable_it; - l_wait_event(thread->t_ctl_waitq, - it->ooi_user_ready || !thread_is_running(thread), - &lwi); + wait_event_idle(thread->t_ctl_waitq, + it->ooi_user_ready || + !thread_is_running(thread)); + if (unlikely(!thread_is_running(thread))) GOTO(post, rc = 0); @@ -1682,7 +1679,6 @@ static int osd_otable_it_next(const struct lu_env *env, struct dt_it *di) struct osd_device *dev = it->ooi_dev; struct lustre_scrub *scrub = &dev->od_scrub; struct ptlrpc_thread *thread = &scrub->os_thread; - struct l_wait_info lwi = { 0 }; struct lustre_mdt_attrs *lma = NULL; nvlist_t *nvbuf = NULL; int size = 0; @@ -1704,9 +1700,8 @@ again: } if (it->ooi_pos >= scrub->os_pos_current) - l_wait_event(thread->t_ctl_waitq, - osd_otable_it_wakeup(scrub, it), - &lwi); + wait_event_idle(thread->t_ctl_waitq, + osd_otable_it_wakeup(scrub, it)); if (!thread_is_running(thread) && !it->ooi_used_outside) GOTO(out, rc = 1); diff --git a/lustre/osp/lwp_dev.c b/lustre/osp/lwp_dev.c index 829555e..b94ec53 100644 --- a/lustre/osp/lwp_dev.c +++ b/lustre/osp/lwp_dev.c @@ -369,13 +369,10 @@ static struct lu_device *lwp_device_fini(const struct lu_env *env, { struct lwp_device *m = lu2lwp_dev(ludev); struct ptlrpc_thread *thread = &m->lpd_notify_thread; - struct l_wait_info lwi = { 0 }; int rc; ENTRY; - if (!thread_is_stopped(thread)) - l_wait_event(thread->t_ctl_waitq, thread_is_stopped(thread), - &lwi); + wait_event_idle(thread->t_ctl_waitq, thread_is_stopped(thread)); if (m->lpd_exp != NULL) class_disconnect(m->lpd_exp); @@ -437,7 +434,6 @@ static void lwp_notify_users(struct obd_export *exp) struct lwp_device *lwp; struct ptlrpc_thread *thread; struct task_struct *task; - struct l_wait_info lwi = { 0 }; char name[MTI_NAME_MAXLEN]; LASSERT(exp != NULL); @@ -461,9 +457,8 @@ static void lwp_notify_users(struct obd_export *exp) name, PTR_ERR(task)); } - 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)); } /** diff --git a/lustre/osp/osp_dev.c b/lustre/osp/osp_dev.c index 7dc44aa..4b94888 100644 --- a/lustre/osp/osp_dev.c +++ b/lustre/osp/osp_dev.c @@ -501,7 +501,6 @@ static int osp_disconnect(struct osp_device *d) */ static int osp_update_init(struct osp_device *osp) { - struct l_wait_info lwi = { 0 }; struct task_struct *task; ENTRY; @@ -536,9 +535,9 @@ static int osp_update_init(struct osp_device *osp) RETURN(rc); } - l_wait_event(osp->opd_update_thread.t_ctl_waitq, - osp_send_update_thread_running(osp) || - osp_send_update_thread_stopped(osp), &lwi); + wait_event_idle(osp->opd_update_thread.t_ctl_waitq, + osp_send_update_thread_running(osp) || + osp_send_update_thread_stopped(osp)); RETURN(0); } diff --git a/lustre/osp/osp_precreate.c b/lustre/osp/osp_precreate.c index a9ab53c..bf6c462 100644 --- a/lustre/osp/osp_precreate.c +++ b/lustre/osp/osp_precreate.c @@ -839,7 +839,6 @@ static int osp_precreate_cleanup_orphans(struct lu_env *env, struct ptlrpc_request *req = NULL; struct obd_import *imp; struct ost_body *body; - struct l_wait_info lwi = { 0 }; int update_status = 0; int rc; int diff; @@ -864,10 +863,9 @@ static int osp_precreate_cleanup_orphans(struct lu_env *env, * catch all osp_precreate_reserve() calls who find * "!opd_pre_recovering". */ - l_wait_event(d->opd_pre_waitq, - (!d->opd_pre_reserved && d->opd_recovery_completed) || - !osp_precreate_running(d) || d->opd_got_disconnected, - &lwi); + wait_event_idle(d->opd_pre_waitq, + (!d->opd_pre_reserved && d->opd_recovery_completed) || + !osp_precreate_running(d) || d->opd_got_disconnected); if (!osp_precreate_running(d) || d->opd_got_disconnected) GOTO(out, rc = -EAGAIN); @@ -1202,7 +1200,6 @@ static int osp_precreate_thread(void *_arg) { struct osp_device *d = _arg; struct ptlrpc_thread *thread = &d->opd_pre_thread; - struct l_wait_info lwi = { 0 }; struct l_wait_info lwi2 = LWI_TIMEOUT(cfs_time_seconds(5), back_to_sleep, NULL); struct lu_env env; @@ -1237,10 +1234,9 @@ static int osp_precreate_thread(void *_arg) d->opd_imp_connected && !d->opd_got_disconnected) break; - l_wait_event(d->opd_pre_waitq, - !osp_precreate_running(d) || - d->opd_new_connection, - &lwi); + wait_event_idle(d->opd_pre_waitq, + !osp_precreate_running(d) || + d->opd_new_connection); if (!d->opd_new_connection) continue; @@ -1291,11 +1287,11 @@ static int osp_precreate_thread(void *_arg) * connected, can handle precreates now */ while (osp_precreate_running(d)) { - l_wait_event(d->opd_pre_waitq, - !osp_precreate_running(d) || - osp_precreate_near_empty(&env, d) || - osp_statfs_need_update(d) || - d->opd_got_disconnected, &lwi); + wait_event_idle(d->opd_pre_waitq, + !osp_precreate_running(d) || + osp_precreate_near_empty(&env, d) || + osp_statfs_need_update(d) || + d->opd_got_disconnected); if (!osp_precreate_running(d)) break; @@ -1771,7 +1767,6 @@ void osp_precreate_fini(struct osp_device *d) int osp_init_statfs(struct osp_device *d) { - struct l_wait_info lwi = { 0 }; struct task_struct *task; ENTRY; @@ -1806,9 +1801,9 @@ int osp_init_statfs(struct osp_device *d) RETURN(PTR_ERR(task)); } - l_wait_event(d->opd_pre_thread.t_ctl_waitq, - osp_precreate_running(d) || osp_precreate_stopped(d), - &lwi); + wait_event_idle(d->opd_pre_thread.t_ctl_waitq, + osp_precreate_running(d) || osp_precreate_stopped(d)); + RETURN(0); } diff --git a/lustre/osp/osp_sync.c b/lustre/osp/osp_sync.c index 0961685..f5e18f6 100644 --- a/lustre/osp/osp_sync.c +++ b/lustre/osp/osp_sync.c @@ -1152,8 +1152,6 @@ static int osp_sync_process_queues(const struct lu_env *env, struct osp_device *d = data; do { - struct l_wait_info lwi = { 0 }; - if (!osp_sync_running(d)) { CDEBUG(D_HA, "stop llog processing\n"); return LLOG_PROC_BREAK; @@ -1179,11 +1177,10 @@ static int osp_sync_process_queues(const struct lu_env *env, rec = NULL; } - l_wait_event(d->opd_sync_waitq, - !osp_sync_running(d) || - osp_sync_can_process_new(d, rec) || - !list_empty(&d->opd_sync_committed_there), - &lwi); + wait_event_idle(d->opd_sync_waitq, + !osp_sync_running(d) || + osp_sync_can_process_new(d, rec) || + !list_empty(&d->opd_sync_committed_there)); } while (1); } @@ -1511,7 +1508,6 @@ static void osp_sync_llog_fini(const struct lu_env *env, struct osp_device *d) */ int osp_sync_init(const struct lu_env *env, struct osp_device *d) { - struct l_wait_info lwi = { 0 }; struct task_struct *task; int rc; @@ -1552,8 +1548,8 @@ int osp_sync_init(const struct lu_env *env, struct osp_device *d) GOTO(err_llog, rc); } - l_wait_event(d->opd_sync_thread.t_ctl_waitq, - osp_sync_running(d) || osp_sync_stopped(d), &lwi); + wait_event_idle(d->opd_sync_thread.t_ctl_waitq, + osp_sync_running(d) || osp_sync_stopped(d)); RETURN(0); err_llog: diff --git a/lustre/osp/osp_trans.c b/lustre/osp/osp_trans.c index 90b9e47..0ad2099 100644 --- a/lustre/osp/osp_trans.c +++ b/lustre/osp/osp_trans.c @@ -1432,7 +1432,6 @@ int osp_send_update_thread(void *arg) { struct lu_env env; struct osp_device *osp = arg; - struct l_wait_info lwi = { 0 }; struct osp_updates *ou = osp->opd_update; struct ptlrpc_thread *thread = &osp->opd_update_thread; struct osp_update_request *our = NULL; @@ -1451,9 +1450,9 @@ int osp_send_update_thread(void *arg) wake_up(&thread->t_ctl_waitq); while (1) { our = NULL; - l_wait_event(ou->ou_waitq, - !osp_send_update_thread_running(osp) || - osp_get_next_request(ou, &our), &lwi); + wait_event_idle(ou->ou_waitq, + !osp_send_update_thread_running(osp) || + osp_get_next_request(ou, &our)); if (!osp_send_update_thread_running(osp)) { if (our != NULL) { diff --git a/lustre/ptlrpc/pinger.c b/lustre/ptlrpc/pinger.c index ae402dd..d7ef560 100644 --- a/lustre/ptlrpc/pinger.c +++ b/lustre/ptlrpc/pinger.c @@ -581,7 +581,6 @@ static int ping_evictor_main(void *arg) { struct obd_device *obd; struct obd_export *exp; - struct l_wait_info lwi = { 0 }; time64_t expire_time; ENTRY; @@ -590,8 +589,9 @@ static int ping_evictor_main(void *arg) CDEBUG(D_HA, "Starting Ping Evictor\n"); pet_state = PET_READY; while (1) { - l_wait_event(pet_waitq, (!list_empty(&pet_list)) || - (pet_state == PET_TERMINATE), &lwi); + wait_event_idle(pet_waitq, + (!list_empty(&pet_list)) || + (pet_state == PET_TERMINATE)); /* loop until all obd's will be removed */ if ((pet_state == PET_TERMINATE) && list_empty(&pet_list)) diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 987982a..eb6057e 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -3075,7 +3075,6 @@ static int ptlrpc_start_hr_threads(void) static void ptlrpc_svcpt_stop_threads(struct ptlrpc_service_part *svcpt) { - struct l_wait_info lwi = { 0 }; struct ptlrpc_thread *thread; struct list_head zombie; @@ -3103,8 +3102,8 @@ static void ptlrpc_svcpt_stop_threads(struct ptlrpc_service_part *svcpt) 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); } @@ -3172,7 +3171,6 @@ int ptlrpc_start_threads(struct ptlrpc_service *svc) 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; @@ -3272,9 +3270,8 @@ int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait) 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); diff --git a/lustre/quota/qmt_lock.c b/lustre/quota/qmt_lock.c index 80fb2f5..a025925 100644 --- a/lustre/quota/qmt_lock.c +++ b/lustre/quota/qmt_lock.c @@ -746,7 +746,6 @@ static int qmt_reba_thread(void *arg) { struct qmt_device *qmt = (struct qmt_device *)arg; struct ptlrpc_thread *thread = &qmt->qmt_reba_thread; - struct l_wait_info lwi = { 0 }; struct lu_env *env; struct lquota_entry *lqe, *tmp; int rc; @@ -771,9 +770,9 @@ static int qmt_reba_thread(void *arg) wake_up(&thread->t_ctl_waitq); while (1) { - l_wait_event(thread->t_ctl_waitq, - !list_empty(&qmt->qmt_reba_list) || - !thread_is_running(thread), &lwi); + wait_event_idle(thread->t_ctl_waitq, + !list_empty(&qmt->qmt_reba_list) || + !thread_is_running(thread)); spin_lock(&qmt->qmt_reba_lock); list_for_each_entry_safe(lqe, tmp, &qmt->qmt_reba_list, @@ -808,7 +807,6 @@ out_env: int qmt_start_reba_thread(struct qmt_device *qmt) { struct ptlrpc_thread *thread = &qmt->qmt_reba_thread; - struct l_wait_info lwi = { 0 }; struct task_struct *task; ENTRY; @@ -821,9 +819,8 @@ int qmt_start_reba_thread(struct qmt_device *qmt) RETURN(PTR_ERR(task)); } - 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)); RETURN(0); } @@ -836,13 +833,11 @@ void qmt_stop_reba_thread(struct qmt_device *qmt) struct ptlrpc_thread *thread = &qmt->qmt_reba_thread; if (!thread_is_stopped(thread)) { - struct l_wait_info lwi = { 0 }; thread_set_flags(thread, SVC_STOPPING); wake_up(&thread->t_ctl_waitq); - l_wait_event(thread->t_ctl_waitq, thread_is_stopped(thread), - &lwi); + wait_event_idle(thread->t_ctl_waitq, thread_is_stopped(thread)); } LASSERT(list_empty(&qmt->qmt_reba_list)); } diff --git a/lustre/quota/qsd_reint.c b/lustre/quota/qsd_reint.c index fb90ca1..4e5a4ad 100644 --- a/lustre/quota/qsd_reint.c +++ b/lustre/quota/qsd_reint.c @@ -419,7 +419,6 @@ static int qsd_reint_main(void *args) struct qsd_qtype_info *qqi = (struct qsd_qtype_info *)args; struct qsd_instance *qsd = qqi->qqi_qsd; struct ptlrpc_thread *thread = &qqi->qqi_reint_thread; - struct l_wait_info lwi = { 0 }; int rc; ENTRY; @@ -443,8 +442,8 @@ static int qsd_reint_main(void *args) qti = qsd_info(env); /* wait for the connection to master established */ - l_wait_event(thread->t_ctl_waitq, - qsd_connected(qsd) || !thread_is_running(thread), &lwi); + wait_event_idle(thread->t_ctl_waitq, + qsd_connected(qsd) || !thread_is_running(thread)); /* Step 1: enqueue global index lock */ if (!thread_is_running(thread)) @@ -516,8 +515,8 @@ static int qsd_reint_main(void *args) } /* wait for the qsd instance started (target recovery done) */ - l_wait_event(thread->t_ctl_waitq, - qsd_started(qsd) || !thread_is_running(thread), &lwi); + wait_event_idle(thread->t_ctl_waitq, + qsd_started(qsd) || !thread_is_running(thread)); if (!thread_is_running(thread)) GOTO(out_lock, rc = 0); @@ -552,14 +551,13 @@ out: void qsd_stop_reint_thread(struct qsd_qtype_info *qqi) { struct ptlrpc_thread *thread = &qqi->qqi_reint_thread; - struct l_wait_info lwi = { 0 }; if (!thread_is_stopped(thread)) { thread_set_flags(thread, SVC_STOPPING); wake_up(&thread->t_ctl_waitq); - l_wait_event(thread->t_ctl_waitq, - thread_is_stopped(thread), &lwi); + wait_event_idle(thread->t_ctl_waitq, + thread_is_stopped(thread)); } } @@ -633,7 +631,6 @@ int qsd_start_reint_thread(struct qsd_qtype_info *qqi) { struct ptlrpc_thread *thread = &qqi->qqi_reint_thread; struct qsd_instance *qsd = qqi->qqi_qsd; - struct l_wait_info lwi = { 0 }; struct task_struct *task; int rc; char *name; @@ -695,8 +692,7 @@ int qsd_start_reint_thread(struct qsd_qtype_info *qqi) RETURN(rc); } - 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)); RETURN(0); } diff --git a/lustre/quota/qsd_writeback.c b/lustre/quota/qsd_writeback.c index 3c4f0fd..048fbd7 100644 --- a/lustre/quota/qsd_writeback.c +++ b/lustre/quota/qsd_writeback.c @@ -516,7 +516,6 @@ static int qsd_upd_thread(void *arg) int qsd_start_upd_thread(struct qsd_instance *qsd) { struct ptlrpc_thread *thread = &qsd->qsd_upd_thread; - struct l_wait_info lwi = { 0 }; struct task_struct *task; ENTRY; @@ -529,9 +528,8 @@ int qsd_start_upd_thread(struct qsd_instance *qsd) RETURN(PTR_ERR(task)); } - 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)); RETURN(0); } @@ -586,14 +584,12 @@ static void qsd_cleanup_adjust(struct qsd_instance *qsd) void qsd_stop_upd_thread(struct qsd_instance *qsd) { struct ptlrpc_thread *thread = &qsd->qsd_upd_thread; - struct l_wait_info lwi = { 0 }; if (!thread_is_stopped(thread)) { thread_set_flags(thread, SVC_STOPPING); wake_up(&thread->t_ctl_waitq); - l_wait_event(thread->t_ctl_waitq, thread_is_stopped(thread), - &lwi); + wait_event_idle(thread->t_ctl_waitq, thread_is_stopped(thread)); } qsd_cleanup_deferred(qsd); qsd_cleanup_adjust(qsd); diff --git a/lustre/target/tgt_handler.c b/lustre/target/tgt_handler.c index 3f51caa..05998d2 100644 --- a/lustre/target/tgt_handler.c +++ b/lustre/target/tgt_handler.c @@ -714,12 +714,9 @@ int tgt_request_handle(struct ptlrpc_request *req) if (cfs_fail_val == 0 && lustre_msg_get_opc(msg) != OBD_PING && lustre_msg_get_flags(msg) & MSG_REQ_REPLAY_DONE) { - struct l_wait_info lwi = { 0 }; - cfs_fail_val = 1; cfs_race_state = 0; - l_wait_event(cfs_race_waitq, (cfs_race_state == 1), - &lwi); + wait_event_idle(cfs_race_waitq, (cfs_race_state == 1)); } } @@ -2164,7 +2161,6 @@ int tgt_brw_read(struct tgt_session_info *tsi) struct niobuf_local *local_nb; struct obd_ioobj *ioo; struct ost_body *body, *repbody; - struct l_wait_info lwi; struct lustre_handle lockh = { 0 }; int npages, nob = 0, rc, i, no_reply = 0, npages_read; @@ -2194,10 +2190,9 @@ int tgt_brw_read(struct tgt_session_info *tsi) * finish */ if (unlikely(atomic_read(&exp->exp_obd->obd_evict_inprogress))) { /* We do not care how long it takes */ - lwi = LWI_INTR(NULL, NULL); - rc = l_wait_event(exp->exp_obd->obd_evict_inprogress_waitq, - !atomic_read(&exp->exp_obd->obd_evict_inprogress), - &lwi); + wait_event_idle( + exp->exp_obd->obd_evict_inprogress_waitq, + !atomic_read(&exp->exp_obd->obd_evict_inprogress)); } /* There must be big cache in current thread to process this request diff --git a/lustre/target/update_trans.c b/lustre/target/update_trans.c index b8150fa..872b86e 100644 --- a/lustre/target/update_trans.c +++ b/lustre/target/update_trans.c @@ -910,10 +910,8 @@ static bool top_trans_is_stopped(struct top_thandle *top_th) */ static int top_trans_wait_result(struct top_thandle *top_th) { - struct l_wait_info lwi = {0}; - - l_wait_event(top_th->tt_multiple_thandle->tmt_stop_waitq, - top_trans_is_stopped(top_th), &lwi); + wait_event_idle(top_th->tt_multiple_thandle->tmt_stop_waitq, + top_trans_is_stopped(top_th)); RETURN(top_th->tt_super.th_result); } @@ -1554,7 +1552,6 @@ static int distribute_txn_commit_thread(void *_arg) struct target_distribute_txn_data *tdtd = _arg; struct lu_target *lut = tdtd->tdtd_lut; struct ptlrpc_thread *thread = &lut->lut_tdtd_commit_thread; - struct l_wait_info lwi = { 0 }; struct lu_env env; struct list_head list; int rc; @@ -1645,14 +1642,14 @@ static int distribute_txn_commit_thread(void *_arg) top_multiple_thandle_put(tmt); } - l_wait_event(tdtd->tdtd_commit_thread_waitq, - !distribute_txn_commit_thread_running(lut) || - committed < tdtd->tdtd_committed_batchid || - tdtd_ready_for_cancel_log(tdtd), &lwi); + wait_event_idle(tdtd->tdtd_commit_thread_waitq, + !distribute_txn_commit_thread_running(lut) || + committed < tdtd->tdtd_committed_batchid || + tdtd_ready_for_cancel_log(tdtd)); }; - l_wait_event(tdtd->tdtd_commit_thread_waitq, - atomic_read(&tdtd->tdtd_refcount) == 0, &lwi); + wait_event_idle(tdtd->tdtd_commit_thread_waitq, + atomic_read(&tdtd->tdtd_refcount) == 0); spin_lock(&tdtd->tdtd_batchid_lock); list_for_each_entry_safe(tmt, tmp, &tdtd->tdtd_list, @@ -1692,7 +1689,6 @@ int distribute_txn_init(const struct lu_env *env, __u32 index) { struct task_struct *task; - struct l_wait_info lwi = { 0 }; int rc; ENTRY; @@ -1725,9 +1721,9 @@ int distribute_txn_init(const struct lu_env *env, if (IS_ERR(task)) RETURN(PTR_ERR(task)); - l_wait_event(lut->lut_tdtd_commit_thread.t_ctl_waitq, - distribute_txn_commit_thread_running(lut) || - distribute_txn_commit_thread_stopped(lut), &lwi); + wait_event_idle(lut->lut_tdtd_commit_thread.t_ctl_waitq, + distribute_txn_commit_thread_running(lut) || + distribute_txn_commit_thread_stopped(lut)); RETURN(0); } EXPORT_SYMBOL(distribute_txn_init);