aboutsummaryrefslogtreecommitdiffstats
path: root/module/spl/spl-condvar.c
diff options
context:
space:
mode:
authorMatt Johnston <[email protected]>2012-12-21 10:29:16 +0800
committerBrian Behlendorf <[email protected]>2013-01-07 10:29:26 -0800
commit46a75aadb7c08085a4ad2e55dcf5b6fb387c1253 (patch)
tree98e1fdcd5cedba1f6e5920faa919db127b7f6232 /module/spl/spl-condvar.c
parent02d25048d293a44001de6967872476f7d78e2397 (diff)
Add cv_wait_io() to account I/O time
Under Linux when a task is waiting on I/O it should call the io_schedule() function for proper accounting. The Solaris cv_wait() function provides no way to specify what the cv is waiting on therefore cv_wait_io() is introduced. Signed-off-by: Brian Behlendorf <[email protected]> Closes #206
Diffstat (limited to 'module/spl/spl-condvar.c')
-rw-r--r--module/spl/spl-condvar.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/module/spl/spl-condvar.c b/module/spl/spl-condvar.c
index 6ed6579b3..fefe98598 100644
--- a/module/spl/spl-condvar.c
+++ b/module/spl/spl-condvar.c
@@ -97,7 +97,7 @@ __cv_destroy(kcondvar_t *cvp)
EXPORT_SYMBOL(__cv_destroy);
static void
-cv_wait_common(kcondvar_t *cvp, kmutex_t *mp, int state)
+cv_wait_common(kcondvar_t *cvp, kmutex_t *mp, int state, int io)
{
DEFINE_WAIT(wait);
SENTRY;
@@ -121,7 +121,10 @@ cv_wait_common(kcondvar_t *cvp, kmutex_t *mp, int state)
* ensures we're linked in to the waiters list and avoids the
* race where 'cvp->cv_waiters > 0' but the list is empty. */
mutex_exit(mp);
- schedule();
+ if (io)
+ io_schedule();
+ else
+ schedule();
mutex_enter(mp);
/* No more waiters a different mutex could be used */
@@ -139,17 +142,24 @@ cv_wait_common(kcondvar_t *cvp, kmutex_t *mp, int state)
void
__cv_wait(kcondvar_t *cvp, kmutex_t *mp)
{
- cv_wait_common(cvp, mp, TASK_UNINTERRUPTIBLE);
+ cv_wait_common(cvp, mp, TASK_UNINTERRUPTIBLE, 0);
}
EXPORT_SYMBOL(__cv_wait);
void
__cv_wait_interruptible(kcondvar_t *cvp, kmutex_t *mp)
{
- cv_wait_common(cvp, mp, TASK_INTERRUPTIBLE);
+ cv_wait_common(cvp, mp, TASK_INTERRUPTIBLE, 0);
}
EXPORT_SYMBOL(__cv_wait_interruptible);
+void
+__cv_wait_io(kcondvar_t *cvp, kmutex_t *mp)
+{
+ cv_wait_common(cvp, mp, TASK_UNINTERRUPTIBLE, 1);
+}
+EXPORT_SYMBOL(__cv_wait_io);
+
/* 'expire_time' argument is an absolute wall clock time in jiffies.
* Return value is time left (expire_time - now) or -1 if timeout occurred.
*/