Commit d11f8cc4 authored by Shivani Bhardwaj's avatar Shivani Bhardwaj Committed by Greg Kroah-Hartman

staging: lustre: workitem: Remove cfs_wi_sched_lock wrapper

Remove the wrapper function cfs_wi_sched_lock() and replace all its
calls with the function it wrapped.
Signed-off-by: default avatarShivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 24a85e88
...@@ -86,12 +86,6 @@ static struct cfs_workitem_data { ...@@ -86,12 +86,6 @@ static struct cfs_workitem_data {
int wi_stopping; int wi_stopping;
} cfs_wi_data; } cfs_wi_data;
static inline void
cfs_wi_sched_lock(struct cfs_wi_sched *sched)
{
spin_lock(&sched->ws_lock);
}
static inline void static inline void
cfs_wi_sched_unlock(struct cfs_wi_sched *sched) cfs_wi_sched_unlock(struct cfs_wi_sched *sched)
{ {
...@@ -101,7 +95,7 @@ cfs_wi_sched_unlock(struct cfs_wi_sched *sched) ...@@ -101,7 +95,7 @@ cfs_wi_sched_unlock(struct cfs_wi_sched *sched)
static inline int static inline int
cfs_wi_sched_cansleep(struct cfs_wi_sched *sched) cfs_wi_sched_cansleep(struct cfs_wi_sched *sched)
{ {
cfs_wi_sched_lock(sched); spin_lock(&sched->ws_lock);
if (sched->ws_stopping) { if (sched->ws_stopping) {
cfs_wi_sched_unlock(sched); cfs_wi_sched_unlock(sched);
return 0; return 0;
...@@ -125,7 +119,7 @@ cfs_wi_exit(struct cfs_wi_sched *sched, cfs_workitem_t *wi) ...@@ -125,7 +119,7 @@ cfs_wi_exit(struct cfs_wi_sched *sched, cfs_workitem_t *wi)
LASSERT(!in_interrupt()); /* because we use plain spinlock */ LASSERT(!in_interrupt()); /* because we use plain spinlock */
LASSERT(!sched->ws_stopping); LASSERT(!sched->ws_stopping);
cfs_wi_sched_lock(sched); spin_lock(&sched->ws_lock);
LASSERT(wi->wi_running); LASSERT(wi->wi_running);
if (wi->wi_scheduled) { /* cancel pending schedules */ if (wi->wi_scheduled) { /* cancel pending schedules */
...@@ -161,7 +155,7 @@ cfs_wi_deschedule(struct cfs_wi_sched *sched, cfs_workitem_t *wi) ...@@ -161,7 +155,7 @@ cfs_wi_deschedule(struct cfs_wi_sched *sched, cfs_workitem_t *wi)
* means the workitem will not be scheduled and will not have * means the workitem will not be scheduled and will not have
* any race with wi_action. * any race with wi_action.
*/ */
cfs_wi_sched_lock(sched); spin_lock(&sched->ws_lock);
rc = !(wi->wi_running); rc = !(wi->wi_running);
...@@ -195,7 +189,7 @@ cfs_wi_schedule(struct cfs_wi_sched *sched, cfs_workitem_t *wi) ...@@ -195,7 +189,7 @@ cfs_wi_schedule(struct cfs_wi_sched *sched, cfs_workitem_t *wi)
LASSERT(!in_interrupt()); /* because we use plain spinlock */ LASSERT(!in_interrupt()); /* because we use plain spinlock */
LASSERT(!sched->ws_stopping); LASSERT(!sched->ws_stopping);
cfs_wi_sched_lock(sched); spin_lock(&sched->ws_lock);
if (!wi->wi_scheduled) { if (!wi->wi_scheduled) {
LASSERT (list_empty(&wi->wi_list)); LASSERT (list_empty(&wi->wi_list));
...@@ -237,7 +231,7 @@ cfs_wi_scheduler (void *arg) ...@@ -237,7 +231,7 @@ cfs_wi_scheduler (void *arg)
spin_unlock(&cfs_wi_data.wi_glock); spin_unlock(&cfs_wi_data.wi_glock);
cfs_wi_sched_lock(sched); spin_lock(&sched->ws_lock);
while (!sched->ws_stopping) { while (!sched->ws_stopping) {
int nloops = 0; int nloops = 0;
...@@ -263,7 +257,7 @@ cfs_wi_scheduler (void *arg) ...@@ -263,7 +257,7 @@ cfs_wi_scheduler (void *arg)
rc = (*wi->wi_action) (wi); rc = (*wi->wi_action) (wi);
cfs_wi_sched_lock(sched); spin_lock(&sched->ws_lock);
if (rc != 0) /* WI should be dead, even be freed! */ if (rc != 0) /* WI should be dead, even be freed! */
continue; continue;
...@@ -282,14 +276,14 @@ cfs_wi_scheduler (void *arg) ...@@ -282,14 +276,14 @@ cfs_wi_scheduler (void *arg)
/* don't sleep because some workitems still /* don't sleep because some workitems still
* expect me to come back soon */ * expect me to come back soon */
cond_resched(); cond_resched();
cfs_wi_sched_lock(sched); spin_lock(&sched->ws_lock);
continue; continue;
} }
cfs_wi_sched_unlock(sched); cfs_wi_sched_unlock(sched);
rc = wait_event_interruptible_exclusive(sched->ws_waitq, rc = wait_event_interruptible_exclusive(sched->ws_waitq,
!cfs_wi_sched_cansleep(sched)); !cfs_wi_sched_cansleep(sched));
cfs_wi_sched_lock(sched); spin_lock(&sched->ws_lock);
} }
cfs_wi_sched_unlock(sched); cfs_wi_sched_unlock(sched);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment