From 9811edb26d3bff66c61acc39a72554461445298f Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Wed, 28 Sep 2016 11:08:07 -0400 Subject: [PATCH] LU-7988 hsm: don't use a ptlrpc_thread struct for the cdt Since only the waitq and the event flag from the ptlrpc_thread structure are used, declare these directly and do not use the ptlrpc_thread structure at all. Test-Parameters: trivial testlist=sanity-hsm Signed-off-by: frank zago Change-Id: Iba63ac70ad381f7e40976ac423594eae46c5249b Reviewed-on: https://review.whamcloud.com/22761 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Henri Doreau Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- lustre/mdt/mdt_coordinator.c | 39 +++++++++++++++++++-------------------- lustre/mdt/mdt_internal.h | 3 ++- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lustre/mdt/mdt_coordinator.c b/lustre/mdt/mdt_coordinator.c index 6fcbb4d..536320e 100644 --- a/lustre/mdt/mdt_coordinator.c +++ b/lustre/mdt/mdt_coordinator.c @@ -417,8 +417,8 @@ static int mdt_coordinator(void *data) int request_sz; ENTRY; - cdt->cdt_thread.t_flags = SVC_RUNNING; - wake_up(&cdt->cdt_thread.t_ctl_waitq); + cdt->cdt_flags = SVC_RUNNING; + wake_up(&cdt->cdt_waitq); CDEBUG(D_HSM, "%s: coordinator thread starting, pid=%d\n", mdt_obd_name(mdt), current_pid()); @@ -442,23 +442,22 @@ static int mdt_coordinator(void *data) lwi = LWI_TIMEOUT(cfs_time_seconds(cdt->cdt_loop_period), NULL, NULL); - l_wait_event(cdt->cdt_thread.t_ctl_waitq, - (cdt->cdt_thread.t_flags & - (SVC_STOPPING|SVC_EVENT)), + l_wait_event(cdt->cdt_waitq, + cdt->cdt_flags & (SVC_STOPPING|SVC_EVENT), &lwi); CDEBUG(D_HSM, "coordinator resumes\n"); - if (cdt->cdt_thread.t_flags & SVC_STOPPING || + if (cdt->cdt_flags & SVC_STOPPING || cdt->cdt_state == CDT_STOPPING) { - cdt->cdt_thread.t_flags &= ~SVC_STOPPING; + cdt->cdt_flags &= ~SVC_STOPPING; rc = 0; break; } /* wake up before timeout, new work arrives */ - if (cdt->cdt_thread.t_flags & SVC_EVENT) - cdt->cdt_thread.t_flags &= ~SVC_EVENT; + if (cdt->cdt_flags & SVC_EVENT) + cdt->cdt_flags &= ~SVC_EVENT; /* if coordinator is suspended continue to wait */ if (cdt->cdt_state == CDT_DISABLE) { @@ -567,8 +566,8 @@ out: * by mdt_stop_coordinator(), we have to ack * and cdt cleaning will be done by event sender */ - cdt->cdt_thread.t_flags = SVC_STOPPED; - wake_up(&cdt->cdt_thread.t_ctl_waitq); + cdt->cdt_flags = SVC_STOPPED; + wake_up(&cdt->cdt_waitq); } if (rc != 0) @@ -750,8 +749,8 @@ int mdt_hsm_cdt_wakeup(struct mdt_device *mdt) RETURN(-ESRCH); /* wake up coordinator */ - cdt->cdt_thread.t_flags = SVC_EVENT; - wake_up(&cdt->cdt_thread.t_ctl_waitq); + cdt->cdt_flags = SVC_EVENT; + wake_up(&cdt->cdt_waitq); RETURN(0); } @@ -771,7 +770,7 @@ int mdt_hsm_cdt_init(struct mdt_device *mdt) cdt->cdt_state = CDT_STOPPED; - init_waitqueue_head(&cdt->cdt_thread.t_ctl_waitq); + init_waitqueue_head(&cdt->cdt_waitq); mutex_init(&cdt->cdt_llog_lock); init_rwsem(&cdt->cdt_agent_lock); init_rwsem(&cdt->cdt_request_lock); @@ -896,8 +895,8 @@ static int mdt_hsm_cdt_start(struct mdt_device *mdt) rc = 0; } - wait_event(cdt->cdt_thread.t_ctl_waitq, - (cdt->cdt_thread.t_flags & SVC_RUNNING)); + wait_event(cdt->cdt_waitq, + (cdt->cdt_flags & SVC_RUNNING)); cdt->cdt_state = CDT_RUNNING; mdt->mdt_opts.mo_coordinator = 1; @@ -925,10 +924,10 @@ int mdt_hsm_cdt_stop(struct mdt_device *mdt) if (cdt->cdt_state != CDT_STOPPING) { /* stop coordinator thread before cleaning */ - cdt->cdt_thread.t_flags = SVC_STOPPING; - wake_up(&cdt->cdt_thread.t_ctl_waitq); - wait_event(cdt->cdt_thread.t_ctl_waitq, - cdt->cdt_thread.t_flags & SVC_STOPPED); + cdt->cdt_flags = SVC_STOPPING; + wake_up(&cdt->cdt_waitq); + wait_event(cdt->cdt_waitq, + cdt->cdt_flags & SVC_STOPPED); } cdt->cdt_state = CDT_STOPPED; diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index f78a973..f48b9af 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -105,7 +105,8 @@ enum cdt_states { CDT_STOPPED = 0, * cdt_request_lock */ struct coordinator { - struct ptlrpc_thread cdt_thread; /**< coordinator thread */ + wait_queue_head_t cdt_waitq; /**< cdt wait queue */ + unsigned int cdt_flags; /**< cdt event flags */ struct lu_env cdt_env; /**< coordinator lustre * env */ struct lu_context cdt_session; /** session for lu_ucred */ -- 1.8.3.1