Whamcloud - gitweb
LU-6245 libcfs: cleanup libcfs lock handling
[fs/lustre-release.git] / libcfs / libcfs / module.c
index b35bade..e284384 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -42,9 +42,8 @@
 #include <lnet/lib-dlc.h>
 #include <lnet/lnet.h>
 #include <lnet/nidstr.h>
-#include "tracefile.h"
 
-void
+static void
 kportal_memhog_free (struct libcfs_device_userstate *ldu)
 {
        struct page **level0p = &ldu->ldu_memhog_root_page;
@@ -87,7 +86,7 @@ kportal_memhog_free (struct libcfs_device_userstate *ldu)
        LASSERT(ldu->ldu_memhog_pages == 0);
 }
 
-int
+static int
 kportal_memhog_alloc(struct libcfs_device_userstate *ldu, int npages,
                     gfp_t flags)
 {
@@ -187,8 +186,8 @@ static int libcfs_psdev_release(unsigned long flags, void *args)
        RETURN(0);
 }
 
-static struct rw_semaphore ioctl_list_sem;
-static struct list_head ioctl_list;
+static DECLARE_RWSEM(ioctl_list_sem);
+static LIST_HEAD(ioctl_list);
 
 int libcfs_register_ioctl(struct libcfs_ioctl_handler *hand)
 {
@@ -309,32 +308,16 @@ struct cfs_psdev_ops libcfs_psdev_ops = {
         libcfs_ioctl
 };
 
-extern int insert_proc(void);
-extern void remove_proc(void);
 MODULE_AUTHOR("Peter J. Braam <braam@clusterfs.com>");
 MODULE_DESCRIPTION("Portals v3.1");
 MODULE_LICENSE("GPL");
 
-extern struct miscdevice libcfs_dev;
-extern struct rw_semaphore cfs_tracefile_sem;
-extern struct mutex cfs_trace_thread_mutex;
-extern struct cfs_wi_sched *cfs_sched_rehash;
-
-extern void libcfs_init_nidstrings(void);
-extern int libcfs_arch_init(void);
-extern void libcfs_arch_cleanup(void);
-
 static int init_libcfs_module(void)
 {
        int rc;
 
        libcfs_arch_init();
        libcfs_init_nidstrings();
-       init_rwsem(&cfs_tracefile_sem);
-       mutex_init(&cfs_trace_thread_mutex);
-       init_rwsem(&ioctl_list_sem);
-       INIT_LIST_HEAD(&ioctl_list);
-       init_waitqueue_head(&cfs_race_waitq);
 
        rc = libcfs_debug_init(5 * 1024 * 1024);
        if (rc < 0) {
@@ -427,9 +410,6 @@ static void exit_libcfs_module(void)
                printk(KERN_ERR "LustreError: libcfs_debug_cleanup: %d\n",
                       rc);
 
-       fini_rwsem(&ioctl_list_sem);
-       fini_rwsem(&cfs_tracefile_sem);
-
        libcfs_arch_cleanup();
 }