-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
/*
* Number of outstanding watchdogs.
* When it hits 1, we start the dispatcher.
- * When it hits 0, we stop the distpatcher.
+ * When it hits 0, we stop the dispatcher.
*/
static __u32 lcw_refcount = 0;
-static CFS_DECLARE_MUTEX(lcw_refcount_sem);
+static CFS_DEFINE_MUTEX(lcw_refcount_mutex);
/*
* List of timers that have fired that need their callbacks run by the
* dispatcher.
*/
/* BH lock! */
-static cfs_spinlock_t lcw_pending_timers_lock = CFS_SPIN_LOCK_UNLOCKED;
-static cfs_list_t lcw_pending_timers = \
- CFS_LIST_HEAD_INIT(lcw_pending_timers);
+static DEFINE_SPINLOCK(lcw_pending_timers_lock);
+static cfs_list_t lcw_pending_timers = CFS_LIST_HEAD_INIT(lcw_pending_timers);
/* Last time a watchdog expired */
static cfs_time_t lcw_last_watchdog_time;
ENTRY;
#if defined(HAVE_TASKLIST_LOCK)
cfs_read_lock(&tasklist_lock);
-#elif defined(HAVE_TASK_RCU)
- rcu_read_lock();
#else
- CERROR("unable to dump stack because of missing export\n");
- RETURN_EXIT;
+ rcu_read_lock();
#endif
if (lcw->lcw_task == NULL) {
LCONSOLE_WARN("Process " LPPID " was not found in the task "
#if defined(HAVE_TASKLIST_LOCK)
cfs_read_unlock(&tasklist_lock);
-#elif defined(HAVE_TASK_RCU)
+#else
rcu_read_unlock();
#endif
EXIT;
cfs_waitq_init(&lcw_event_waitq);
CDEBUG(D_INFO, "starting dispatch thread\n");
- rc = cfs_kernel_thread(lcw_dispatch_main, NULL, 0);
+ rc = cfs_create_thread(lcw_dispatch_main, NULL, 0);
if (rc < 0) {
CERROR("error spawning watchdog dispatch thread: %d\n", rc);
EXIT;
RETURN(ERR_PTR(-ENOMEM));
}
- spin_lock_init(&lcw->lcw_lock);
+ cfs_spin_lock_init(&lcw->lcw_lock);
lcw->lcw_refcount = 1; /* refcount for owner */
lcw->lcw_task = cfs_current();
lcw->lcw_pid = cfs_curproc_pid();
CFS_INIT_LIST_HEAD(&lcw->lcw_list);
cfs_timer_init(&lcw->lcw_timer, lcw_cb, lcw);
- cfs_down(&lcw_refcount_sem);
+ cfs_mutex_lock(&lcw_refcount_mutex);
if (++lcw_refcount == 1)
lcw_dispatch_start();
- cfs_up(&lcw_refcount_sem);
+ cfs_mutex_unlock(&lcw_refcount_mutex);
/* Keep this working in case we enable them by default */
if (lcw->lcw_state == LC_WATCHDOG_ENABLED) {
if (dead)
LIBCFS_FREE(lcw, sizeof(*lcw));
- cfs_down(&lcw_refcount_sem);
+ cfs_mutex_lock(&lcw_refcount_mutex);
if (--lcw_refcount == 0)
lcw_dispatch_stop();
- cfs_up(&lcw_refcount_sem);
+ cfs_mutex_unlock(&lcw_refcount_mutex);
EXIT;
}