Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8eefa1c0 authored by Shivani Bhardwaj's avatar Shivani Bhardwaj Committed by Greg Kroah-Hartman
Browse files

staging: lustre: workitem: Remove cfs_wi_sched_unlock wrapper



Remove the wrapper function cfs_wi_sched_unlock() 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 d11f8cc4
Loading
Loading
Loading
Loading
+10 −16
Original line number Original line Diff line number Diff line
@@ -86,26 +86,20 @@ static struct cfs_workitem_data {
	int			wi_stopping;
	int			wi_stopping;
} cfs_wi_data;
} cfs_wi_data;


static inline void
cfs_wi_sched_unlock(struct cfs_wi_sched *sched)
{
	spin_unlock(&sched->ws_lock);
}

static inline int
static inline int
cfs_wi_sched_cansleep(struct cfs_wi_sched *sched)
cfs_wi_sched_cansleep(struct cfs_wi_sched *sched)
{
{
	spin_lock(&sched->ws_lock);
	spin_lock(&sched->ws_lock);
	if (sched->ws_stopping) {
	if (sched->ws_stopping) {
		cfs_wi_sched_unlock(sched);
		spin_unlock(&sched->ws_lock);
		return 0;
		return 0;
	}
	}


	if (!list_empty(&sched->ws_runq)) {
	if (!list_empty(&sched->ws_runq)) {
		cfs_wi_sched_unlock(sched);
		spin_unlock(&sched->ws_lock);
		return 0;
		return 0;
	}
	}
	cfs_wi_sched_unlock(sched);
	spin_unlock(&sched->ws_lock);
	return 1;
	return 1;
}
}


@@ -133,7 +127,7 @@ cfs_wi_exit(struct cfs_wi_sched *sched, cfs_workitem_t *wi)
	LASSERT(list_empty(&wi->wi_list));
	LASSERT(list_empty(&wi->wi_list));


	wi->wi_scheduled = 1; /* LBUG future schedule attempts */
	wi->wi_scheduled = 1; /* LBUG future schedule attempts */
	cfs_wi_sched_unlock(sched);
	spin_unlock(&sched->ws_lock);


	return;
	return;
}
}
@@ -171,7 +165,7 @@ cfs_wi_deschedule(struct cfs_wi_sched *sched, cfs_workitem_t *wi)


	LASSERT (list_empty(&wi->wi_list));
	LASSERT (list_empty(&wi->wi_list));


	cfs_wi_sched_unlock(sched);
	spin_unlock(&sched->ws_lock);
	return rc;
	return rc;
}
}
EXPORT_SYMBOL(cfs_wi_deschedule);
EXPORT_SYMBOL(cfs_wi_deschedule);
@@ -205,7 +199,7 @@ cfs_wi_schedule(struct cfs_wi_sched *sched, cfs_workitem_t *wi)
	}
	}


	LASSERT (!list_empty(&wi->wi_list));
	LASSERT (!list_empty(&wi->wi_list));
	cfs_wi_sched_unlock(sched);
	spin_unlock(&sched->ws_lock);
	return;
	return;
}
}
EXPORT_SYMBOL(cfs_wi_schedule);
EXPORT_SYMBOL(cfs_wi_schedule);
@@ -252,7 +246,7 @@ cfs_wi_scheduler (void *arg)
			wi->wi_running   = 1;
			wi->wi_running   = 1;
			wi->wi_scheduled = 0;
			wi->wi_scheduled = 0;


			cfs_wi_sched_unlock(sched);
			spin_unlock(&sched->ws_lock);
			nloops++;
			nloops++;


			rc = (*wi->wi_action) (wi);
			rc = (*wi->wi_action) (wi);
@@ -272,7 +266,7 @@ cfs_wi_scheduler (void *arg)
		}
		}


		if (!list_empty(&sched->ws_runq)) {
		if (!list_empty(&sched->ws_runq)) {
			cfs_wi_sched_unlock(sched);
			spin_unlock(&sched->ws_lock);
			/* 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();
@@ -280,13 +274,13 @@ cfs_wi_scheduler (void *arg)
			continue;
			continue;
		}
		}


		cfs_wi_sched_unlock(sched);
		spin_unlock(&sched->ws_lock);
		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));
		spin_lock(&sched->ws_lock);
		spin_lock(&sched->ws_lock);
	}
	}


	cfs_wi_sched_unlock(sched);
	spin_unlock(&sched->ws_lock);


	spin_lock(&cfs_wi_data.wi_glock);
	spin_lock(&cfs_wi_data.wi_glock);
	sched->ws_nthreads--;
	sched->ws_nthreads--;