Whamcloud - gitweb
LU-1346 libcfs: cleanup macros in portals_compat25.h 78/4778/8
authorJames Simmons <uja.ornl@gmail.com>
Tue, 27 Aug 2013 16:51:06 +0000 (12:51 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 2 Sep 2013 05:52:29 +0000 (05:52 +0000)
. remove some unused/unnecessary macros such as smp_num_cpus /
  SIGNAL_MASK_ASSERT etc.

. replace some macros with direct kernel API calls such as
  RECALC_SIGPENDING/CLEAR_SIGPENDING/CURRENT_SECONDS,
  cfs_wait_event_interruptible/_exclusive etc.

Signed-off-by: Liu Xuezhao <xuezhao.liu@emc.com>
Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: I2fd4bb4e05136d738ee5357b35893a6ca2ec335a
Reviewed-on: http://review.whamcloud.com/4778
Tested-by: Hudson
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
27 files changed:
contrib/scripts/libcfs_cleanup.sed
libcfs/include/libcfs/darwin/darwin-prim.h
libcfs/include/libcfs/libcfs_fail.h
libcfs/include/libcfs/linux/linux-prim.h
libcfs/include/libcfs/linux/linux-time.h
libcfs/include/libcfs/linux/portals_compat25.h
libcfs/include/libcfs/user-bitops.h
libcfs/include/libcfs/winnt/portals_compat25.h
libcfs/include/libcfs/winnt/winnt-prim.h
libcfs/libcfs/hash.c
libcfs/libcfs/linux/linux-debug.c
libcfs/libcfs/linux/linux-prim.c
libcfs/libcfs/lwt.c
libcfs/libcfs/tracefile.c
libcfs/libcfs/tracefile.h
libcfs/libcfs/user-bitops.c
libcfs/libcfs/watchdog.c
libcfs/libcfs/winnt/winnt-tracefile.c
libcfs/libcfs/workitem.c
lnet/klnds/qswlnd/qswlnd_cb.c
lnet/klnds/ralnd/ralnd.h
lnet/klnds/socklnd/socklnd_cb.c
lustre/include/liblustre.h
lustre/include/lustre_lib.h
lustre/mdt/mdt_identity.c
lustre/obdclass/obd_config.c
lustre/ptlrpc/client.c

index 8861609..9e58da5 100644 (file)
@@ -400,3 +400,14 @@ s/\bCFS_THREAD_SIZE\b/THREAD_SIZE/g
 /#[ \t]*define[ \t]*\bTHREAD_SIZE\b[ \t]*\bTHREAD_SIZE\b/d
 s/\bcfs_kernel_cap_t\b/kernel_cap_t/g
 /typedef[ \t]*\bkernel_cap_t\b[ \t]*\bkernel_cap_t\b/d
 /#[ \t]*define[ \t]*\bTHREAD_SIZE\b[ \t]*\bTHREAD_SIZE\b/d
 s/\bcfs_kernel_cap_t\b/kernel_cap_t/g
 /typedef[ \t]*\bkernel_cap_t\b[ \t]*\bkernel_cap_t\b/d
+
+################################################################################
+# macros in libcfs/include/libcfs/linux/portals_compat25.h
+s/\bRECALC_SIGPENDING\b/recalc_sigpending()/g
+/#[ \t]*define[ \t]*\brecalc_sigpending\b *( *)[ \t]*\brecalc_sigpending\b *( *)/d
+s/\bCLEAR_SIGPENDING\b/clear_tsk_thread_flag(current, TIF_SIGPENDING)/g
+/#[ \t]*define[ \t]*\bclear_tsk_thread_flag\b *( *\w* *, *\w* *)[ \t]*\bclear_tsk_thread_flag\b *( *\w* *, *\w* *)/d
+s/\bCURRENT_SECONDS\b/get_seconds()/g
+/#[ \t]*define[ \t]*\bget_seconds\b *( *)[ \t]*\bget_seconds\b *( *)/d
+s/\bCFS_NR_CPUS\b/NR_CPUS/g
+/#[ \t]*define[ \t]*\bNR_CPUS\b[ \t]*\bNR_CPUS\b/d
index 583e257..1df7092 100644 (file)
@@ -173,7 +173,6 @@ typedef struct uthread              cfs_task_t;
 #define CFS_PUSH_JOURNAL       do {;} while(0)
 #define CFS_POP_JOURNAL                do {;} while(0)
 
 #define CFS_PUSH_JOURNAL       do {;} while(0)
 #define CFS_POP_JOURNAL                do {;} while(0)
 
-#define THREAD_NAME(comm, fmt, a...)
 /*
  * Kernel thread:
  *
 /*
  * Kernel thread:
  *
@@ -367,7 +366,6 @@ static inline void sleep_on(cfs_waitq_t *waitq)
  */
 typedef sigset_t       cfs_sigset_t;
 
  */
 typedef sigset_t       cfs_sigset_t;
 
-#define SIGNAL_MASK_ASSERT()
 /*
  * Timer
  */
 /*
  * Timer
  */
@@ -418,7 +416,6 @@ cfs_time_t cfs_timer_deadline(struct cfs_timer *t);
 /* XXX smp_call_function is not supported in xnu */
 #define smp_call_function(f, a, n, w)          do {} while(0)
 int cfs_online_cpus(void);
 /* XXX smp_call_function is not supported in xnu */
 #define smp_call_function(f, a, n, w)          do {} while(0)
 int cfs_online_cpus(void);
-#define smp_num_cpus                           cfs_online_cpus()
 
 /*
  * Misc
 
 /*
  * Misc
@@ -432,10 +429,10 @@ extern int is_suser(void);
 #define unlikely(exp) (exp)
 #endif
 
 #define unlikely(exp) (exp)
 #endif
 
-#define lock_kernel()                          do {} while(0)
-#define unlock_kernel()                                do {} while(0)
+#define lock_kernel()                                  do {} while(0)
+#define unlock_kernel()                                        do {} while(0)
 
 
-#define USERMODEHELPER(path, argv, envp)       (0)
+#define call_usermodehelper(path, argv, envp, 1)       (0)
 
 #define cfs_module(name, version, init, fini)                          \
 extern kern_return_t _start(kmod_info_t *ki, void *data);              \
 
 #define cfs_module(name, version, init, fini)                          \
 extern kern_return_t _start(kmod_info_t *ki, void *data);              \
index f894313..19ade49 100644 (file)
@@ -156,8 +156,8 @@ static inline void cfs_race(__u32 id)
                         int rc;
                         cfs_race_state = 0;
                         CERROR("cfs_race id %x sleeping\n", id);
                         int rc;
                         cfs_race_state = 0;
                         CERROR("cfs_race id %x sleeping\n", id);
-                        cfs_wait_event_interruptible(cfs_race_waitq,
-                                                     cfs_race_state != 0, rc);
+                       rc = wait_event_interruptible(cfs_race_waitq,
+                                                     cfs_race_state != 0);
                         CERROR("cfs_fail_race id %x awake, rc=%d\n", id, rc);
                 } else {
                         CERROR("cfs_fail_race id %x waking\n", id);
                         CERROR("cfs_fail_race id %x awake, rc=%d\n", id, rc);
                 } else {
                         CERROR("cfs_fail_race id %x waking\n", id);
index 634a50b..5980889 100644 (file)
 #define cfs_for_each_possible_cpu(cpu) for_each_cpu(cpu)
 #endif
 
 #define cfs_for_each_possible_cpu(cpu) for_each_cpu(cpu)
 #endif
 
-#ifdef NR_CPUS
-#define CFS_NR_CPUS     NR_CPUS
-#else
-#define CFS_NR_CPUS     1
+#ifndef NR_CPUS
+#define NR_CPUS                                1
 #endif
 
 /*
 #endif
 
 /*
index 6fcb751..f85ca34 100644 (file)
@@ -156,7 +156,7 @@ static inline cfs_time_t cfs_time_current(void)
 
 static inline time_t cfs_time_current_sec(void)
 {
 
 static inline time_t cfs_time_current_sec(void)
 {
-        return CURRENT_SECONDS;
+       return get_seconds();
 }
 
 static inline void cfs_fs_time_current(cfs_fs_time_t *t)
 }
 
 static inline void cfs_fs_time_current(cfs_fs_time_t *t)
index 411d618..4e19a1c 100644 (file)
 #ifndef __LIBCFS_LINUX_PORTALS_COMPAT_H__
 #define __LIBCFS_LINUX_PORTALS_COMPAT_H__
 
 #ifndef __LIBCFS_LINUX_PORTALS_COMPAT_H__
 #define __LIBCFS_LINUX_PORTALS_COMPAT_H__
 
-#include <net/sock.h>
-
-// XXX BUG 1511 -- remove this stanza and all callers when bug 1511 is resolved
-#if defined(SPINLOCK_DEBUG) && SPINLOCK_DEBUG
-#  define SIGNAL_MASK_ASSERT() \
-   LASSERT(current->sighand->siglock.magic == SPINLOCK_MAGIC)
-#else
-# define SIGNAL_MASK_ASSERT()
-#endif
-// XXX BUG 1511 -- remove this stanza and all callers when bug 1511 is resolved
-
-#define SIGNAL_MASK_LOCK(task, flags)                                  \
-       spin_lock_irqsave(&task->sighand->siglock, flags)
-#define SIGNAL_MASK_UNLOCK(task, flags)                                \
-       spin_unlock_irqrestore(&task->sighand->siglock, flags)
-#define USERMODEHELPER(path, argv, envp)                               \
-       call_usermodehelper(path, argv, envp, 1)
-#define RECALC_SIGPENDING         recalc_sigpending()
-#define CLEAR_SIGPENDING          clear_tsk_thread_flag(current,       \
-                                                        TIF_SIGPENDING)
-# define CURRENT_SECONDS           get_seconds()
-# define smp_num_cpus              num_online_cpus()
-
-#define cfs_wait_event_interruptible(wq, condition, ret)               \
-        ret = wait_event_interruptible(wq, condition)
-#define cfs_wait_event_interruptible_exclusive(wq, condition, ret)     \
-        ret = wait_event_interruptible_exclusive(wq, condition)
-
-#define THREAD_NAME(comm, len, fmt, a...)                              \
-        snprintf(comm, len, fmt, ## a)
-
-/* 2.6 alloc_page users can use page->lru */
-#define PAGE_LIST_ENTRY lru
-#define PAGE_LIST(page) ((page)->lru)
-
 #ifndef __user
 #define __user
 #endif
 
 #ifndef __user
 #define __user
 #endif
 
-#ifndef __fls
-#define __cfs_fls fls
-#else
-#define __cfs_fls __fls
-#endif
-
 #ifdef HAVE_5ARGS_SYSCTL_PROC_HANDLER
 #define ll_proc_dointvec(table, write, filp, buffer, lenp, ppos)        \
         proc_dointvec(table, write, buffer, lenp, ppos);
 #ifdef HAVE_5ARGS_SYSCTL_PROC_HANDLER
 #define ll_proc_dointvec(table, write, filp, buffer, lenp, ppos)        \
         proc_dointvec(table, write, buffer, lenp, ppos);
index 2e31e88..1b16ca7 100644 (file)
@@ -76,7 +76,7 @@ static inline int test_bit(int nr, const unsigned long *addr)
 }
 
 /* using binary seach */
 }
 
 /* using binary seach */
-static __inline__ unsigned long __cfs_fls(long data)
+static __inline__ unsigned long fls(long data)
 {
        int pos = 32;
 
 {
        int pos = 32;
 
@@ -147,8 +147,8 @@ static __inline__ unsigned long __cfs_ffs(long data)
         return pos;
 }
 
         return pos;
 }
 
-#define __cfs_ffz(x)   __cfs_ffs(~(x))
-#define __cfs_flz(x)   __cfs_fls(~(x))
+#define ffz(x)         ffs(~(x))
+#define flz(x)         fls(~(x))
 
 unsigned long find_next_bit(unsigned long *addr,
                            unsigned long size, unsigned long offset);
 
 unsigned long find_next_bit(unsigned long *addr,
                            unsigned long size, unsigned long offset);
index 0e44c99..5e46cc3 100644 (file)
  * Signal
  */
 
  * Signal
  */
 
-#define SIGNAL_MASK_ASSERT()                    do {} while(0)
 #define SIGNAL_MASK_LOCK(task, flags)           do {} while(0)
 #define SIGNAL_MASK_UNLOCK(task, flags)         do {} while(0)
 #define SIGNAL_MASK_LOCK(task, flags)           do {} while(0)
 #define SIGNAL_MASK_UNLOCK(task, flags)         do {} while(0)
-#define USERMODEHELPER(path, argv, envp)        do {} while(0)
-#define RECALC_SIGPENDING                       do {} while(0)
-#define CLEAR_SIGPENDING                        do {} while(0)
-#define CURRENT_SECONDS                         get_seconds()
+#define call_usermodehelper(path, argv, envp, 1)       do {} while(0)
+#define recalc_sigpending()                            do {} while(0)
+#define clear_tsk_thread_flag(current, TIF_SIGPENDING) do {} while(0)
 #endif
 
 #define ll_proc_dointvec(table, write, filp, buffer, lenp, ppos)        \
 #endif
 
 #define ll_proc_dointvec(table, write, filp, buffer, lenp, ppos)        \
index 99cee77..58603ef 100644 (file)
@@ -648,25 +648,26 @@ do {                                                            \
         cfs_waitq_del(&wq, &__wait);                           \
 } while(0)
 
         cfs_waitq_del(&wq, &__wait);                           \
 } while(0)
 
-#define cfs_wait_event_interruptible(wq, condition, __ret)      \
-do {                                                            \
-        cfs_waitlink_t __wait;                                 \
-                                                                \
-        __ret = 0;                                              \
-        cfs_waitlink_init(&__wait);                             \
-        while (TRUE) {                                          \
-            cfs_waitq_add(&wq, &__wait);                       \
-            if (condition) {                                    \
-                break;                                          \
-            }                                                   \
-            cfs_waitq_wait(&__wait, CFS_TASK_INTERRUPTIBLE);    \
-            cfs_waitq_del(&wq, &__wait);                       \
-        }                                                       \
-        cfs_waitq_del(&wq, &__wait);                            \
-} while(0)
+#define wait_event_interruptible(wq, condition)                 \
+{                                                               \
+       cfs_waitlink_t __wait;                                  \
+                                                               \
+       __ret = 0;                                              \
+       cfs_waitlink_init(&__wait);                             \
+       while (TRUE) {                                          \
+               cfs_waitq_add(&wq, &__wait);                    \
+               if (condition) {                                \
+                       break;                                  \
+               }                                               \
+               cfs_waitq_wait(&__wait, CFS_TASK_INTERRUPTIBLE);\
+               cfs_waitq_del(&wq, &__wait);                    \
+       }                                                       \
+       cfs_waitq_del(&wq, &__wait);                            \
+       __ret;                                                  \
+}
 
 
-# define cfs_wait_event_interruptible_exclusive(wq, condition, rc)  \
-         cfs_wait_event_interruptible(wq, condition, rc)
+# define wait_event_interruptible_exclusive(wq, condition)  \
+        wait_event_interruptible(wq, condition)
 
 /*
    retval == 0; condition met; we're good.
 
 /*
    retval == 0; condition met; we're good.
@@ -836,7 +837,7 @@ libcfs_arch_cleanup(void);
 
 
 #define SMP_CACHE_BYTES             128
 
 
 #define SMP_CACHE_BYTES             128
-#define CFS_NR_CPUS                 (32)
+#define NR_CPUS                 (32)
 #define smp_num_cpus                ((CCHAR)KeNumberProcessors)
 #define num_possible_cpus()     smp_num_cpus
 #define num_online_cpus()       smp_num_cpus
 #define smp_num_cpus                ((CCHAR)KeNumberProcessors)
 #define num_possible_cpus()     smp_num_cpus
 #define num_online_cpus()       smp_num_cpus
@@ -881,8 +882,6 @@ libcfs_arch_cleanup(void);
 #define local_irq_save(x)
 #define local_irq_restore(x)
 
 #define local_irq_save(x)
 #define local_irq_restore(x)
 
-#define THREAD_NAME
-
 #define va_copy(_d, _s)                 (_d = _s)
 
 char *strnchr(const char *s, size_t count, int c);
 #define va_copy(_d, _s)                 (_d = _s)
 
 char *strnchr(const char *s, size_t count, int c);
index c6c349b..f23440d 100644 (file)
@@ -2119,7 +2119,7 @@ int cfs_hash_debug_str(cfs_hash_t *hs, char *str, int size)
 #endif
                 }
                 total += bd.bd_bucket->hsb_count;
 #endif
                 }
                 total += bd.bd_bucket->hsb_count;
-                dist[min(__cfs_fls(bd.bd_bucket->hsb_count/max(theta,1)),7)]++;
+                dist[min(fls(bd.bd_bucket->hsb_count/max(theta,1)),7)]++;
                 cfs_hash_bd_unlock(hs, &bd, 0);
         }
 
                 cfs_hash_bd_unlock(hs, &bd, 0);
         }
 
index 569bdf0..4d0f4df 100644 (file)
@@ -94,7 +94,7 @@ void libcfs_run_debug_log_upcall(char *file)
 
         argv[2] = NULL;
 
 
         argv[2] = NULL;
 
-        rc = USERMODEHELPER(argv[0], argv, envp);
+        rc = call_usermodehelper(argv[0], argv, envp, 1);
         if (rc < 0 && rc != -ENOENT) {
                 CERROR("Error %d invoking LNET debug log upcall %s %s; "
                        "check /proc/sys/lnet/debug_log_upcall\n",
         if (rc < 0 && rc != -ENOENT) {
                 CERROR("Error %d invoking LNET debug log upcall %s %s; "
                        "check /proc/sys/lnet/debug_log_upcall\n",
@@ -124,7 +124,7 @@ void libcfs_run_upcall(char **argv)
 
         LASSERT(argc >= 2);
 
 
         LASSERT(argc >= 2);
 
-        rc = USERMODEHELPER(argv[0], argv, envp);
+        rc = call_usermodehelper(argv[0], argv, envp, 1);
         if (rc < 0 && rc != -ENOENT) {
                 CERROR("Error %d invoking LNET upcall %s %s%s%s%s%s%s%s%s; "
                        "check /proc/sys/lnet/upcall\n",
         if (rc < 0 && rc != -ENOENT) {
                 CERROR("Error %d invoking LNET upcall %s %s%s%s%s%s%s%s%s; "
                        "check /proc/sys/lnet/upcall\n",
index e399b77..27d95e9 100644 (file)
@@ -262,16 +262,15 @@ void cfs_enter_debugger(void)
 sigset_t
 cfs_block_allsigs(void)
 {
 sigset_t
 cfs_block_allsigs(void)
 {
-        unsigned long          flags;
-        sigset_t        old;
-
-        SIGNAL_MASK_LOCK(current, flags);
-        old = current->blocked;
-        sigfillset(&current->blocked);
-        RECALC_SIGPENDING;
-        SIGNAL_MASK_UNLOCK(current, flags);
+       unsigned long   flags;
+       sigset_t        old;
 
 
-        return old;
+       spin_lock_irqsave(&current->sighand->siglock, flags);
+       old = current->blocked;
+       sigfillset(&current->blocked);
+       recalc_sigpending();
+       spin_unlock_irqrestore(&current->sighand->siglock, flags);
+       return old;
 }
 
 sigset_t cfs_block_sigs(unsigned long sigs)
 }
 
 sigset_t cfs_block_sigs(unsigned long sigs)
@@ -279,11 +278,11 @@ sigset_t cfs_block_sigs(unsigned long sigs)
        unsigned long  flags;
        sigset_t        old;
 
        unsigned long  flags;
        sigset_t        old;
 
-       SIGNAL_MASK_LOCK(current, flags);
+       spin_lock_irqsave(&current->sighand->siglock, flags);
        old = current->blocked;
        sigaddsetmask(&current->blocked, sigs);
        old = current->blocked;
        sigaddsetmask(&current->blocked, sigs);
-       RECALC_SIGPENDING;
-       SIGNAL_MASK_UNLOCK(current, flags);
+       recalc_sigpending();
+       spin_unlock_irqrestore(&current->sighand->siglock, flags);
        return old;
 }
 
        return old;
 }
 
@@ -293,40 +292,39 @@ sigset_t cfs_block_sigsinv(unsigned long sigs)
        unsigned long flags;
        sigset_t old;
 
        unsigned long flags;
        sigset_t old;
 
-       SIGNAL_MASK_LOCK(current, flags);
+       spin_lock_irqsave(&current->sighand->siglock, flags);
        old = current->blocked;
        sigaddsetmask(&current->blocked, ~sigs);
        old = current->blocked;
        sigaddsetmask(&current->blocked, ~sigs);
-       RECALC_SIGPENDING;
-       SIGNAL_MASK_UNLOCK(current, flags);
-
+       recalc_sigpending();
+       spin_unlock_irqrestore(&current->sighand->siglock, flags);
        return old;
 }
 
 void
 cfs_restore_sigs (cfs_sigset_t old)
 {
        return old;
 }
 
 void
 cfs_restore_sigs (cfs_sigset_t old)
 {
-        unsigned long  flags;
+       unsigned long  flags;
 
 
-        SIGNAL_MASK_LOCK(current, flags);
-        current->blocked = old;
-        RECALC_SIGPENDING;
-        SIGNAL_MASK_UNLOCK(current, flags);
+       spin_lock_irqsave(&current->sighand->siglock, flags);
+       current->blocked = old;
+       recalc_sigpending();
+       spin_unlock_irqrestore(&current->sighand->siglock, flags);
 }
 
 int
 cfs_signal_pending(void)
 {
 }
 
 int
 cfs_signal_pending(void)
 {
-        return signal_pending(current);
+       return signal_pending(current);
 }
 
 void
 cfs_clear_sigpending(void)
 {
 }
 
 void
 cfs_clear_sigpending(void)
 {
-        unsigned long flags;
+       unsigned long flags;
 
 
-        SIGNAL_MASK_LOCK(current, flags);
-        CLEAR_SIGPENDING;
-        SIGNAL_MASK_UNLOCK(current, flags);
+       spin_lock_irqsave(&current->sighand->siglock, flags);
+       clear_tsk_thread_flag(current, TIF_SIGPENDING);
+       spin_unlock_irqrestore(&current->sighand->siglock, flags);
 }
 
 int
 }
 
 int
index 3f7df0d..72db8c8 100644 (file)
@@ -44,7 +44,7 @@
 
 #if !KLWT_SUPPORT
 int         lwt_enabled;
 
 #if !KLWT_SUPPORT
 int         lwt_enabled;
-lwt_cpu_t   lwt_cpus[CFS_NR_CPUS];
+lwt_cpu_t   lwt_cpus[NR_CPUS];
 #endif
 
 int         lwt_pages_per_cpu;
 #endif
 
 int         lwt_pages_per_cpu;
index 03f908f..2a8af1c 100644 (file)
@@ -47,7 +47,7 @@
 #include <libcfs/libcfs.h>
 
 /* XXX move things up to the top, comment */
 #include <libcfs/libcfs.h>
 
 /* XXX move things up to the top, comment */
