Whamcloud - gitweb
LU-6245 libcfs: remove last of user land code in libcfs module 97/15197/2
authorJames Simmons <uja.ornl@yahoo.com>
Wed, 10 Jun 2015 15:24:20 +0000 (11:24 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 19 Jul 2015 04:05:36 +0000 (04:05 +0000)
Currently user land code still exist in libcfs source for
workitems and some of the linux specific debug code. We
can now safely remove the last bit of this code.

Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Change-Id: Id137071f52cbce3a4c6de323b5412976fb687c54
Reviewed-on: http://review.whamcloud.com/15197
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: frank zago <fzago@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
libcfs/include/libcfs/libcfs.h
libcfs/include/libcfs/libcfs_workitem.h
libcfs/libcfs/linux/linux-debug.c
libcfs/libcfs/workitem.c

index 1354f1f..e76e21c 100644 (file)
@@ -240,9 +240,7 @@ void cfs_get_random_bytes(void *buf, int size);
 #include <libcfs/libcfs_time.h>
 #ifdef __KERNEL__
 # include <libcfs/libcfs_string.h>
-#endif
-#include <libcfs/libcfs_workitem.h>
-#ifdef __KERNEL__
+# include <libcfs/libcfs_workitem.h>
 # include <libcfs/libcfs_hash.h>
 # include <libcfs/libcfs_heap.h>
 # include <libcfs/libcfs_fail.h>
index 69c516c..a800a9b 100644 (file)
@@ -104,11 +104,7 @@ void cfs_wi_exit(struct cfs_wi_sched *sched, cfs_workitem_t *wi);
 int  cfs_wi_startup(void);
 void cfs_wi_shutdown(void);
 
-#ifdef __KERNEL__
 /** # workitem scheduler loops before reschedule */
 #define CFS_WI_RESCHED    128
-#else
-int cfs_wi_check_events(void);
-#endif
 
 #endif /* __LIBCFS_WORKITEM_H__ */
index c313e01..92d5361 100644 (file)
@@ -158,6 +158,7 @@ void libcfs_run_lbug_upcall(struct libcfs_debug_msg_data *msgdata)
 
         libcfs_run_upcall (argv);
 }
+EXPORT_SYMBOL(libcfs_run_lbug_upcall);
 
 /* coverity[+kill] */
 void lbug_with_loc(struct libcfs_debug_msg_data *msgdata)
@@ -180,8 +181,7 @@ void lbug_with_loc(struct libcfs_debug_msg_data *msgdata)
         while (1)
                 schedule();
 }
-
-#ifdef __KERNEL__
+EXPORT_SYMBOL(lbug_with_loc);
 
 #ifdef CONFIG_X86
 #include <linux/nmi.h>
@@ -262,6 +262,7 @@ void libcfs_debug_dumpstack(struct task_struct *tsk)
        printk("\nCall Trace:\n");
        libcfs_call_trace(tsk);
 }
