staging:lustre: cleanup libcfs lock handling
authorJames Simmons <jsimmons@infradead.org>
Wed, 3 Jun 2015 22:38:06 +0000 (18:38 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Jun 2015 19:39:01 +0000 (12:39 -0700)
Previously with libcfs being built for user land and kernel
space wrappers were created to transparently handle locking.
Now that user land support has been removed we delete all
those locking wrappers with this patch. Many of those changes
landed upstream but some nice cleanups still remain that are
pushed in this patch.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/13793
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/lnet/acceptor.c
drivers/staging/lustre/lustre/libcfs/fail.c
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
drivers/staging/lustre/lustre/libcfs/module.c
drivers/staging/lustre/lustre/libcfs/tracefile.c

index 69d4b193dd75c3c1339391badfc06eaf93679208..954f8d3fcebccea13448bf994e5a70b2d0f1f34c 100644 (file)
@@ -35,9 +35,9 @@
  */
 
 #define DEBUG_SUBSYSTEM S_LNET
+#include <linux/completion.h>
 #include "../../include/linux/lnet/lib-lnet.h"
 
-
 static int   accept_port    = 988;
 static int   accept_backlog = 127;
 static int   accept_timeout = 5;
index 92444b0fe2a36f038c193c333409caab74a1262b..7b7fc215e633298025042a650cb86f0985552444 100644 (file)
@@ -41,7 +41,7 @@ EXPORT_SYMBOL(cfs_fail_loc);
 unsigned int cfs_fail_val = 0;
 EXPORT_SYMBOL(cfs_fail_val);
 
-wait_queue_head_t cfs_race_waitq;
+DECLARE_WAIT_QUEUE_HEAD(cfs_race_waitq);
 EXPORT_SYMBOL(cfs_race_waitq);
 
 int cfs_race_state;
index 483cbc82e53889bcdde48e6b9740c56012276bdc..eb10e3b478aae03dd84f55c7347a4c72b7b5e50b 100644 (file)
@@ -49,7 +49,7 @@ static unsigned int pages_factor[CFS_TCD_TYPE_MAX] = {
 
 char *cfs_trace_console_buffers[NR_CPUS][CFS_TCD_TYPE_MAX];
 
-struct rw_semaphore cfs_tracefile_sem;
+static DECLARE_RWSEM(cfs_tracefile_sem);
 
 int cfs_tracefile_init_arch(void)
 {
@@ -57,8 +57,6 @@ int cfs_tracefile_init_arch(void)
        int    j;
        struct cfs_trace_cpu_data *tcd;
 
-       init_rwsem(&cfs_tracefile_sem);
-
        /* initialize trace_data */
        memset(cfs_trace_data, 0, sizeof(cfs_trace_data));
        for (i = 0; i < CFS_TCD_TYPE_MAX; i++) {
index 83b1a708b1e3d6f470ae8c9ab8840fa0cf0ae2c9..e60b2e9b91944ad1f2d22a7cc4d9d59f872f12f9 100644 (file)
@@ -66,8 +66,6 @@ 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);
 
@@ -248,8 +246,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)
 {
@@ -392,11 +390,6 @@ static int init_libcfs_module(void)
 
        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) {
index c86394f7f4d9c32294eeb52a650255e4c24d208d..6ee2adcf8890a5b444346333f4fdd9f718333362 100644 (file)
@@ -52,7 +52,7 @@ union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS] __cacheline
 char cfs_tracefile[TRACEFILE_NAME_SIZE];
 long long cfs_tracefile_size = CFS_TRACEFILE_SIZE;
 static struct tracefiled_ctl trace_tctl;
-struct mutex cfs_trace_thread_mutex;
+static DEFINE_MUTEX(cfs_trace_thread_mutex);
 static int thread_running;
 
 static atomic_t cfs_tage_allocated = ATOMIC_INIT(0);