-union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[CFS_NR_CPUS] __cacheline_aligned;
+union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS] __cacheline_aligned;
 
 char cfs_tracefile[TRACEFILE_NAME_SIZE];
 long long cfs_tracefile_size = CFS_TRACEFILE_SIZE;
 
 char cfs_tracefile[TRACEFILE_NAME_SIZE];
 long long cfs_tracefile_size = CFS_TRACEFILE_SIZE;
index 1bdf0a5..50e657b 100644 (file)
@@ -187,7 +187,7 @@ union cfs_trace_data_union {
 };
 
 #define TCD_MAX_TYPES      8
 };
 
 #define TCD_MAX_TYPES      8
-extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[CFS_NR_CPUS];
+extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS];
 
 #define cfs_tcd_for_each(tcd, i, j)                                      \
     for (i = 0; cfs_trace_data[i] != NULL; i++)                                  \
 
 #define cfs_tcd_for_each(tcd, i, j)                                      \
     for (i = 0; cfs_trace_data[i] != NULL; i++)                                  \
@@ -276,7 +276,7 @@ extern void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking);
  * (see, for example, linux-tracefile.h).
  */
 
  * (see, for example, linux-tracefile.h).
  */
 
-extern char *cfs_trace_console_buffers[CFS_NR_CPUS][CFS_TCD_TYPE_MAX];
+extern char *cfs_trace_console_buffers[NR_CPUS][CFS_TCD_TYPE_MAX];
 extern cfs_trace_buf_type_t cfs_trace_buf_idx_get(void);
 
 static inline char *cfs_trace_get_console_buffer(void)
 extern cfs_trace_buf_type_t cfs_trace_buf_idx_get(void);
 
 static inline char *cfs_trace_get_console_buffer(void)