+EXPORT_SYMBOL(libcfs_debug_dumpstack);
 
 struct task_struct *libcfs_current(void)
 {
@@ -310,10 +311,3 @@ void libcfs_unregister_panic_notifier(void)
 {
         atomic_notifier_chain_unregister(&panic_notifier_list, &libcfs_panic_notifier);
 }
-
-EXPORT_SYMBOL(libcfs_debug_dumpstack);
-
-#endif /* __KERNEL__ */
-
-EXPORT_SYMBOL(libcfs_run_lbug_upcall);
-EXPORT_SYMBOL(lbug_with_loc);
index d93c3e9..1a4ca46 100644 (file)
 
 typedef struct cfs_wi_sched {
        struct list_head                ws_list;        /* chain on global list */
-#ifdef __KERNEL__
        /** serialised workitems */
        spinlock_t                      ws_lock;
        /** where schedulers sleep */
        wait_queue_head_t               ws_waitq;
-#endif
        /** concurrent workitems */
        struct list_head                ws_runq;
        /** rescheduled running-workitems, a workitem can be rescheduled
@@ -89,7 +87,6 @@ static struct cfs_workitem_data {
        int                     wi_stopping;
 } cfs_wi_data;
 
-#ifdef __KERNEL__
 static inline void
 cfs_wi_sched_lock(cfs_wi_sched_t *sched)
 {
@@ -119,22 +116,6 @@ cfs_wi_sched_cansleep(cfs_wi_sched_t *sched)
        return 1;
 }
 
-#else /* !__KERNEL__ */
-
-static inline void
-cfs_wi_sched_lock(cfs_wi_sched_t *sched)
-{
-       spin_lock(&cfs_wi_data.wi_glock);
-}
-
-static inline void
-cfs_wi_sched_unlock(cfs_wi_sched_t *sched)
-{
-       spin_unlock(&cfs_wi_data.wi_glock);
-}
-
-#endif /* __KERNEL__ */
-
 /* XXX:
  * 0. it only works when called from wi->wi_action.
  * 1. when it returns no one shall try to schedule the workitem.
@@ -147,9 +128,8 @@ cfs_wi_exit(struct cfs_wi_sched *sched, cfs_workitem_t *wi)
 
        cfs_wi_sched_lock(sched);
 
-#ifdef __KERNEL__
        LASSERT(wi->wi_running);
-#endif
+
        if (wi->wi_scheduled) { /* cancel pending schedules */
                LASSERT(!list_empty(&wi->wi_list));
                list_del_init(&wi->wi_list);
@@ -226,9 +206,7 @@ cfs_wi_schedule(struct cfs_wi_sched *sched, cfs_workitem_t *wi)
                sched->ws_nscheduled++;
                if (!wi->wi_running) {
                        list_add_tail(&wi->wi_list, &sched->ws_runq);
-#ifdef __KERNEL__
                        wake_up(&sched->ws_waitq);
-#endif
                } else {
                        list_add(&wi->wi_list, &sched->ws_rerunq);
                }
@@ -240,8 +218,6 @@ cfs_wi_schedule(struct cfs_wi_sched *sched, cfs_workitem_t *wi)
 }
 EXPORT_SYMBOL(cfs_wi_schedule);
 
-#ifdef __KERNEL__
-
 static int
 cfs_wi_scheduler (void *arg)
 {
@@ -328,54 +304,6 @@ cfs_wi_scheduler (void *arg)
        return 0;
 }
 
-#else /* __KERNEL__ */
-
-int
-cfs_wi_check_events (void)
-{
-       int               n = 0;
-       cfs_workitem_t   *wi;
-
-       spin_lock(&cfs_wi_data.wi_glock);
-
-       for (;;) {
-               struct cfs_wi_sched     *sched = NULL;
-               struct cfs_wi_sched     *tmp;
-
-                /** rerunq is always empty for userspace */
-               list_for_each_entry(tmp, &cfs_wi_data.wi_scheds, ws_list) {
-                       if (!list_empty(&tmp->ws_runq)) {
-                               sched = tmp;
-                               break;
-                       }
-               }
-
-               if (sched == NULL)
-                       break;
-
-               wi = list_entry(sched->ws_runq.next,
-                                   cfs_workitem_t, wi_list);
-               list_del_init(&wi->wi_list);
-
-               LASSERT(sched->ws_nscheduled > 0);
-               sched->ws_nscheduled--;
-
-               LASSERT(wi->wi_scheduled);
-               wi->wi_scheduled = 0;
-               spin_unlock(&cfs_wi_data.wi_glock);
-
-               n++;
-               (*wi->wi_action) (wi);
-
-               spin_lock(&cfs_wi_data.wi_glock);
-       }
-
-       spin_unlock(&cfs_wi_data.wi_glock);
-       return n;
-}
-
-#endif
-
 void
 cfs_wi_sched_destroy(struct cfs_wi_sched *sched)
 {
@@ -395,7 +323,6 @@ cfs_wi_sched_destroy(struct cfs_wi_sched *sched)
 
        spin_unlock(&cfs_wi_data.wi_glock);
 
-#ifdef __KERNEL__
        wake_up_all(&sched->ws_waitq);
 
        spin_lock(&cfs_wi_data.wi_glock);
@@ -418,7 +345,7 @@ cfs_wi_sched_destroy(struct cfs_wi_sched *sched)
        list_del(&sched->ws_list);
 
        spin_unlock(&cfs_wi_data.wi_glock);
-#endif
+
        LASSERT(sched->ws_nscheduled == 0);
 
        LIBCFS_FREE(sched, sizeof(*sched));
@@ -449,15 +376,13 @@ cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab,
        sched->ws_cptab = cptab;
        sched->ws_cpt = cpt;
 
-#ifdef __KERNEL__
        spin_lock_init(&sched->ws_lock);
        init_waitqueue_head(&sched->ws_waitq);
-#endif
+
        INIT_LIST_HEAD(&sched->ws_runq);
        INIT_LIST_HEAD(&sched->ws_rerunq);
        INIT_LIST_HEAD(&sched->ws_list);
 
-#ifdef __KERNEL__
        for (; nthrs > 0; nthrs--)  {
                char                    name[16];
                struct task_struct      *task;
@@ -500,7 +425,7 @@ cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab,
                        return rc;
                }
        }
-#endif
+
        spin_lock(&cfs_wi_data.wi_glock);
        list_add(&sched->ws_list, &cfs_wi_data.wi_scheds);
        spin_unlock(&cfs_wi_data.wi_glock);
@@ -531,7 +456,6 @@ cfs_wi_shutdown (void)
        cfs_wi_data.wi_stopping = 1;
        spin_unlock(&cfs_wi_data.wi_glock);
 
-#ifdef __KERNEL__
        /* nobody should contend on this list */
        list_for_each_entry(sched, &cfs_wi_data.wi_scheds, ws_list) {
                sched->ws_stopping = 1;
@@ -549,7 +473,7 @@ cfs_wi_shutdown (void)
                }
                spin_unlock(&cfs_wi_data.wi_glock);
        }
-#endif
+
        while (!list_empty(&cfs_wi_data.wi_scheds)) {
                sched = list_entry(cfs_wi_data.wi_scheds.next,
                                       struct cfs_wi_sched, ws_list);