From 40a00c3d2962a241de7093c9680bba9ee5e0bae1 Mon Sep 17 00:00:00 2001 From: huanghua Date: Thu, 20 Sep 2007 07:06:27 +0000 Subject: [PATCH] Branch b1_6 b=11401 i=shadow i=tappro - use cfs_* macros and functions instead of linux primitives (a=12609) - cast fixing (a=12706) --- lustre/include/lustre_mds.h | 2 +- lustre/llite/statahead.c | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/lustre/include/lustre_mds.h b/lustre/include/lustre_mds.h index 0759c5f..268d98e 100644 --- a/lustre/include/lustre_mds.h +++ b/lustre/include/lustre_mds.h @@ -242,7 +242,7 @@ struct md_enqueue_info { struct lustre_handle mi_lockh; struct dentry *mi_dentry; md_enqueue_cb_t mi_cb; - void *mi_cbdata; + int mi_cbdata; }; struct mdc_enqueue_args { diff --git a/lustre/llite/statahead.c b/lustre/llite/statahead.c index 67af5aa..1b41f97 100644 --- a/lustre/llite/statahead.c +++ b/lustre/llite/statahead.c @@ -54,8 +54,8 @@ static struct ll_statahead_info *ll_sai_alloc(void) return NULL; sai->sai_max = LL_STATAHEAD_MIN; - init_waitqueue_head(&sai->sai_thread.t_ctl_waitq); - INIT_LIST_HEAD(&sai->sai_entries); + cfs_waitq_init(&sai->sai_thread.t_ctl_waitq); + CFS_INIT_LIST_HEAD(&sai->sai_entries); atomic_set(&sai->sai_refc, 1); return sai; } @@ -252,9 +252,9 @@ out: sai = lli->lli_sai; if (sai) { lli->lli_sai->sai_replied++; - ll_sai_entry_set(lli->lli_sai, (int)minfo->mi_cbdata, + ll_sai_entry_set(lli->lli_sai, minfo->mi_cbdata, SA_ENTRY_STATED); - wake_up(&lli->lli_sai->sai_thread.t_ctl_waitq); + cfs_waitq_signal(&lli->lli_sai->sai_thread.t_ctl_waitq); } spin_unlock(&lli->lli_lock); ll_intent_release(it); @@ -294,7 +294,7 @@ static int sa_args_prep(struct inode *dir, struct dentry *dentry, minfo->mi_it.it_op = IT_GETATTR; minfo->mi_dentry = dentry; minfo->mi_cb = ll_statahead_interpret; - minfo->mi_cbdata = (void *)lli->lli_sai->sai_sent; + minfo->mi_cbdata = lli->lli_sai->sai_sent; einfo->ei_type = LDLM_IBITS; einfo->ei_mode = it_to_lock_mode(&minfo->mi_it); @@ -360,7 +360,7 @@ static int do_sa_revalidate(struct dentry *dentry) if (rc == 1) { ll_intent_release(&it); lli->lli_sai->sai_cached++; - wake_up(&lli->lli_sai->sai_thread.t_ctl_waitq); + cfs_waitq_signal(&lli->lli_sai->sai_thread.t_ctl_waitq); RETURN(1); } @@ -446,7 +446,7 @@ out: CDEBUG(D_READA, "set sai entry %p index %d stat %d, rc %d\n", se, se->se_index, se->se_stat, rc); se->se_stat = rc; - wake_up(&lli->lli_sai->sai_thread.t_ctl_waitq); + cfs_waitq_signal(&lli->lli_sai->sai_thread.t_ctl_waitq); } lli->lli_sai->sai_sent++; return rc; @@ -489,7 +489,7 @@ static int ll_statahead_thread(void *arg) snprintf(name, 15, "ll_sa_%u", sta->sta_pid); cfs_daemonize(name); thread->t_flags = SVC_RUNNING; - wake_up(&thread->t_ctl_waitq); + cfs_waitq_signal(&thread->t_ctl_waitq); CDEBUG(D_READA, "start doing statahead for %s\n", parent->d_name.name); if (sai->sai_ls_all) @@ -588,7 +588,7 @@ static int ll_statahead_thread(void *arg) EXIT; out: thread->t_flags = SVC_STOPPED; - wake_up(&thread->t_ctl_waitq); + cfs_waitq_signal(&thread->t_ctl_waitq); lli->lli_opendir_pid = 0; /* avoid statahead again */ ll_sai_put(sai); dput(parent); @@ -609,6 +609,7 @@ void ll_stop_statahead(struct inode *inode) spin_lock(&lli->lli_lock); if (lli->lli_sai) { + struct l_wait_info lwi = { 0 }; ll_sai_get(lli->lli_sai); spin_unlock(&lli->lli_lock); @@ -616,8 +617,9 @@ void ll_stop_statahead(struct inode *inode) current->pid); thread = &lli->lli_sai->sai_thread; thread->t_flags = SVC_STOPPING; - wake_up(&thread->t_ctl_waitq); - wait_event(thread->t_ctl_waitq, thread->t_flags & SVC_STOPPED); + cfs_waitq_signal(&thread->t_ctl_waitq); + l_wait_event(thread->t_ctl_waitq, thread->t_flags & SVC_STOPPED, + &lwi); ll_sai_put(lli->lli_sai); return; @@ -723,6 +725,7 @@ int ll_statahead_enter(struct inode *dir, struct dentry **dentryp, int lookup) struct ll_inode_info *lli = ll_i2info(dir); struct ll_statahead_info *sai; struct ll_sa_thread_args sta; + struct l_wait_info lwi = { 0 }; int rc; ENTRY; @@ -807,8 +810,9 @@ int ll_statahead_enter(struct inode *dir, struct dentry **dentryp, int lookup) RETURN(rc); } - wait_event(sai->sai_thread.t_ctl_waitq, - sai->sai_thread.t_flags & (SVC_RUNNING | SVC_STOPPED)); + l_wait_event(sai->sai_thread.t_ctl_waitq, + sai->sai_thread.t_flags & (SVC_RUNNING | SVC_STOPPED), + &lwi); ll_sai_put(sai); /* we don't stat-ahead for the first dirent since we are already in @@ -854,7 +858,7 @@ void ll_statahead_exit(struct dentry *dentry, int result) sai->sai_hit, sai->sai_miss); ll_sai_entry_put(sai); } - wake_up(&sai->sai_thread.t_ctl_waitq); + cfs_waitq_signal(&sai->sai_thread.t_ctl_waitq); } spin_unlock(&lli->lli_lock); } -- 1.8.3.1