index 870ad54..65f2da9 100644 (file)
@@ -89,7 +89,7 @@ unsigned long find_next_zero_bit(unsigned long *addr,
                 return size;
         if (first_bit != 0) {
                 int tmp = (*word++) & (~0UL << first_bit);
                 return size;
         if (first_bit != 0) {
                 int tmp = (*word++) & (~0UL << first_bit);
-                bit = __cfs_ffz(tmp);
+                bit = ffz(tmp);
                 if (bit < BITS_PER_LONG)
                         goto found;
                 word++;
                 if (bit < BITS_PER_LONG)
                         goto found;
                 word++;
@@ -97,7 +97,7 @@ unsigned long find_next_zero_bit(unsigned long *addr,
         }
         while (word <= last) {
                 if (*word != ~0UL) {
         }
         while (word <= last) {
                 if (*word != ~0UL) {
-                        bit = __cfs_ffz(*word);
+                        bit = ffz(*word);
                         goto found;
                 }
                 word++;
                         goto found;
                 }
                 word++;
index a2bfbbe..2c6d67e 100644 (file)
@@ -215,8 +215,8 @@ static int lcw_dispatch_main(void *data)
         while (1) {
                 int dumplog = 1;
 
         while (1) {
                 int dumplog = 1;
 
-                cfs_wait_event_interruptible(lcw_event_waitq,
-                                             is_watchdog_fired(), rc);
+               rc = wait_event_interruptible(lcw_event_waitq,
+                                             is_watchdog_fired());
                 CDEBUG(D_INFO, "Watchdog got woken up...\n");
                if (test_bit(LCW_FLAG_STOP, &lcw_flags)) {
                        CDEBUG(D_INFO, "LCW_FLAG_STOP set, shutting down...\n");
                 CDEBUG(D_INFO, "Watchdog got woken up...\n");
                if (test_bit(LCW_FLAG_STOP, &lcw_flags)) {
                        CDEBUG(D_INFO, "LCW_FLAG_STOP set, shutting down...\n");
index c87e36d..4404e3a 100644 (file)
@@ -46,7 +46,7 @@ static unsigned int pages_factor[CFS_TCD_TYPE_MAX] = {
         10   /* 10% pages for CFS_TCD_TYPE_DISPATCH */
 };
 
         10   /* 10% pages for CFS_TCD_TYPE_DISPATCH */
 };
 
-char *cfs_trace_console_buffers[CFS_NR_CPUS][CFS_TCD_TYPE_MAX];
+char *cfs_trace_console_buffers[NR_CPUS][CFS_TCD_TYPE_MAX];
 
 struct rw_semaphore cfs_tracefile_sem;
 
 
 struct rw_semaphore cfs_tracefile_sem;
 
@@ -63,7 +63,7 @@ int cfs_tracefile_init_arch()
        for (i = 0; i < CFS_TCD_TYPE_MAX; i++) {
                cfs_trace_data[i] =
                        kmalloc(sizeof(union cfs_trace_data_union) * \
        for (i = 0; i < CFS_TCD_TYPE_MAX; i++) {
                cfs_trace_data[i] =
                        kmalloc(sizeof(union cfs_trace_data_union) * \
-                                 CFS_NR_CPUS, GFP_KERNEL);
+                                 NR_CPUS, GFP_KERNEL);
                if (cfs_trace_data[i] == NULL)
                        goto out;
        }
                if (cfs_trace_data[i] == NULL)
                        goto out;
        }
index 60c037b..b56d266 100644 (file)
@@ -312,10 +312,10 @@ cfs_wi_scheduler (void *arg)
                         continue;
                 }
 
                         continue;
                 }
 
-                cfs_wi_sched_unlock(sched);
-                cfs_wait_event_interruptible_exclusive(sched->ws_waitq,
-                                !cfs_wi_sched_cansleep(sched), rc);
-                cfs_wi_sched_lock(sched);
+               cfs_wi_sched_unlock(sched);
+               rc = wait_event_interruptible_exclusive(sched->ws_waitq,
+                               !cfs_wi_sched_cansleep(sched));
+               cfs_wi_sched_lock(sched);
         }
 
         cfs_wi_sched_unlock(sched);
         }
 
         cfs_wi_sched_unlock(sched);
index 50cc744..a469d3d 100644 (file)
@@ -1755,15 +1755,15 @@ kqswnal_scheduler (void *arg)
                                          * when there's nothing left to do */
                                         break;
                                 }
                                          * when there's nothing left to do */
                                         break;
                                 }
-                                cfs_wait_event_interruptible_exclusive (
-                                        kqswnal_data.kqn_sched_waitq,
-                                        kqswnal_data.kqn_shuttingdown == 2 ||
-                                        !cfs_list_empty(&kqswnal_data. \
-                                                        kqn_readyrxds) ||
-                                        !cfs_list_empty(&kqswnal_data. \
-                                                        kqn_donetxds) ||
-                                        !cfs_list_empty(&kqswnal_data. \
-                                                        kqn_delayedtxds, rc));
+                               rc = wait_event_interruptible_exclusive (
+                                       kqswnal_data.kqn_sched_waitq,
+                                       kqswnal_data.kqn_shuttingdown == 2 ||
+                                       !cfs_list_empty(&kqswnal_data. \
+                                                       kqn_readyrxds) ||
+                                       !cfs_list_empty(&kqswnal_data. \
+                                                       kqn_donetxds) ||
+                                       !cfs_list_empty(&kqswnal_data. \
+                                                       kqn_delayedtxds));
                                 LASSERT (rc == 0);
                         } else if (need_resched())
                                 cfs_schedule ();
                                 LASSERT (rc == 0);
                         } else if (need_resched())
                                 cfs_schedule ();
index 8b92cdc..a3cbb3b 100644 (file)
@@ -321,20 +321,19 @@ typedef struct kra_conn
 #define RANAL_CONN_CLOSING         1
 #define RANAL_CONN_CLOSED          2
 
 #define RANAL_CONN_CLOSING         1
 #define RANAL_CONN_CLOSED          2
 
-typedef struct kra_peer
-{
-        cfs_list_t          rap_list;         /* stash on global peer list */
-        cfs_list_t          rap_connd_list;   /* schedule on kra_connd_peers */
-        cfs_list_t          rap_conns;        /* all active connections */
-        cfs_list_t          rap_tx_queue;     /* msgs waiting for a conn */
-        lnet_nid_t          rap_nid;          /* who's on the other end(s) */
-        __u32               rap_ip;           /* IP address of peer */
-        int                 rap_port;         /* port on which peer listens */
-        cfs_atomic_t        rap_refcount;     /* # users */
-        int                 rap_persistence;  /* "known" peer refs */
-        int                 rap_connecting;   /* connection forming */
-        unsigned long       rap_reconnect_time; /* CURRENT_SECONDS when reconnect OK */
-        unsigned long       rap_reconnect_interval; /* exponential backoff */
+typedef struct kra_peer {
+       cfs_list_t          rap_list;         /* stash on global peer list */
+       cfs_list_t          rap_connd_list;   /* schedule on kra_connd_peers */
+       cfs_list_t          rap_conns;        /* all active connections */
+       cfs_list_t          rap_tx_queue;     /* msgs waiting for a conn */
+       lnet_nid_t          rap_nid;          /* who's on the other end(s) */
+       __u32               rap_ip;           /* IP address of peer */
+       int                 rap_port;         /* port on which peer listens */
+       cfs_atomic_t        rap_refcount;     /* # users */
+       int                 rap_persistence;  /* "known" peer refs */
+       int                 rap_connecting;   /* connection forming */
+       unsigned long       rap_reconnect_time; /* get_seconds() when reconnect OK */
+       unsigned long       rap_reconnect_interval; /* exponential backoff */
 } kra_peer_t;
 
 extern kra_data_t      kranal_data;
 } kra_peer_t;
 
 extern kra_data_t      kranal_data;
index e624753..c97cf2b 100644 (file)
@@ -1538,10 +1538,10 @@ int ksocknal_scheduler(void *arg)
                         nloops = 0;
 
                         if (!did_something) {   /* wait for something to do */
                         nloops = 0;
 
                         if (!did_something) {   /* wait for something to do */
-                                cfs_wait_event_interruptible_exclusive(
-                                        sched->kss_waitq,
-                                        !ksocknal_sched_cansleep(sched), rc);
-                                LASSERT (rc == 0);
+                               rc = wait_event_interruptible_exclusive(
+                                       sched->kss_waitq,
+                                       !ksocknal_sched_cansleep(sched));
+                               LASSERT (rc == 0);
                         } else {
                                 cfs_cond_resched();
                         }
                         } else {
                                 cfs_cond_resched();
                         }
index 6fbf455..62598e1 100644 (file)
@@ -282,24 +282,23 @@ int cfs_curproc_is_in_groups(gid_t gid);
 
 #define cfs_set_current_state(foo) do { current->state = foo; } while (0)
 
 
 #define cfs_set_current_state(foo) do { current->state = foo; } while (0)
 
-#define cfs_wait_event_interruptible(wq, condition, ret)                \
+#define wait_event_interruptible(wq, condition)                         \
 {                                                                       \
 {                                                                       \
-        struct l_wait_info lwi;                                         \
-        int timeout = 100000000;/* for ever */                          \
-        int ret;                                                        \
-                                                                        \
-        lwi = LWI_TIMEOUT(timeout, NULL, NULL);                         \
-        ret = l_wait_event(NULL, condition, &lwi);                      \
-                                                                        \
-        ret;                                                            \
+       struct l_wait_info lwi;                                         \
+       int timeout = 100000000;/* forever */                           \
+       int ret;                                                        \
+                                                                       \
+       lwi = LWI_TIMEOUT(timeout, NULL, NULL);                         \
+       ret = l_wait_event(NULL, condition, &lwi);                      \
+                                                                       \
+       ret;                                                            \
 }
 
 #define daemonize(l) do {} while (0)
 #define sigfillset(l) do {} while (0)
 #define recalc_sigpending(l) do {} while (0)
 
 }
 
 #define daemonize(l) do {} while (0)
 #define sigfillset(l) do {} while (0)
 #define recalc_sigpending(l) do {} while (0)
 
-#define USERMODEHELPER(path, argv, envp) (0)
-#define SIGNAL_MASK_ASSERT()
+#define call_usermodehelper(path, argv, envp, wait) (0)
 #define CFS_KERN_INFO
 
 #if HZ != 1
 #define CFS_KERN_INFO
 
 #if HZ != 1
index c481674..adeb287 100644 (file)
@@ -772,14 +772,14 @@ do {                                                                           \
                                 ret = -EINTR;                                  \
                                 break;                                         \
                         }                                                      \
                                 ret = -EINTR;                                  \
                                 break;                                         \
                         }                                                      \
-                        /* We have to do this here because some signals */     \
-                        /* are not blockable - ie from strace(1).       */     \
-                        /* In these cases we want to schedule_timeout() */     \
-                        /* again, because we don't want that to return  */     \
-                        /* -EINTR when the RPC actually succeeded.      */     \
-                        /* the RECALC_SIGPENDING below will deliver the */     \
-                        /* signal properly.                             */     \
-                        cfs_clear_sigpending();                                \
+                       /* We have to do this here because some signals */     \
+                       /* are not blockable - ie from strace(1).       */     \
+                       /* In these cases we want to schedule_timeout() */     \
+                       /* again, because we don't want that to return  */     \
+                       /* -EINTR when the RPC actually succeeded.      */     \
+                       /* the recalc_sigpending() below will deliver the */   \
+                       /* signal properly.                             */     \
+                       cfs_clear_sigpending();                                \
                 }                                                              \
         }                                                                      \
                                                                                \
                 }                                                              \
         }                                                                      \
                                                                                \
index da22aaa..1d94806 100644 (file)
@@ -126,7 +126,7 @@ static int mdt_identity_do_upcall(struct upcall_cache *cache,
         snprintf(keystr, sizeof(keystr), LPU64, entry->ue_key);
 
        do_gettimeofday(&start);
         snprintf(keystr, sizeof(keystr), LPU64, entry->ue_key);
 
        do_gettimeofday(&start);
-       rc = USERMODEHELPER(argv[0], argv, envp);
+       rc = call_usermodehelper(argv[0], argv, envp, 1);
        do_gettimeofday(&end);
        if (rc < 0) {
                 CERROR("%s: error invoking upcall %s %s %s: rc %d; "
        do_gettimeofday(&end);
        if (rc < 0) {
                 CERROR("%s: error invoking upcall %s %s %s: rc %d; "
index 645e56b..ecaa4a9 100644 (file)
@@ -1071,7 +1071,7 @@ static int process_param2_config(struct lustre_cfg *lcfg)
        }
 
        do_gettimeofday(&start);
        }
 
        do_gettimeofday(&start);
-       rc = USERMODEHELPER(argv[0], argv, NULL);
+       rc = call_usermodehelper(argv[0], argv, NULL, 0);
        do_gettimeofday(&end);
 
        if (rc < 0) {
        do_gettimeofday(&end);
 
        if (rc < 0) {
index a3e6fea..883cb90 100644 (file)
@@ -2041,8 +2041,6 @@ int ptlrpc_set_next_timeout(struct ptlrpc_request_set *set)
         int                    deadline;
         ENTRY;
 
         int                    deadline;
         ENTRY;
 
-        SIGNAL_MASK_ASSERT(); /* XXX BUG 1511 */
-
         cfs_list_for_each(tmp, &set->set_requests) {
                 req = cfs_list_entry(tmp, struct ptlrpc_request, rq_set_chain);
 
         cfs_list_for_each(tmp, &set->set_requests) {
                 req = cfs_list_entry(tmp, struct ptlrpc_request, rq_set_chain);