Whamcloud - gitweb
LU-1346 libcfs: tcpip/time/type related cleanup 77/4777/8
authorJames Simmons <uja.ornl@gmail.com>
Tue, 16 Jul 2013 16:03:29 +0000 (12:03 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 22 Aug 2013 20:45:42 +0000 (20:45 +0000)
Cleanup some macros in linux-tcpip.h, linux-time.h, linux-type.h.
Move some different kernel compatible macros to portals_compat25.h.

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: Ia03046ff53a5f51e67d2fe7ccee7a6441ebe1dc7
Reviewed-on: http://review.whamcloud.com/4777
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
78 files changed:
contrib/scripts/libcfs_cleanup.sed
libcfs/include/libcfs/curproc.h
libcfs/include/libcfs/darwin/libcfs.h
libcfs/include/libcfs/linux/Makefile.am
libcfs/include/libcfs/linux/libcfs.h
libcfs/include/libcfs/linux/linux-tcpip.h
libcfs/include/libcfs/linux/linux-time.h
libcfs/include/libcfs/linux/linux-types.h [deleted file]
libcfs/include/libcfs/linux/portals_compat25.h
libcfs/include/libcfs/posix/libcfs.h
libcfs/include/libcfs/posix/posix-types.h
libcfs/include/libcfs/winnt/libcfs.h
libcfs/include/libcfs/winnt/winnt-lock.h
libcfs/include/libcfs/winnt/winnt-prim.h
libcfs/include/libcfs/winnt/winnt-time.h
libcfs/include/libcfs/winnt/winnt-types.h
libcfs/libcfs/linux/linux-curproc.c
libcfs/libcfs/linux/linux-tcpip.c
libcfs/libcfs/winnt/winnt-native.c
libcfs/libcfs/winnt/winnt-prim.c
libcfs/libcfs/winnt/winnt-tracefile.c
lnet/klnds/mxlnd/mxlnd.c
lnet/klnds/mxlnd/mxlnd.h
lnet/klnds/mxlnd/mxlnd_cb.c
lnet/klnds/o2iblnd/o2iblnd.c
lnet/klnds/o2iblnd/o2iblnd.h
lnet/klnds/o2iblnd/o2iblnd_cb.c
lnet/klnds/ptllnd/ptllnd.c
lnet/klnds/ptllnd/ptllnd_cb.c
lnet/klnds/ptllnd/ptllnd_peer.c
lnet/klnds/ralnd/ralnd.c
lnet/klnds/ralnd/ralnd_cb.c
lnet/klnds/socklnd/socklnd.c
lnet/lnet/api-ni.c
lnet/lnet/router.c
lnet/selftest/brw_test.c
lustre/include/darwin/lvfs.h
lustre/include/dt_object.h
lustre/include/liblustre.h
lustre/include/linux/lustre_fsfilt.h
lustre/include/linux/lvfs.h
lustre/include/linux/obd.h
lustre/ldlm/ldlm_lib.c
lustre/ldlm/ldlm_resource.c
lustre/lfsck/lfsck_internal.h
lustre/lfsck/lfsck_lib.c
lustre/lfsck/lfsck_namespace.c
lustre/llite/lproc_llite.c
lustre/llite/super25.c
lustre/lod/lod_object.c
lustre/mdd/mdd_internal.h
lustre/mdd/mdd_object.c
lustre/mdd/mdd_orphans.c
lustre/mdt/mdt_capa.c
lustre/mdt/mdt_identity.c
lustre/mgc/mgc_request.c
lustre/obdclass/lprocfs_status.c
lustre/obdclass/lustre_handles.c
lustre/obdclass/obd_config.c
lustre/obdecho/echo_client.c
lustre/ofd/lproc_ofd.c
lustre/ofd/ofd_internal.h
lustre/osc/lproc_osc.c
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_io.c
lustre/osd-ldiskfs/osd_lproc.c
lustre/osd-ldiskfs/osd_scrub.c
lustre/osd-zfs/osd_object.c
lustre/osp/osp_md_object.c
lustre/ptlrpc/client.c
lustre/ptlrpc/events.c
lustre/ptlrpc/gss/gss_keyring.c
lustre/ptlrpc/gss/gss_svc_upcall.c
lustre/ptlrpc/niobuf.c
lustre/ptlrpc/sec.c
lustre/ptlrpc/sec_bulk.c
lustre/ptlrpc/sec_gc.c
lustre/ptlrpc/service.c

index 59fc449..8861609 100644 (file)
@@ -379,3 +379,24 @@ s/\bcfs_get_cpu\b/get_cpu/g
 /#[ \t]*define[ \t]*\bget_cpu\b *( *)[ \t]*\bget_cpu\b *( *)/d
 s/\bcfs_put_cpu\b/put_cpu/g
 /#[ \t]*define[ \t]*\bput_cpu\b *( *)[ \t]*\bput_cpu\b *( *)/d
+
+################################################################################
+# macros in linux-time.h
+s/\bCFS_HZ\b/HZ/g
+/#[ \t]*define[ \t]*\bHZ\b[ \t]*\bHZ\b/d
+s/\bCURRENT_KERN_TIME\b/CURRENT_TIME/g
+/#[ \t]*define[ \t]*\bCURRENT_TIME\b[ \t]*\bCURRENT_TIME\b/d
+s/\bcfs_gettimeofday\b/do_gettimeofday/g
+/#[ \t]*define[ \t]*\bdo_gettimeofday\b *( *\w* *)[ \t]*\bdo_gettimeofday\b *( *\w* *)/d
+
+################################################################################
+# macros in linux-type.h
+s/\bcfs_umode_t\b/umode_t/g
+/typedef[ \t]*\bumode_t\b[ \t]*\bumode_t\b/d
+
+################################################################################
+# macros in libcfs/include/libcfs/linux/libcfs.h
+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
index 2c7f413..e8ac036 100644 (file)
@@ -65,7 +65,7 @@ char  *cfs_curproc_comm(void);
  *
  * and opaque scalar type
  *
- * cfs_kernel_cap_t
+ * kernel_cap_t
  */
 #endif
 uid_t  cfs_curproc_uid(void);
index 560c63f..8f05975 100644 (file)
@@ -95,7 +95,6 @@ typedef unsigned long long cycles_t;
 #else
 # define THREAD_SIZE 8192
 #endif
-#define LUSTRE_TRACE_SIZE (THREAD_SIZE >> 5)
 
 #define CHECK_STACK(msgdata, mask, cdls) do {} while(0)
 #define CDEBUG_STACK() (0L)
@@ -190,7 +189,7 @@ __entry_nesting(&__cdd);
 /*
  * XNU has no capabilities
  */
-typedef __u32 cfs_kernel_cap_t;
+typedef __u32 kernel_cap_t;
 
 #ifdef __KERNEL__
 enum {
index 68cb94e..6e96ffe 100644 (file)
@@ -1,3 +1,3 @@
 EXTRA_DIST = kp30.h libcfs.h linux-fs.h linux-lock.h linux-mem.h       \
        linux-prim.h linux-time.h linux-tcpip.h linux-cpu.h             \
-       portals_compat25.h linux-bitops.h linux-types.h linux-crypto.h
+       portals_compat25.h linux-bitops.h linux-crypto.h
index c98dcdb..11a2709 100644 (file)
@@ -55,7 +55,6 @@
 #include <libcfs/linux/linux-fs.h>
 #include <libcfs/linux/linux-tcpip.h>
 #include <libcfs/linux/linux-bitops.h>
-#include <libcfs/linux/linux-types.h>
 #include <libcfs/linux/kp30.h>
 
 #ifdef HAVE_ASM_TYPES_H
@@ -66,8 +65,6 @@
 #include <linux/sched.h> /* THREAD_SIZE */
 #include <linux/rbtree.h>
 
-#define CFS_THREAD_SIZE   THREAD_SIZE
-#define LUSTRE_TRACE_SIZE (THREAD_SIZE >> 5)
 
 #if !defined(__x86_64__)
 # ifdef  __ia64__
@@ -116,7 +113,6 @@ do {                                                                    \
 #define CFS_CURPROC_COMM_MAX (sizeof ((struct task_struct *)0)->comm)
 
 #include <linux/capability.h>
-typedef kernel_cap_t cfs_kernel_cap_t;
 
 /*
  * No stack-back-tracing in Linux for now.
index b79aac7..2e04b1f 100644 (file)
@@ -50,6 +50,7 @@
 #endif
 
 #include <net/sock.h>
+#include <libcfs/linux/portals_compat25.h>
 
 #ifndef HIPQUAD
 // XXX Should just kill all users
@@ -68,7 +69,6 @@
 
 typedef struct socket   cfs_socket_t;
 
-#define SOCK_SNDBUF(so)         ((so)->sk->sk_sndbuf)
 #define SOCK_TEST_NOSPACE(so)   test_bit(SOCK_NOSPACE, &(so)->flags)
 
 static inline int
@@ -82,13 +82,4 @@ libcfs_sock_wmem_queued(struct socket *sock)
 {
         return sock->sk->sk_wmem_queued;
 }
-
-#ifndef HAVE_SK_SLEEP
-static inline wait_queue_head_t *cfs_sk_sleep(struct sock *sk)
-{
-        return sk->sk_sleep;
-}
-#else
-#define cfs_sk_sleep(sk)       sk_sleep(sk)
-#endif
 #endif
index cb274c4..6fcb751 100644 (file)
@@ -90,7 +90,6 @@
 
 #define ONE_BILLION ((u_int64_t)1000000000)
 #define ONE_MILLION 1000000
-#define CFS_HZ      HZ
 
 #ifndef __KERNEL__
 #error This include is only for kernel use.
@@ -131,7 +130,6 @@ static inline unsigned long long __cfs_fs_time_flat(cfs_fs_time_t *t)
         return (unsigned long long)t->tv_sec * ONE_BILLION + t->tv_nsec;
 }
 
-#define CURRENT_KERN_TIME        CURRENT_TIME
 
 /*
  * Generic kernel stuff
@@ -163,7 +161,7 @@ static inline time_t cfs_time_current_sec(void)
 
 static inline void cfs_fs_time_current(cfs_fs_time_t *t)
 {
-        *t = CURRENT_KERN_TIME;
+       *t = CURRENT_TIME;
 }
 
 static inline time_t cfs_fs_time_sec(cfs_fs_time_t *t)
@@ -270,7 +268,6 @@ static inline int cfs_time_beforeq_64(__u64 t1, __u64 t2)
 #define CFS_TIME_T              "%lu"
 #define CFS_DURATION_T          "%ld"
 
-#define cfs_gettimeofday(tv) do_gettimeofday(tv)
 
 #endif /* __LIBCFS_LINUX_LINUX_TIME_H__ */
 /*
diff --git a/libcfs/include/libcfs/linux/linux-types.h b/libcfs/include/libcfs/linux/linux-types.h
deleted file mode 100644 (file)
index f5eeec7..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * libcfs/include/libcfs/user-bitops.h
- */
-#include <linux/types.h>
-
-typedef umode_t cfs_umode_t;
index f9d9f84..411d618 100644 (file)
@@ -37,6 +37,8 @@
 #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() \
@@ -111,4 +113,11 @@ int proc_call_handler(void *data, int write,
                       int (*handler)(void *data, int write,
                                      loff_t pos, void *buffer, int len));
 
+#ifdef HAVE_INIT_NET
+# define DEFAULT_NET   (&init_net)
+#else
+/* some broken backports */
+# define DEFAULT_NET   (NULL)
+#endif
+
 #endif /* _PORTALS_COMPAT_H */
index 4a11e71..d03f4d4 100644 (file)
 #include <libcfs/posix/posix-wordsize.h>
 #include <libcfs/user-bitops.h>
 
-# define cfs_gettimeofday(tv) gettimeofday(tv, NULL);
+# define do_gettimeofday(tv) gettimeofday(tv, NULL);
 typedef unsigned long long cfs_cycles_t;
 
 #define IS_ERR(a) ((unsigned long)(a) > (unsigned long)-1000L)
@@ -199,13 +199,10 @@ typedef unsigned long long cfs_cycles_t;
 #endif
 
 # ifndef THREAD_SIZE /* x86_64 linux has THREAD_SIZE in userspace */
-#  define CFS_THREAD_SIZE 8192
+#  define THREAD_SIZE 8192
 # else
-#  define CFS_THREAD_SIZE THREAD_SIZE
 # endif
 
-#define LUSTRE_TRACE_SIZE (CFS_THREAD_SIZE >> 5)
-
 #define CFS_CHECK_STACK(msgdata, mask, cdls) do {} while(0)
 #define CDEBUG_STACK() (0L)
 
@@ -224,7 +221,7 @@ typedef unsigned long long cfs_cycles_t;
  */
 #define CFS_CURPROC_COMM_MAX (sizeof ((struct task_struct *)0)->comm)
 
-typedef __u32 cfs_kernel_cap_t;
+typedef __u32 kernel_cap_t;
 
 /**
  * Module support (probably shouldn't be used in generic code?)
index 1f62c94..74e1383 100644 (file)
@@ -45,9 +45,8 @@
 #include <asm/types.h>
 #include <stdbool.h> /* for bool */
 #ifndef HAVE_UMODE_T
-typedef unsigned short cfs_umode_t;
+typedef unsigned short umode_t;
 #else
-typedef umode_t cfs_umode_t;
 #endif
 
 /*
index ebcb77f..446cf7f 100644 (file)
@@ -92,14 +92,12 @@ static inline __u32 query_stack_size()
 
 #endif /* __KERNEL__*/
 
-#ifndef CFS_THREAD_SIZE
-# define CFS_THREAD_SIZE query_stack_size()
+#ifndef THREAD_SIZE
+# define THREAD_SIZE query_stack_size()
 #endif
 
-#define LUSTRE_TRACE_SIZE (CFS_THREAD_SIZE >> 5)
-
 #ifdef __KERNEL__
-#define CDEBUG_STACK() (CFS_THREAD_SIZE - (__u32)IoGetRemainingStackSize())
+#define CDEBUG_STACK() (THREAD_SIZE - (__u32)IoGetRemainingStackSize())
 #define CFS_CHECK_STACK(msgdata, mask, cdls) do {} while(0)
 #else /* !__KERNEL__ */
 #define CFS_CHECK_STACK(msgdata, mask, cdls) do {} while(0)
index caf2ea8..11371cc 100644 (file)
@@ -144,7 +144,7 @@ cfs_wait_event_internal(event_t * event, int64_t timeout)
     NTSTATUS        Status;
     LARGE_INTEGER   TimeOut;
 
-    TimeOut.QuadPart = -1 * (10000000/CFS_HZ) * timeout;
+    TimeOut.QuadPart = -1 * (10000000/HZ) * timeout;
 
     Status = KeWaitForSingleObject(
                 event,
index d7d388a..99cee77 100644 (file)
@@ -537,7 +537,7 @@ static __inline int groups_search(cfs_group_info_t *group_info,
  *  capabilities support 
  */
 
-typedef __u32 cfs_kernel_cap_t;
+typedef __u32 kernel_cap_t;
 
 #define cap_raise(c, flag)  do {} while(0)
 #define cap_lower(c, flag)  do {} while(0)
@@ -569,7 +569,7 @@ typedef struct task_sruct{
     int                   cgroups;
     gid_t                 groups[NGROUPS];
     cfs_group_info_t     *group_info;
-    cfs_kernel_cap_t      cap_effective,
+    kernel_cap_t      cap_effective,
                           cap_inheritable,
                           cap_permitted;
 
index b57bf84..da9773f 100644 (file)
@@ -94,7 +94,7 @@ typedef time_t cfs_duration_t;
 
 #include <libcfs/winnt/portals_compat25.h>
 
-#define CFS_HZ (100)
+#define HZ (100)
 
 struct timespec {
     __u32   tv_sec;
@@ -113,7 +113,7 @@ typedef struct timeval cfs_fs_time_t;
 #define jiffies     (ULONG_PTR)JIFFIES()
 #define cfs_jiffies (ULONG_PTR)JIFFIES()
 
-static inline void cfs_gettimeofday(struct timeval *tv)
+static inline void do_gettimeofday(struct timeval *tv)
 {
     LARGE_INTEGER Time;
 
@@ -131,7 +131,7 @@ static inline LONGLONG JIFFIES()
     KeQueryTickCount(&Tick);
 
     Elapse.QuadPart  = Tick.QuadPart * KeQueryTimeIncrement();
-    Elapse.QuadPart /= (10000000 / CFS_HZ);
+    Elapse.QuadPart /= (10000000 / HZ);
 
     return Elapse.QuadPart;
 }
@@ -143,7 +143,7 @@ static inline cfs_time_t cfs_time_current(void)
 
 static inline time_t cfs_time_current_sec(void)
 {
-    return (time_t)(JIFFIES() / CFS_HZ);
+    return (time_t)(JIFFIES() / HZ);
 }
 
 #define cfs_time_before(t1, t2) (((signed)(t1) - (signed)(t2)) < 0)
@@ -191,26 +191,26 @@ static inline int cfs_fs_time_beforeq(cfs_fs_time_t *t1, cfs_fs_time_t *t2)
 
 static inline cfs_duration_t cfs_time_seconds(cfs_duration_t seconds)
 {
-    return  (cfs_duration_t)(seconds * CFS_HZ);
+    return  (cfs_duration_t)(seconds * HZ);
 }
 
 static inline time_t cfs_duration_sec(cfs_duration_t d)
 {
-    return (time_t)(d / CFS_HZ);
+    return (time_t)(d / HZ);
 }
 
 static inline void cfs_duration_usec(cfs_duration_t d, struct timeval *s)
 {
-    s->tv_sec = (__u32)(d / CFS_HZ);
-    s->tv_usec = (__u32)((d - (cfs_duration_t)s->tv_sec * CFS_HZ) *
-                              ONE_MILLION / CFS_HZ);
+    s->tv_sec = (__u32)(d / HZ);
+    s->tv_usec = (__u32)((d - (cfs_duration_t)s->tv_sec * HZ) *
+                             ONE_MILLION / HZ);
 }
 
 static inline void cfs_duration_nsec(cfs_duration_t d, struct timespec *s)
 {
-    s->tv_sec = (__u32) (d / CFS_HZ);
-    s->tv_nsec = (__u32)((d - (cfs_duration_t)s->tv_sec * CFS_HZ) *
-                           ONE_BILLION / CFS_HZ);
+    s->tv_sec = (__u32) (d / HZ);
+    s->tv_nsec = (__u32)((d - (cfs_duration_t)s->tv_sec * HZ) *
+                          ONE_BILLION / HZ);
 }
 
 static inline void cfs_fs_time_usec(cfs_fs_time_t *t, struct timeval *v)
@@ -274,7 +274,7 @@ struct timespec {
 /* liblustre. time(2) based implementation. */
 int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
 void sleep(int time);
-void cfs_gettimeofday(struct timeval *tv);
+void do_gettimeofday(struct timeval *tv);
 int gettimeofday(struct timeval *tv, void * tz);
 
 #endif /* !__KERNEL__ */
index b8da381..d83f025 100644 (file)
@@ -128,7 +128,7 @@ typedef     __u32       suseconds_t;
 typedef     __u16       uid_t, gid_t;
 
 typedef     __u16       mode_t;
-typedef     __u16       cfs_umode_t;
+typedef     __u16       umode_t;
 
 typedef     __u32       sigset_t;
 
index 2c11370..670e4cd 100644 (file)
@@ -151,7 +151,7 @@ int cfs_cap_raised(cfs_cap_t cap)
         return cap_raised(current_cap(), cfs_cap_unpack(cap));
 }
 
-void cfs_kernel_cap_pack(cfs_kernel_cap_t kcap, cfs_cap_t *cap)
+void cfs_kernel_cap_pack(kernel_cap_t kcap, cfs_cap_t *cap)
 {
 #if defined (_LINUX_CAPABILITY_VERSION) && _LINUX_CAPABILITY_VERSION == 0x19980330
         *cap = cfs_cap_pack(kcap);
@@ -165,7 +165,7 @@ void cfs_kernel_cap_pack(cfs_kernel_cap_t kcap, cfs_cap_t *cap)
 #endif
 }
 
-void cfs_kernel_cap_unpack(cfs_kernel_cap_t *kcap, cfs_cap_t cap)
+void cfs_kernel_cap_unpack(kernel_cap_t *kcap, cfs_cap_t cap)
 {
 #if defined (_LINUX_CAPABILITY_VERSION) && _LINUX_CAPABILITY_VERSION == 0x19980330
         *kcap = cfs_cap_unpack(cap);
index d9849b9..480b9a5 100644 (file)
 /* For sys_open & sys_close */
 #include <linux/syscalls.h>
 
+#ifndef HAVE_SK_SLEEP
+static inline wait_queue_head_t *sk_sleep(struct sock *sk)
+{
+       return sk->sk_sleep;
+}
+#endif
+
 int
 libcfs_sock_ioctl(int cmd, unsigned long arg)
 {
@@ -600,18 +607,18 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock)
 
         newsock->ops = sock->ops;
 
-        set_current_state(TASK_INTERRUPTIBLE);
-       add_wait_queue(cfs_sk_sleep(sock->sk), &wait);
+       set_current_state(TASK_INTERRUPTIBLE);
+       add_wait_queue(sk_sleep(sock->sk), &wait);
 
-        rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
-        if (rc == -EAGAIN) {
-                /* Nothing ready, so wait for activity */
-                schedule();
-                rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
-        }
+       rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
+       if (rc == -EAGAIN) {
+               /* Nothing ready, so wait for activity */
+               schedule();
+               rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
+       }
 
-       remove_wait_queue(cfs_sk_sleep(sock->sk), &wait);
-        set_current_state(TASK_RUNNING);
+       remove_wait_queue(sk_sleep(sock->sk), &wait);
+       set_current_state(TASK_RUNNING);
 
         if (rc != 0)
                 goto failed;
@@ -629,7 +636,7 @@ EXPORT_SYMBOL(libcfs_sock_accept);
 void
 libcfs_sock_abort_accept (struct socket *sock)
 {
-       wake_up_all(cfs_sk_sleep(sock->sk));
+       wake_up_all(sk_sleep(sock->sk));
 }
 
 EXPORT_SYMBOL(libcfs_sock_abort_accept);
index f3f48f7..e85722c 100644 (file)
@@ -206,7 +206,7 @@ int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
 }
 
 
-void cfs_gettimeofday(struct timeval *tv)
+void do_gettimeofday(struct timeval *tv)
 {
     LARGE_INTEGER Time;
 
@@ -218,7 +218,7 @@ void cfs_gettimeofday(struct timeval *tv)
 
 int gettimeofday(struct timeval *tv, void * tz)
 {
-    cfs_gettimeofday(tv);
+    do_gettimeofday(tv);
     return 0;
 }
 
index 6bedace..d62bd01 100644 (file)
@@ -442,7 +442,7 @@ void cfs_timer_arm(cfs_timer_t *timer, cfs_time_t deadline)
     KeAcquireSpinLock(&(timer->Lock), &Irql);
     if (!cfs_is_flag_set(timer->Flags, CFS_TIMER_FLAG_TIMERED)){
 
-        timeout.QuadPart = (LONGLONG)-1*1000*1000*10/CFS_HZ*deadline;
+       timeout.QuadPart = (LONGLONG)-1*1000*1000*10/HZ*deadline;
 
         if (KeSetTimer(&timer->Timer, timeout, &timer->Dpc)) {
             cfs_set_flag(timer->Flags, CFS_TIMER_FLAG_TIMERED);
index c6fd8a0..c87e36d 100644 (file)
@@ -171,7 +171,7 @@ cfs_set_ptldebug_header(struct ptldebug_header *header, int subsys, int mask,
 {
        struct timeval tv;
 
-       cfs_gettimeofday(&tv);
+       do_gettimeofday(&tv);
 
        header->ph_subsys = subsys;
        header->ph_mask = mask;
index dbe998f..fb80d88 100644 (file)
@@ -342,15 +342,15 @@ mxlnd_init_mx(lnet_ni_t *ni)
                 goto failed_with_init;
         }
 
-        mx_get_endpoint_addr(kmxlnd_data.kmx_endpt, &kmxlnd_data.kmx_epa);
-        mx_decompose_endpoint_addr(kmxlnd_data.kmx_epa, &nic_id, &ep_id);
-        mxret = mx_connect(kmxlnd_data.kmx_endpt, nic_id, ep_id,
-                           MXLND_MSG_MAGIC, MXLND_CONNECT_TIMEOUT/CFS_HZ*1000,
-                           &kmxlnd_data.kmx_epa);
-        if (mxret != MX_SUCCESS) {
-                CNETERR("unable to connect to myself (%s)\n", mx_strerror(mxret));
-                goto failed_with_endpoint;
-        }
+       mx_get_endpoint_addr(kmxlnd_data.kmx_endpt, &kmxlnd_data.kmx_epa);
+       mx_decompose_endpoint_addr(kmxlnd_data.kmx_epa, &nic_id, &ep_id);
+       mxret = mx_connect(kmxlnd_data.kmx_endpt, nic_id, ep_id,
+                          MXLND_MSG_MAGIC, MXLND_CONNECT_TIMEOUT/HZ*1000,
+                          &kmxlnd_data.kmx_epa);
+       if (mxret != MX_SUCCESS) {
+               CNETERR("unable to connect to myself (%s)\n", mx_strerror(mxret));
+               goto failed_with_endpoint;
+       }
 
         ni->ni_nid = LNET_MKNID(LNET_NIDNET(ni->ni_nid), ip);
         CDEBUG(D_NET, "My NID is 0x%llx\n", ni->ni_nid);
@@ -364,13 +364,13 @@ mxlnd_init_mx(lnet_ni_t *ni)
                          mx_strerror(mxret));
                 goto failed_with_endpoint;
         }
-        mxret = mx_set_request_timeout(kmxlnd_data.kmx_endpt, NULL,
-                                       MXLND_COMM_TIMEOUT/CFS_HZ*1000);
-        if (mxret != MX_SUCCESS) {
-                CERROR("mx_set_request_timeout() failed with %s\n",
-                        mx_strerror(mxret));
-                goto failed_with_endpoint;
-        }
+       mxret = mx_set_request_timeout(kmxlnd_data.kmx_endpt, NULL,
+                                      MXLND_COMM_TIMEOUT/HZ*1000);
+       if (mxret != MX_SUCCESS) {
+               CERROR("mx_set_request_timeout() failed with %s\n",
+                       mx_strerror(mxret));
+               goto failed_with_endpoint;
+       }
         return 0;
 
 failed_with_endpoint:
@@ -452,11 +452,11 @@ mxlnd_shutdown (lnet_ni_t *ni)
                 /* calls write_[un]lock(kmx_global_lock) */
                 mxlnd_del_peer(LNET_NID_ANY);
 
-                /* wakeup request_waitds */
-                mx_wakeup(kmxlnd_data.kmx_endpt);
+               /* wakeup request_waitds */
+               mx_wakeup(kmxlnd_data.kmx_endpt);
                up(&kmxlnd_data.kmx_tx_queue_sem);
                up(&kmxlnd_data.kmx_conn_sem);
-                mxlnd_sleep(2 * CFS_HZ);
+               mxlnd_sleep(2 * HZ);
 
                 /* fall through */
 
@@ -557,9 +557,9 @@ mxlnd_startup (lnet_ni_t *ni)
         kmxlnd_data.kmx_ni = ni;
         ni->ni_data = &kmxlnd_data;
 
-        cfs_gettimeofday(&tv);
-        kmxlnd_data.kmx_incarnation = (((__u64)tv.tv_sec) * 1000000) + tv.tv_usec;
-        CDEBUG(D_NET, "my incarnation is %llu\n", kmxlnd_data.kmx_incarnation);
+       do_gettimeofday(&tv);
+       kmxlnd_data.kmx_incarnation = (((__u64)tv.tv_sec) * 1000000) + tv.tv_usec;
+       CDEBUG(D_NET, "my incarnation is %llu\n", kmxlnd_data.kmx_incarnation);
 
        rwlock_init (&kmxlnd_data.kmx_global_lock);
        spin_lock_init (&kmxlnd_data.kmx_mem_lock);
index 851ffc6..2f1f06b 100644 (file)
 #define MXLND_NDAEMONS          3               /* connd, timeoutd, tx_queued */
 #define MXLND_MX_BOARD          0               /* Use the first MX NIC if more than 1 avail */
 #define MXLND_MX_EP_ID          0               /* MX endpoint ID */
-#define MXLND_COMM_TIMEOUT      (20 * CFS_HZ)   /* timeout for send/recv (jiffies) */
-#define MXLND_WAIT_TIMEOUT      CFS_HZ          /* timeout for wait (jiffies) */
-#define MXLND_CONNECT_TIMEOUT   (5 * CFS_HZ)    /* timeout for connections (jiffies) */
+#define MXLND_COMM_TIMEOUT      (20 * HZ)   /* timeout for send/recv (jiffies) */
+#define MXLND_WAIT_TIMEOUT      HZ          /* timeout for wait (jiffies) */
+#define MXLND_CONNECT_TIMEOUT   (5 * HZ)    /* timeout for connections (jiffies) */
 #define MXLND_POLLING           1000            /* poll iterations before blocking */
 #define MXLND_LOOKUP_COUNT      5               /* how many times to try to resolve MAC */
 #define MXLND_MAX_PEERS         1024            /* number of nodes talking to me */
index 4b3961b..db839ca 100644 (file)
@@ -843,12 +843,12 @@ mxlnd_ip2nic_id(u32 ip, u64 *nic_id, int tries)
                                 if (tmp_id != 0ULL)
                                         ret = 0;
                                 break;
-                        } else if (ret == -EHOSTUNREACH && try < tries) {
-                                /* add a little backoff */
-                                CDEBUG(D_NET, "sleeping for %d jiffies\n",
-                                       CFS_HZ/4);
-                                mxlnd_sleep(CFS_HZ/4);
-                        }
+                       } else if (ret == -EHOSTUNREACH && try < tries) {
+                               /* add a little backoff */
+                               CDEBUG(D_NET, "sleeping for %d jiffies\n",
+                                      HZ/4);
+                               mxlnd_sleep(HZ/4);
+                       }
                 }
         } while (try++ < tries);
         CDEBUG(D_NET, "done trying. ret = %d\n", ret);
@@ -2714,9 +2714,9 @@ mxlnd_iconnect(kmx_peer_t *peer, u8 msg_type)
                        mx_strerror(mxret), mxret, libcfs_nid2str(peer->mxp_nid));
                 mxlnd_conn_decref(conn);
         }
-        mx_set_request_timeout(kmxlnd_data.kmx_endpt, request,
-                               MXLND_CONNECT_TIMEOUT/CFS_HZ*1000);
-        return;
+       mx_set_request_timeout(kmxlnd_data.kmx_endpt, request,
+                              MXLND_CONNECT_TIMEOUT/HZ*1000);
+       return;
 }
 
 #define MXLND_STATS 0
@@ -2764,14 +2764,14 @@ mxlnd_check_sends(kmx_peer_t *peer)
         }
 
 #if MXLND_STATS
-        if (cfs_time_after(jiffies, last)) {
-                last = jiffies + CFS_HZ;
-                CDEBUG(D_NET, "status= %s credits= %d outstanding= %d ntx_msgs= %d "
-                              "ntx_posted= %d ntx_data= %d data_posted= %d\n",
-                              mxlnd_connstatus_to_str(conn->mxk_status), conn->mxk_credits,
-                              conn->mxk_outstanding, conn->mxk_ntx_msgs, conn->mxk_ntx_posted,
-                              conn->mxk_ntx_data, conn->mxk_data_posted);
-        }
+       if (cfs_time_after(jiffies, last)) {
+               last = jiffies + HZ;
+               CDEBUG(D_NET, "status= %s credits= %d outstanding= %d ntx_msgs= %d "
+                             "ntx_posted= %d ntx_data= %d data_posted= %d\n",
+                             mxlnd_connstatus_to_str(conn->mxk_status), conn->mxk_credits,
+                             conn->mxk_outstanding, conn->mxk_ntx_msgs, conn->mxk_ntx_posted,
+                             conn->mxk_ntx_data, conn->mxk_data_posted);
+       }
 #endif
 
        spin_lock(&conn->mxk_lock);
@@ -4021,14 +4021,14 @@ mxlnd_connd(void *arg)
 int
 mxlnd_timeoutd(void *arg)
 {
-        int             i       = 0;
-        long            id      = (long) arg;
-        unsigned long   now     = 0;
-        unsigned long   next    = 0;
-        unsigned long   delay   = CFS_HZ;
-        kmx_peer_t     *peer    = NULL;
-        kmx_peer_t     *temp    = NULL;
-        kmx_conn_t     *conn    = NULL;
+       int             i       = 0;
+       long            id      = (long) arg;
+       unsigned long   now     = 0;
+       unsigned long   next    = 0;
+       unsigned long   delay   = HZ;
+       kmx_peer_t     *peer    = NULL;
+       kmx_peer_t     *temp    = NULL;
+       kmx_conn_t     *conn    = NULL;
        rwlock_t   *g_lock  = &kmxlnd_data.kmx_global_lock;
 
         CDEBUG(D_NET, "timeoutd starting\n");
@@ -4063,11 +4063,11 @@ mxlnd_timeoutd(void *arg)
                                         continue;
                                 }
 
-                                if ((conn->mxk_status == MXLND_CONN_READY ||
-                                    conn->mxk_status == MXLND_CONN_FAIL) &&
-                                    cfs_time_after(now,
-                                                   conn->mxk_last_tx +
-                                                   CFS_HZ)) {
+                               if ((conn->mxk_status == MXLND_CONN_READY ||
+                                   conn->mxk_status == MXLND_CONN_FAIL) &&
+                                   cfs_time_after(now,
+                                                  conn->mxk_last_tx +
+                                                  HZ)) {
                                        write_unlock(g_lock);
                                        mxlnd_check_sends(peer);
                                        write_lock(g_lock);
index adf9a44..667e8f2 100644 (file)
@@ -3161,10 +3161,10 @@ kiblnd_startup (lnet_ni_t *ni)
         if (net == NULL)
                 goto failed;
 
-        memset(net, 0, sizeof(*net));
+       memset(net, 0, sizeof(*net));
 
-        cfs_gettimeofday(&tv);
-        net->ibn_incarnation = (((__u64)tv.tv_sec) * 1000000) + tv.tv_usec;
+       do_gettimeofday(&tv);
+       net->ibn_incarnation = (((__u64)tv.tv_sec) * 1000000) + tv.tv_usec;
 
         ni->ni_peertimeout    = *kiblnd_tunables.kib_peertimeout;
         ni->ni_maxtxcredits   = *kiblnd_tunables.kib_credits;
index 77eac81..4245526 100644 (file)
@@ -764,9 +764,9 @@ kiblnd_get_conn_locked (kib_peer_t *peer)
 static inline int
 kiblnd_send_keepalive(kib_conn_t *conn)
 {
-        return (*kiblnd_tunables.kib_keepalive > 0) &&
-                cfs_time_after(jiffies, conn->ibc_last_send +
-                               *kiblnd_tunables.kib_keepalive*CFS_HZ);
+       return (*kiblnd_tunables.kib_keepalive > 0) &&
+               cfs_time_after(jiffies, conn->ibc_last_send +
+                              *kiblnd_tunables.kib_keepalive*HZ);
 }
 
 static inline int
index af92311..4d9bada 100644 (file)
@@ -1176,8 +1176,8 @@ kiblnd_queue_tx_locked (kib_tx_t *tx, kib_conn_t *conn)
         LASSERT (!tx->tx_queued);               /* not queued for sending already */
         LASSERT (conn->ibc_state >= IBLND_CONN_ESTABLISHED);
 
-        tx->tx_queued = 1;
-        tx->tx_deadline = jiffies + (*kiblnd_tunables.kib_timeout * CFS_HZ);
+       tx->tx_queued = 1;
+       tx->tx_deadline = jiffies + (*kiblnd_tunables.kib_timeout * HZ);
 
         if (tx->tx_conn == NULL) {
                 kiblnd_conn_addref(conn);
@@ -3200,13 +3200,13 @@ kiblnd_connd (void *arg)
                         if (chunk == 0)
                                 chunk = 1;
 
-                        for (i = 0; i < chunk; i++) {
-                                kiblnd_check_conns(peer_index);
-                                peer_index = (peer_index + 1) %
-                                             kiblnd_data.kib_peer_hash_size;
-                        }
+                       for (i = 0; i < chunk; i++) {
+                               kiblnd_check_conns(peer_index);
+                               peer_index = (peer_index + 1) %
+                                            kiblnd_data.kib_peer_hash_size;
+                       }
 
-                        deadline += p * CFS_HZ;
+                       deadline += p * HZ;
                        spin_lock_irqsave(&kiblnd_data.kib_connd_lock, flags);
                }
 
index 62c3f56..09278dd 100644 (file)
@@ -758,13 +758,13 @@ kptllnd_base_startup (void)
                 goto failed;
         }
 
-        /* Initialized the incarnation - it must be for-all-time unique, even
-         * accounting for the fact that we increment it when we disconnect a
-         * peer that's using it */
-        cfs_gettimeofday(&tv);
-        kptllnd_data.kptl_incarnation = (((__u64)tv.tv_sec) * 1000000) +
-                                        tv.tv_usec;
-        CDEBUG(D_NET, "Incarnation="LPX64"\n", kptllnd_data.kptl_incarnation);
+       /* Initialized the incarnation - it must be for-all-time unique, even
+        * accounting for the fact that we increment it when we disconnect a
+        * peer that's using it */
+       do_gettimeofday(&tv);
+       kptllnd_data.kptl_incarnation = (((__u64)tv.tv_sec) * 1000000) +
+                                       tv.tv_usec;
+       CDEBUG(D_NET, "Incarnation="LPX64"\n", kptllnd_data.kptl_incarnation);
 
         target.nid = LNET_NID_ANY;
         target.pid = LNET_PID_ANY; /* NB target for NAK doesn't matter */
index 7be7e4d..caf90a6 100644 (file)
@@ -263,10 +263,10 @@ kptllnd_active_rdma(kptl_rx_t *rx, lnet_msg_t *lntmsg, int type,
         /* lnet_finalize() will be called when tx is torn down, so I must
          * return success from here on... */
 
-        tx->tx_deadline = jiffies + (*kptllnd_tunables.kptl_timeout * CFS_HZ);
-        tx->tx_rdma_mdh = mdh;
-        tx->tx_active = 1;
-        cfs_list_add_tail(&tx->tx_list, &peer->peer_activeq);
+       tx->tx_deadline = jiffies + (*kptllnd_tunables.kptl_timeout * HZ);
+       tx->tx_rdma_mdh = mdh;
+       tx->tx_active = 1;
+       cfs_list_add_tail(&tx->tx_list, &peer->peer_activeq);
 
         /* peer has now got my ref on 'tx' */
 
@@ -710,9 +710,9 @@ kptllnd_watchdog(void *arg)
                                      kptllnd_data.kptl_peer_hash_size;
                         }
 
-                        deadline += p * CFS_HZ;
-                        stamp++;
-                        continue;
+                       deadline += p * HZ;
+                       stamp++;
+                       continue;
                 }
 
                 kptllnd_handle_closing_peers();
index 457295e..6cc44f0 100644 (file)
@@ -600,10 +600,10 @@ kptllnd_post_tx(kptl_peer_t *peer, kptl_tx_t *tx, int nfrag)
         }
 
 
-        tx->tx_deadline = jiffies + (*kptllnd_tunables.kptl_timeout * CFS_HZ);
-        tx->tx_active = 1;
-        tx->tx_msg_mdh = msg_mdh;
-        kptllnd_queue_tx(peer, tx);
+       tx->tx_deadline = jiffies + (*kptllnd_tunables.kptl_timeout * HZ);
+       tx->tx_active = 1;
+       tx->tx_msg_mdh = msg_mdh;
+       kptllnd_queue_tx(peer, tx);
 }
 
 /* NB "restarts" comes from peer_sendq of a single peer */
index eabefae..2ada9bd 100644 (file)
@@ -838,8 +838,7 @@ kranal_connect (kra_peer_t *peer)
                 MIN(peer->rap_reconnect_interval,
                     *kranal_tunables.kra_max_reconnect_interval);
 
-        peer->rap_reconnect_time = jiffies + peer->rap_reconnect_interval *
-                CFS_HZ;
+       peer->rap_reconnect_time = jiffies + peer->rap_reconnect_interval * HZ;
 
         /* Grab all blocked packets while we have the global lock */
         cfs_list_add(&zombies, &peer->rap_tx_queue);
@@ -1596,15 +1595,15 @@ kranal_startup (lnet_ni_t *ni)
         ni->ni_data = &kranal_data;
         kranal_data.kra_ni = ni;
 
-        /* CAVEAT EMPTOR: Every 'Fma' message includes the sender's NID and
-         * a unique (for all time) connstamp so we can uniquely identify
-         * the sender.  The connstamp is an incrementing counter
-         * initialised with seconds + microseconds at startup time.  So we
-         * rely on NOT creating connections more frequently on average than
-         * 1MHz to ensure we don't use old connstamps when we reboot. */
-        cfs_gettimeofday(&tv);
-        kranal_data.kra_connstamp =
-        kranal_data.kra_peerstamp = (((__u64)tv.tv_sec) * 1000000) + tv.tv_usec;
+       /* CAVEAT EMPTOR: Every 'Fma' message includes the sender's NID and
+        * a unique (for all time) connstamp so we can uniquely identify
+        * the sender.  The connstamp is an incrementing counter
+        * initialised with seconds + microseconds at startup time.  So we
+        * rely on NOT creating connections more frequently on average than
+        * 1MHz to ensure we don't use old connstamps when we reboot. */
+       do_gettimeofday(&tv);
+       kranal_data.kra_connstamp =
+       kranal_data.kra_peerstamp = (((__u64)tv.tv_sec) * 1000000) + tv.tv_usec;
 
        rwlock_init(&kranal_data.kra_global_lock);
 
index 05de1c1..d9ca41b 100644 (file)
@@ -918,26 +918,26 @@ kranal_check_conn_timeouts (kra_conn_t *conn)
         LASSERT (conn->rac_state == RANAL_CONN_ESTABLISHED ||
                  conn->rac_state == RANAL_CONN_CLOSING);
 
-        if (!conn->rac_close_sent &&
-            cfs_time_aftereq(now, conn->rac_last_tx + conn->rac_keepalive *
-                             CFS_HZ)) {
-                /* not sent in a while; schedule conn so scheduler sends a keepalive */
-                CDEBUG(D_NET, "Scheduling keepalive %p->%s\n",
-                       conn, libcfs_nid2str(conn->rac_peer->rap_nid));
-                kranal_schedule_conn(conn);
-        }
-
-        timeout = conn->rac_timeout * CFS_HZ;
-
-        if (!conn->rac_close_recvd &&
-            cfs_time_aftereq(now, conn->rac_last_rx + timeout)) {
-                CERROR("%s received from %s within %lu seconds\n",
-                       (conn->rac_state == RANAL_CONN_ESTABLISHED) ?
-                       "Nothing" : "CLOSE not",
-                       libcfs_nid2str(conn->rac_peer->rap_nid), 
-                       (now - conn->rac_last_rx)/CFS_HZ);
-                return -ETIMEDOUT;
-        }
+       if (!conn->rac_close_sent &&
+           cfs_time_aftereq(now, conn->rac_last_tx + conn->rac_keepalive *
+                            HZ)) {
+               /* not sent in a while; schedule conn so scheduler sends a keepalive */
+               CDEBUG(D_NET, "Scheduling keepalive %p->%s\n",
+                      conn, libcfs_nid2str(conn->rac_peer->rap_nid));
+               kranal_schedule_conn(conn);
+       }
+
+       timeout = conn->rac_timeout * HZ;
+
+       if (!conn->rac_close_recvd &&
+           cfs_time_aftereq(now, conn->rac_last_rx + timeout)) {
+               CERROR("%s received from %s within %lu seconds\n",
+                      (conn->rac_state == RANAL_CONN_ESTABLISHED) ?
+                      "Nothing" : "CLOSE not",
+                      libcfs_nid2str(conn->rac_peer->rap_nid),
+                      (now - conn->rac_last_rx)/HZ);
+               return -ETIMEDOUT;
+       }
 
         if (conn->rac_state != RANAL_CONN_ESTABLISHED)
                 return 0;
@@ -948,41 +948,41 @@ kranal_check_conn_timeouts (kra_conn_t *conn)
 
        spin_lock_irqsave(&conn->rac_lock, flags);
 
-        cfs_list_for_each (ttmp, &conn->rac_fmaq) {
-                tx = cfs_list_entry(ttmp, kra_tx_t, tx_list);
+       cfs_list_for_each (ttmp, &conn->rac_fmaq) {
+               tx = cfs_list_entry(ttmp, kra_tx_t, tx_list);
 
-                if (cfs_time_aftereq(now, tx->tx_qtime + timeout)) {
+               if (cfs_time_aftereq(now, tx->tx_qtime + timeout)) {
                        spin_unlock_irqrestore(&conn->rac_lock, flags);
-                        CERROR("tx on fmaq for %s blocked %lu seconds\n",
-                               libcfs_nid2str(conn->rac_peer->rap_nid),
-                               (now - tx->tx_qtime)/CFS_HZ);
-                        return -ETIMEDOUT;
-                }
-        }
+                       CERROR("tx on fmaq for %s blocked %lu seconds\n",
+                              libcfs_nid2str(conn->rac_peer->rap_nid),
+                              (now - tx->tx_qtime)/HZ);
+                       return -ETIMEDOUT;
+               }
+       }
 
-        cfs_list_for_each (ttmp, &conn->rac_rdmaq) {
-                tx = cfs_list_entry(ttmp, kra_tx_t, tx_list);
+       cfs_list_for_each (ttmp, &conn->rac_rdmaq) {
+               tx = cfs_list_entry(ttmp, kra_tx_t, tx_list);
 
-                if (cfs_time_aftereq(now, tx->tx_qtime + timeout)) {
+               if (cfs_time_aftereq(now, tx->tx_qtime + timeout)) {
                        spin_unlock_irqrestore(&conn->rac_lock, flags);
-                        CERROR("tx on rdmaq for %s blocked %lu seconds\n",
-                               libcfs_nid2str(conn->rac_peer->rap_nid), 
-                               (now - tx->tx_qtime)/CFS_HZ);
-                        return -ETIMEDOUT;
-                }
-        }
+                       CERROR("tx on rdmaq for %s blocked %lu seconds\n",
+                              libcfs_nid2str(conn->rac_peer->rap_nid),
+                              (now - tx->tx_qtime)/HZ);
+                       return -ETIMEDOUT;
+               }
+       }
 
-        cfs_list_for_each (ttmp, &conn->rac_replyq) {
-                tx = cfs_list_entry(ttmp, kra_tx_t, tx_list);
+       cfs_list_for_each (ttmp, &conn->rac_replyq) {
+               tx = cfs_list_entry(ttmp, kra_tx_t, tx_list);
 
-                if (cfs_time_aftereq(now, tx->tx_qtime + timeout)) {
+               if (cfs_time_aftereq(now, tx->tx_qtime + timeout)) {
                        spin_unlock_irqrestore(&conn->rac_lock, flags);
-                        CERROR("tx on replyq for %s blocked %lu seconds\n",
-                               libcfs_nid2str(conn->rac_peer->rap_nid),
-                               (now - tx->tx_qtime)/CFS_HZ);
-                        return -ETIMEDOUT;
-                }
-        }
+                       CERROR("tx on replyq for %s blocked %lu seconds\n",
+                              libcfs_nid2str(conn->rac_peer->rap_nid),
+                              (now - tx->tx_qtime)/HZ);
+                       return -ETIMEDOUT;
+               }
+       }
 
        spin_unlock_irqrestore(&conn->rac_lock, flags);
         return 0;
@@ -1231,7 +1231,7 @@ kranal_reaper (void *arg)
                         conn_index = (conn_index + 1) % conn_entries;
                 }
 
-                next_check_time += p * CFS_HZ;
+               next_check_time += p * HZ;
 
                spin_lock_irqsave(&kranal_data.kra_reaper_lock, flags);
 
@@ -1419,13 +1419,13 @@ kranal_sendmsg(kra_conn_t *conn, kra_msg_t *msg,
                 return 0;
 
         case RAP_NOT_DONE:
-                if (cfs_time_aftereq(jiffies,
-                                     conn->rac_last_tx + conn->rac_keepalive *
-                                     CFS_HZ))
-                        CWARN("EAGAIN sending %02x (idle %lu secs)\n",
-                              msg->ram_type,
-                              (jiffies - conn->rac_last_tx)/CFS_HZ);
-                return -EAGAIN;
+               if (cfs_time_aftereq(jiffies,
+                                    conn->rac_last_tx + conn->rac_keepalive *
+                                    HZ))
+                       CWARN("EAGAIN sending %02x (idle %lu secs)\n",
+                             msg->ram_type,
+                             (jiffies - conn->rac_last_tx)/HZ);
+               return -EAGAIN;
         }
 }
 
@@ -1454,13 +1454,13 @@ kranal_process_fmaq (kra_conn_t *conn)
                         /* RDMAs in progress */
                         LASSERT (!conn->rac_close_sent);
 
-                        if (cfs_time_aftereq(jiffies,
-                                             conn->rac_last_tx +
-                                             conn->rac_keepalive * CFS_HZ)) {
-                                CDEBUG(D_NET, "sending NOOP (rdma in progress)\n");
-                                kranal_init_msg(&conn->rac_msg, RANAL_MSG_NOOP);
-                                kranal_sendmsg(conn, &conn->rac_msg, NULL, 0);
-                        }
+                       if (cfs_time_aftereq(jiffies,
+                                            conn->rac_last_tx +
+                                            conn->rac_keepalive * HZ)) {
+                               CDEBUG(D_NET, "sending NOOP (rdma in progress)\n");
+                               kranal_init_msg(&conn->rac_msg, RANAL_MSG_NOOP);
+                               kranal_sendmsg(conn, &conn->rac_msg, NULL, 0);
+                       }
                         return;
                 }
 
@@ -1494,16 +1494,16 @@ kranal_process_fmaq (kra_conn_t *conn)
 
                spin_unlock_irqrestore(&conn->rac_lock, flags);
 
-                if (cfs_time_aftereq(jiffies,
-                                     conn->rac_last_tx + conn->rac_keepalive *
-                                     CFS_HZ)) {
-                        CDEBUG(D_NET, "sending NOOP -> %s (%p idle %lu(%ld))\n",
-                               libcfs_nid2str(conn->rac_peer->rap_nid), conn,
-                               (jiffies - conn->rac_last_tx)/CFS_HZ,
-                               conn->rac_keepalive);
-                        kranal_init_msg(&conn->rac_msg, RANAL_MSG_NOOP);
-                        kranal_sendmsg(conn, &conn->rac_msg, NULL, 0);
-                }
+               if (cfs_time_aftereq(jiffies,
+                                    conn->rac_last_tx + conn->rac_keepalive *
+                                    HZ)) {
+                       CDEBUG(D_NET, "sending NOOP -> %s (%p idle %lu(%ld))\n",
+                              libcfs_nid2str(conn->rac_peer->rap_nid), conn,
+                              (jiffies - conn->rac_last_tx)/HZ,
+                              conn->rac_keepalive);
+                       kranal_init_msg(&conn->rac_msg, RANAL_MSG_NOOP);
+                       kranal_sendmsg(conn, &conn->rac_msg, NULL, 0);
+               }
                 return;
         }
 
@@ -1901,24 +1901,23 @@ kranal_complete_closed_conn (kra_conn_t *conn)
                conn, libcfs_nid2str(conn->rac_peer->rap_nid), nfma, nreplies);
 }
 
-int
-kranal_process_new_conn (kra_conn_t *conn)
+int kranal_process_new_conn (kra_conn_t *conn)
 {
-        RAP_RETURN   rrc;
+       RAP_RETURN   rrc;
 
-        rrc = RapkCompleteSync(conn->rac_rihandle, 1);
-        if (rrc == RAP_SUCCESS)
-                return 0;
+       rrc = RapkCompleteSync(conn->rac_rihandle, 1);
+       if (rrc == RAP_SUCCESS)
+               return 0;
 
-        LASSERT (rrc == RAP_NOT_DONE);
-        if (!cfs_time_aftereq(jiffies, conn->rac_last_tx +
-                              conn->rac_timeout * CFS_HZ))
-                return -EAGAIN;
+       LASSERT (rrc == RAP_NOT_DONE);
+       if (!cfs_time_aftereq(jiffies, conn->rac_last_tx +
+                             conn->rac_timeout * HZ))
+               return -EAGAIN;
 
-        /* Too late */
-        rrc = RapkCompleteSync(conn->rac_rihandle, 0);
-        LASSERT (rrc == RAP_SUCCESS);
-        return -ETIMEDOUT;
+       /* Too late */
+       rrc = RapkCompleteSync(conn->rac_rihandle, 0);
+       LASSERT (rrc == RAP_SUCCESS);
+       return -ETIMEDOUT;
 }
 
 int
@@ -2019,15 +2018,15 @@ kranal_scheduler (void *arg)
                                         continue;
                                 }
 
-                                /* retry with exponential backoff until HZ */
-                                if (conn->rac_keepalive == 0)
-                                        conn->rac_keepalive = 1;
-                                else if (conn->rac_keepalive <= CFS_HZ)
-                                        conn->rac_keepalive *= 2;
-                                else
-                                        conn->rac_keepalive += CFS_HZ;
-                                
-                                deadline = conn->rac_last_tx + conn->rac_keepalive;
+                               /* retry with exponential backoff until HZ */
+                               if (conn->rac_keepalive == 0)
+                                       conn->rac_keepalive = 1;
+                               else if (conn->rac_keepalive <= HZ)
+                                       conn->rac_keepalive *= 2;
+                               else
+                                       conn->rac_keepalive += HZ;
+
+                               deadline = conn->rac_last_tx + conn->rac_keepalive;
                                spin_lock_irqsave(&dev->rad_lock, flags);
                         }
 
index c70ceeb..03d581b 100644 (file)
@@ -2352,19 +2352,18 @@ ksocknal_base_shutdown(void)
         PORTAL_MODULE_UNUSE;
 }
 
-__u64
-ksocknal_new_incarnation (void)
+__u64 ksocknal_new_incarnation (void)
 {
-        struct timeval tv;
+       struct timeval tv;
 
-        /* The incarnation number is the time this module loaded and it
-         * identifies this particular instance of the socknal.  Hopefully
-         * we won't be able to reboot more frequently than 1MHz for the
-         * forseeable future :) */
+       /* The incarnation number is the time this module loaded and it
+        * identifies this particular instance of the socknal.  Hopefully
+        * we won't be able to reboot more frequently than 1MHz for the
+        * forseeable future :) */
 
-        cfs_gettimeofday(&tv);
+       do_gettimeofday(&tv);
 
-        return (((__u64)tv.tv_sec) * 1000000) + tv.tv_usec;
+       return (((__u64)tv.tv_sec) * 1000000) + tv.tv_usec;
 }
 
 int
index ed5eba9..bfc84d6 100644 (file)
@@ -506,25 +506,24 @@ lnet_freelist_fini (lnet_freelist_t *fl)
 
 #endif /* LNET_USE_LIB_FREELIST */
 
-__u64
-lnet_create_interface_cookie (void)
+__u64 lnet_create_interface_cookie (void)
 {
-        /* NB the interface cookie in wire handles guards against delayed
-         * replies and ACKs appearing valid after reboot. Initialisation time,
-         * even if it's only implemented to millisecond resolution is probably
-         * easily good enough. */
-        struct timeval tv;
-        __u64          cookie;
+       /* NB the interface cookie in wire handles guards against delayed
+        * replies and ACKs appearing valid after reboot. Initialisation time,
+        * even if it's only implemented to millisecond resolution is probably
+        * easily good enough. */
+       struct timeval tv;
+       __u64          cookie;
 #ifndef __KERNEL__
-        int            rc = gettimeofday (&tv, NULL);
-        LASSERT (rc == 0);
+       int            rc = gettimeofday (&tv, NULL);
+       LASSERT (rc == 0);
 #else
-        cfs_gettimeofday(&tv);
+       do_gettimeofday(&tv);
 #endif
-        cookie = tv.tv_sec;
-        cookie *= 1000000;
-        cookie += tv.tv_usec;
-        return cookie;
+       cookie = tv.tv_sec;
+       cookie *= 1000000;
+       cookie += tv.tv_usec;
+       return cookie;
 }
 
 static char *
index 46adbeb..9423278 100644 (file)
@@ -266,10 +266,10 @@ static void lnet_shuffle_seed(void)
                         seed[0] ^= (LNET_NIDADDR(ni->ni_nid) | lnd_type);
         }
 
-        cfs_gettimeofday(&tv);
-        cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
-        seeded = 1;
-        return;
+       do_gettimeofday(&tv);
+       cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
+       seeded = 1;
+       return;
 }
 
 /* NB expects LNET_LOCK held */
index f905c0c..5ba70d7 100644 (file)
@@ -131,22 +131,21 @@ brw_client_init (sfw_test_instance_t *tsi)
 #define BRW_MAGIC       0xeeb0eeb1eeb2eeb3ULL
 #define BRW_MSIZE       sizeof(__u64)
 
-int
-brw_inject_one_error (void)
+int brw_inject_one_error (void)
 {
-        struct timeval tv;
+       struct timeval tv;
 
-        if (brw_inject_errors <= 0) return 0;
+       if (brw_inject_errors <= 0) return 0;
 
 #ifndef __KERNEL__
-        gettimeofday(&tv, NULL);
+       gettimeofday(&tv, NULL);
 #else
-        cfs_gettimeofday(&tv);
+       do_gettimeofday(&tv);
 #endif
 
-        if ((tv.tv_usec & 1) == 0) return 0;
+       if ((tv.tv_usec & 1) == 0) return 0;
 
-        return brw_inject_errors--;
+       return brw_inject_errors--;
 }
 
 void
index dee85db..01dce37 100644 (file)
@@ -46,7 +46,7 @@
 struct lvfs_ucred { 
        __u32 luc_fsuid; 
        __u32 luc_fsgid; 
-       cfs_kernel_cap_t luc_cap; 
+       kernel_cap_t luc_cap;
        __u32 luc_uid; 
        __u32 luc_umask;
 };
index 5176f12..e538256 100644 (file)
@@ -375,11 +375,11 @@ struct dt_object_operations {
          * (2) The type of child is in \a child_mode.
          * (3) The result hint is stored in \a ah;
          */
-        void  (*do_ah_init)(const struct lu_env *env,
-                            struct dt_allocation_hint *ah,
-                            struct dt_object *parent,
+       void  (*do_ah_init)(const struct lu_env *env,
+                           struct dt_allocation_hint *ah,
+                           struct dt_object *parent,
                            struct dt_object *child,
-                            cfs_umode_t child_mode);
+                           umode_t child_mode);
         /**
          * Create new object on this device.
          *
index 1cf77fc..6fbf455 100644 (file)
@@ -61,7 +61,7 @@
 
 #define loff_t long long
 #define ERESTART 2001
-typedef unsigned short cfs_umode_t;
+typedef unsigned short umode_t;
 
 #endif
 
@@ -154,7 +154,11 @@ extern int echo_client_init(void);
 #ifndef ERESTARTSYS
 #define ERESTARTSYS ERESTART
 #endif
-#define CFS_HZ 1
+
+#ifdef HZ
+#undef HZ
+#endif
+#define HZ 1
 
 /* random */
 
@@ -188,15 +192,15 @@ void cfs_get_random_bytes(void *ptr, int size);
 #define ATTR_FILE       0
 
 struct iattr {
-        unsigned int    ia_valid;
-        cfs_umode_t     ia_mode;
-        uid_t           ia_uid;
-        gid_t           ia_gid;
-        loff_t          ia_size;
-        time_t          ia_atime;
-        time_t          ia_mtime;
-        time_t          ia_ctime;
-        unsigned int    ia_attr_flags;
+       unsigned int    ia_valid;
+       umode_t         ia_mode;
+       uid_t           ia_uid;
+       gid_t           ia_gid;
+       loff_t          ia_size;
+       time_t          ia_atime;
+       time_t          ia_mtime;
+       time_t          ia_ctime;
+       unsigned int    ia_attr_flags;
 };
 
 /* defined in kernel header include/linux/namei.h */
@@ -298,7 +302,7 @@ int cfs_curproc_is_in_groups(gid_t gid);
 #define SIGNAL_MASK_ASSERT()
 #define CFS_KERN_INFO
 
-#if CFS_HZ != 1
+#if HZ != 1
 #error "liblustre's jiffies currently expects HZ to be 1"
 #endif
 #define jiffies                                 \
index e320817..5c30afa 100644 (file)
@@ -91,17 +91,17 @@ static inline char *fsfilt_get_label(struct obd_device *obd,
 
 #define __fsfilt_check_slow(obd, start, msg)                              \
 do {                                                                      \
-        if (cfs_time_before(jiffies, start + 15 * CFS_HZ))                \
-                break;                                                    \
-        else if (cfs_time_before(jiffies, start + 30 * CFS_HZ))           \
-                CDEBUG(D_VFSTRACE, "%s: slow %s %lus\n", obd->obd_name,   \
-                       msg, (jiffies-start) / CFS_HZ);                    \
-        else if (cfs_time_before(jiffies, start + DISK_TIMEOUT * CFS_HZ)) \
-                CWARN("%s: slow %s %lus\n", obd->obd_name, msg,           \
-                      (jiffies - start) / CFS_HZ);                        \
-        else                                                              \
-                CERROR("%s: slow %s %lus\n", obd->obd_name, msg,          \
-                       (jiffies - start) / CFS_HZ);                       \
+       if (cfs_time_before(jiffies, start + 15 * HZ))                    \
+               break;                                                    \
+       else if (cfs_time_before(jiffies, start + 30 * HZ))               \
+               CDEBUG(D_VFSTRACE, "%s: slow %s %lus\n", obd->obd_name,   \
+                      msg, (jiffies-start) / HZ);                        \
+       else if (cfs_time_before(jiffies, start + DISK_TIMEOUT * HZ))     \
+               CWARN("%s: slow %s %lus\n", obd->obd_name, msg,           \
+                     (jiffies - start) / HZ);                            \
+       else                                                              \
+               CERROR("%s: slow %s %lus\n", obd->obd_name, msg,          \
+                      (jiffies - start) / HZ);                           \
 } while (0)
 
 #define fsfilt_check_slow(obd, start, msg)              \
index 652d8d2..ce3cadc 100644 (file)
 /* simple.c */
 
 struct lvfs_ucred {
-        __u32                   luc_uid;
-        __u32                   luc_gid;
-        __u32                   luc_fsuid;
-        __u32                   luc_fsgid;
-        cfs_kernel_cap_t        luc_cap;
-        __u32                   luc_umask;
-       struct group_info      *luc_ginfo;
-       struct md_identity     *luc_identity;
+       __u32                   luc_uid;
+       __u32                   luc_gid;
+       __u32                   luc_fsuid;
+       __u32                   luc_fsgid;
+       kernel_cap_t            luc_cap;
+       __u32                   luc_umask;
+       struct group_info       *luc_ginfo;
+       struct md_identity      *luc_identity;
 };
 
 struct lvfs_callback_ops {
index b60a32d..cfd0bf5 100644 (file)
@@ -74,42 +74,42 @@ typedef struct {
 
 #ifdef CLIENT_OBD_LIST_LOCK_DEBUG
 static inline void __client_obd_list_lock(client_obd_lock_t *lock,
-                                          const char *func, int line)
+                                         const char *func, int line)
 {
        unsigned long cur = jiffies;
        while (1) {
                if (spin_trylock(&lock->lock)) {
-                        LASSERT(lock->task == NULL);
-                        lock->task = current;
-                        lock->func = func;
-                        lock->line = line;
-                        lock->time = jiffies;
-                        break;
-                }
-
-                if ((jiffies - cur > 5 * CFS_HZ) &&
-                    (jiffies - lock->time > 5 * CFS_HZ)) {
+                       LASSERT(lock->task == NULL);
+                       lock->task = current;
+                       lock->func = func;
+                       lock->line = line;
+                       lock->time = jiffies;
+                       break;
+               }
+
+               if ((jiffies - cur > 5 * HZ) &&
+                   (jiffies - lock->time > 5 * HZ)) {
                        struct task_struct *task = lock->task;
 
                        if (task == NULL)
                                continue;
 
-                        LCONSOLE_WARN("%s:%d: lock %p was acquired"
-                                      " by <%s:%d:%s:%d> for %lu seconds.\n",
+                       LCONSOLE_WARN("%s:%d: lock %p was acquired"
+                                     " by <%s:%d:%s:%d> for %lu seconds.\n",
                                      current->comm, current->pid,
-                                      lock, task->comm, task->pid,
-                                      lock->func, lock->line,
-                                      (jiffies - lock->time) / CFS_HZ);
-                        LCONSOLE_WARN("====== for process holding the "
-                                      "lock =====\n");
-                        libcfs_debug_dumpstack(task);
-                        LCONSOLE_WARN("====== for current process =====\n");
-                        libcfs_debug_dumpstack(NULL);
-                        LCONSOLE_WARN("====== end =======\n");
-                        cfs_pause(1000 * CFS_HZ);
-                }
+                                     lock, task->comm, task->pid,
+                                     lock->func, lock->line,
+                                     (jiffies - lock->time) / HZ);
+                       LCONSOLE_WARN("====== for process holding the "
+                                     "lock =====\n");
+                       libcfs_debug_dumpstack(task);
+                       LCONSOLE_WARN("====== for current process =====\n");
+                       libcfs_debug_dumpstack(NULL);
+                       LCONSOLE_WARN("====== end =======\n");
+                       cfs_pause(1000 * HZ);
+               }
                cpu_relax();
-        }
+       }
 }
 
 #define client_obd_list_lock(lock) \
index a5b875a..2cc89e6 100644 (file)
@@ -2075,13 +2075,13 @@ static int target_recovery_thread(void *arg)
                 target_request_copy_put(req);
         }
 
-        delta = (jiffies - delta) / CFS_HZ;
-        CDEBUG(D_INFO,"4: recovery completed in %lus - %d/%d reqs/locks\n",
-              delta, obd->obd_replayed_requests, obd->obd_replayed_locks);
-        if (delta > OBD_RECOVERY_TIME_SOFT) {
-                CWARN("too long recovery - read logs\n");
-                libcfs_debug_dumplog();
-        }
+       delta = (jiffies - delta) / HZ;
+       CDEBUG(D_INFO,"4: recovery completed in %lus - %d/%d reqs/locks\n",
+             delta, obd->obd_replayed_requests, obd->obd_replayed_locks);
+       if (delta > OBD_RECOVERY_TIME_SOFT) {
+               CWARN("too long recovery - read logs\n");
+               libcfs_debug_dumplog();
+       }
 
         target_finish_recovery(obd);
 
index 8343068..afb26fd 100644 (file)
@@ -852,8 +852,8 @@ static int __ldlm_namespace_free(struct ldlm_namespace *ns, int force)
                        "dlm namespace %s free waiting on refcount %d\n",
                        ldlm_ns_name(ns), cfs_atomic_read(&ns->ns_bref));
 force_wait:
-                if (force)
-                        lwi = LWI_TIMEOUT(obd_timeout * CFS_HZ / 4, NULL, NULL);
+               if (force)
+                       lwi = LWI_TIMEOUT(obd_timeout * HZ / 4, NULL, NULL);
 
                 rc = l_wait_event(ns->ns_waitq,
                                   cfs_atomic_read(&ns->ns_bref) == 0, &lwi);
index e0efdc1..f3694a7 100644 (file)
@@ -43,7 +43,7 @@
 #include <lustre_dlm.h>
 #include <lustre_fid.h>
 
-#define HALF_SEC                       (CFS_HZ >> 1)
+#define HALF_SEC                       (HZ >> 1)
 #define LFSCK_CHECKPOINT_INTERVAL      60
 
 #define LFSCK_NAMEENTRY_DEAD           1 /* The object has been unlinked. */
@@ -512,7 +512,7 @@ static void inline lfsck_position_cpu_to_le(struct lfsck_position *des,
        des->lp_dir_cookie = cpu_to_le64(src->lp_dir_cookie);
 }
 
-static inline cfs_umode_t lfsck_object_type(const struct dt_object *obj)
+static inline umode_t lfsck_object_type(const struct dt_object *obj)
 {
        return lu_object_attr(&obj->do_lu);
 }
index 99fcf39..b5def07 100644 (file)
@@ -372,12 +372,12 @@ static void __lfsck_set_speed(struct lfsck_instance *lfsck, __u32 limit)
 {
        lfsck->li_bookmark_ram.lb_speed_limit = limit;
        if (limit != LFSCK_SPEED_NO_LIMIT) {
-               if (limit > CFS_HZ) {
-                       lfsck->li_sleep_rate = limit / CFS_HZ;
+               if (limit > HZ) {
+                       lfsck->li_sleep_rate = limit / HZ;
                        lfsck->li_sleep_jif = 1;
                } else {
                        lfsck->li_sleep_rate = 1;
-                       lfsck->li_sleep_jif = CFS_HZ / limit;
+                       lfsck->li_sleep_jif = HZ / limit;
                }
        } else {
                lfsck->li_sleep_jif = 0;
index 796c6b3..01bead5 100644 (file)
@@ -1147,7 +1147,7 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
                                          lfsck->li_time_last_checkpoint;
                __u64 checked = ns->ln_items_checked + com->lc_new_checked;
                __u64 speed = checked;
-               __u64 new_checked = com->lc_new_checked * CFS_HZ;
+               __u64 new_checked = com->lc_new_checked * HZ;
                __u32 rtime = ns->ln_run_time_phase1 +
                              cfs_duration_sec(duration + HALF_SEC);
 
@@ -1231,7 +1231,7 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
                                com->lc_new_checked;
                __u64 speed1 = ns->ln_items_checked;
                __u64 speed2 = checked;
-               __u64 new_checked = com->lc_new_checked * CFS_HZ;
+               __u64 new_checked = com->lc_new_checked * HZ;
                __u32 rtime = ns->ln_run_time_phase2 +
                              cfs_duration_sec(duration + HALF_SEC);
 
index 7e9ff3e..66cc580 100644 (file)
@@ -1101,12 +1101,12 @@ static int ll_rw_extents_stats_pp_seq_show(struct seq_file *seq, void *v)
         struct timeval now;
         struct ll_sb_info *sbi = seq->private;
         struct ll_rw_extents_info *io_extents = &sbi->ll_rw_extents_info;
-        int k;
+       int k;
 
-        cfs_gettimeofday(&now);
+       do_gettimeofday(&now);
 
-        if (!sbi->ll_rw_stats_on) {
-                seq_printf(seq, "disabled\n"
+       if (!sbi->ll_rw_stats_on) {
+               seq_printf(seq, "disabled\n"
                                 "write anything in this file to activate, "
                                 "then 0 or \"[D/d]isabled\" to deactivate\n");
                 return 0;
@@ -1163,13 +1163,13 @@ LPROC_SEQ_FOPS(ll_rw_extents_stats_pp);
 
 static int ll_rw_extents_stats_seq_show(struct seq_file *seq, void *v)
 {
-        struct timeval now;
-        struct ll_sb_info *sbi = seq->private;
-        struct ll_rw_extents_info *io_extents = &sbi->ll_rw_extents_info;
+       struct timeval now;
+       struct ll_sb_info *sbi = seq->private;
+       struct ll_rw_extents_info *io_extents = &sbi->ll_rw_extents_info;
 
-        cfs_gettimeofday(&now);
+       do_gettimeofday(&now);
 
-        if (!sbi->ll_rw_stats_on) {
+       if (!sbi->ll_rw_stats_on) {
                 seq_printf(seq, "disabled\n"
                                 "write anything in this file to activate, "
                                 "then 0 or \"[D/d]isabled\" to deactivate\n");
@@ -1329,11 +1329,11 @@ static int ll_rw_offset_stats_seq_show(struct seq_file *seq, void *v)
         struct ll_sb_info *sbi = seq->private;
         struct ll_rw_process_info *offset = sbi->ll_rw_offset_info;
         struct ll_rw_process_info *process = sbi->ll_rw_process_info;
-        int i;
+       int i;
 
-        cfs_gettimeofday(&now);
+       do_gettimeofday(&now);
 
-        if (!sbi->ll_rw_stats_on) {
+       if (!sbi->ll_rw_stats_on) {
                 seq_printf(seq, "disabled\n"
                                 "write anything in this file to activate, "
                                 "then 0 or \"[D/d]isabled\" to deactivate\n");
index 9f156e5..06b55fe 100644 (file)
@@ -189,8 +189,8 @@ static int __init init_lustre_lite(void)
                 }
         }
 
-        cfs_gettimeofday(&tv);
-        cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
+       do_gettimeofday(&tv);
+       cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
 
         init_timer(&ll_capa_timer);
         ll_capa_timer.function = ll_capa_timer_callback;
index b237401..ea9cde7 100644 (file)
@@ -678,7 +678,7 @@ static void lod_ah_init(const struct lu_env *env,
                        struct dt_allocation_hint *ah,
                        struct dt_object *parent,
                        struct dt_object *child,
-                       cfs_umode_t child_mode)
+                       umode_t child_mode)
 {
        struct lod_device *d = lu2lod_dev(child->do_lu.lo_dev);
        struct dt_object  *nextp = NULL;
index e5e5733..b3a4bc3 100644 (file)
@@ -347,7 +347,7 @@ int __mdd_orphan_del(const struct lu_env *, struct mdd_object *,
 int orph_index_init(const struct lu_env *env, struct mdd_device *mdd);
 void orph_index_fini(const struct lu_env *env, struct mdd_device *mdd);
 int orph_declare_index_insert(const struct lu_env *, struct mdd_object *,
-                             cfs_umode_t mode, struct thandle *);
+                             umode_t mode, struct thandle *);
 int orph_declare_index_delete(const struct lu_env *, struct mdd_object *,
                               struct thandle *);
 
@@ -524,7 +524,7 @@ static inline int mdd_object_obf(const struct mdd_object *obj)
        return lu_fid_eq(mdo2fid(obj), &LU_OBF_FID);
 }
 
-static inline cfs_umode_t mdd_object_type(const struct mdd_object *obj)
+static inline umode_t mdd_object_type(const struct mdd_object *obj)
 {
         return lu_object_attr(&obj->mod_obj.mo_lu);
 }
index 99102ea..824c92f 100644 (file)
@@ -566,11 +566,11 @@ static int mdd_fix_attr(const struct lu_env *env, struct mdd_object *obj,
                    !md_capable(uc, CFS_CAP_FOWNER))
                        RETURN(-EPERM);
 
-                if (la->la_mode == (cfs_umode_t) -1)
-                        la->la_mode = tmp_la->la_mode;
-                else
-                        la->la_mode = (la->la_mode & S_IALLUGO) |
-                                      (tmp_la->la_mode & ~S_IALLUGO);
+               if (la->la_mode == (umode_t) -1)
+                       la->la_mode = tmp_la->la_mode;
+               else
+                       la->la_mode = (la->la_mode & S_IALLUGO) |
+                                     (tmp_la->la_mode & ~S_IALLUGO);
 
                /* Also check the setgid bit! */
                if (!lustre_in_group_p(uc, (la->la_valid & LA_GID) ?
index a1064f8..9aa132b 100644 (file)
@@ -156,7 +156,7 @@ static inline void mdd_orphan_ref_del(const struct lu_env *env,
 
 int orph_declare_index_insert(const struct lu_env *env,
                              struct mdd_object *obj,
-                             cfs_umode_t mode, struct thandle *th)
+                             umode_t mode, struct thandle *th)
 {
        struct mdd_device       *mdd = mdo2mdd(&obj->mod_obj);
        struct dt_key           *key;
index 6e13b42..72d2d14 100644 (file)
@@ -46,7 +46,7 @@
 
 static inline void set_capa_key_expiry(struct mdt_device *mdt)
 {
-        mdt->mdt_ck_expiry = jiffies + mdt->mdt_ck_timeout * CFS_HZ;
+       mdt->mdt_ck_expiry = jiffies + mdt->mdt_ck_timeout * HZ;
 }
 
 static void make_capa_key(struct lustre_capa_key *key,
@@ -272,11 +272,11 @@ static int mdt_ck_thread_main(void *args)
                                 DEBUG_CAPA_KEY(D_SEC, rkey, "new");
                         }
                 }
-                if (rc) {
-                        DEBUG_CAPA_KEY(D_ERROR, rkey, "update failed for");
-                        /* next retry is in 300 sec */
-                        mdt->mdt_ck_expiry = jiffies + 300 * CFS_HZ;
-                }
+               if (rc) {
+                       DEBUG_CAPA_KEY(D_ERROR, rkey, "update failed for");
+                       /* next retry is in 300 sec */
+                       mdt->mdt_ck_expiry = jiffies + 300 * HZ;
+               }
 
                 cfs_timer_arm(&mdt->mdt_ck_timer, mdt->mdt_ck_expiry);
                 CDEBUG(D_SEC, "mdt_ck_timer %lu\n", mdt->mdt_ck_expiry);
index e7e76b0..da22aaa 100644 (file)
@@ -125,10 +125,10 @@ static int mdt_identity_do_upcall(struct upcall_cache *cache,
         argv[0] = cache->uc_upcall;
         snprintf(keystr, sizeof(keystr), LPU64, entry->ue_key);
 
-        cfs_gettimeofday(&start);
-        rc = USERMODEHELPER(argv[0], argv, envp);
-        cfs_gettimeofday(&end);
-        if (rc < 0) {
+       do_gettimeofday(&start);
+       rc = USERMODEHELPER(argv[0], argv, envp);
+       do_gettimeofday(&end);
+       if (rc < 0) {
                 CERROR("%s: error invoking upcall %s %s %s: rc %d; "
                        "check /proc/fs/lustre/mdt/%s/identity_upcall, "
                        "time %ldus\n",
index f91f8a1..c7d39bc 100644 (file)
@@ -540,13 +540,13 @@ static int mgc_requeue_thread(void *data)
                rq_state &= ~(RQ_NOW | RQ_LATER);
                spin_unlock(&config_list_lock);
 
-                /* Always wait a few seconds to allow the server who
-                   caused the lock revocation to finish its setup, plus some
-                   random so everyone doesn't try to reconnect at once. */
-                to = MGC_TIMEOUT_MIN_SECONDS * CFS_HZ;
-                to += rand * CFS_HZ / 100; /* rand is centi-seconds */
-                lwi = LWI_TIMEOUT(to, NULL, NULL);
-                l_wait_event(rq_waitq, rq_state & RQ_STOP, &lwi);
+               /* Always wait a few seconds to allow the server who
+                  caused the lock revocation to finish its setup, plus some
+                  random so everyone doesn't try to reconnect at once. */
+               to = MGC_TIMEOUT_MIN_SECONDS * HZ;
+               to += rand * HZ / 100; /* rand is centi-seconds */
+               lwi = LWI_TIMEOUT(to, NULL, NULL);
+               l_wait_event(rq_waitq, rq_state & RQ_STOP, &lwi);
 
                 /*
                  * iterate & processing through the list. for each cld, process
index 9db542c..89cb281 100644 (file)
@@ -1419,7 +1419,7 @@ static int lprocfs_stats_seq_show(struct seq_file *p, void *v)
        if (idx == 0) {
                struct timeval now;
 
-               cfs_gettimeofday(&now);
+               do_gettimeofday(&now);
                rc = seq_printf(p, "%-25s %lu.%lu secs.usecs\n",
                                "snapshot_time", now.tv_sec, now.tv_usec);
                if (rc < 0)
index e090a8a..4833256 100644 (file)
@@ -227,10 +227,10 @@ int class_handle_init(void)
                spin_lock_init(&bucket->lock);
        }
 
-        /** bug 21430: add randomness to the initial base */
-        cfs_get_random_bytes(seed, sizeof(seed));
-        cfs_gettimeofday(&tv);
-        cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
+       /** bug 21430: add randomness to the initial base */
+       cfs_get_random_bytes(seed, sizeof(seed));
+       do_gettimeofday(&tv);
+       cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
 
         cfs_get_random_bytes(&handle_base, sizeof(handle_base));
         LASSERT(handle_base != 0ULL);
index c2ca70c..645e56b 100644 (file)
@@ -1070,9 +1070,9 @@ static int process_param2_config(struct lustre_cfg *lcfg)
                RETURN(-EINVAL);
        }
 
-       cfs_gettimeofday(&start);
+       do_gettimeofday(&start);
        rc = USERMODEHELPER(argv[0], argv, NULL);
-       cfs_gettimeofday(&end);
+       do_gettimeofday(&end);
 
        if (rc < 0) {
                CERROR("lctl: error invoking upcall %s %s %s: rc = %d; "
index 6082c31..915a519 100644 (file)
@@ -1516,7 +1516,7 @@ int echo_attr_get_complex(const struct lu_env *env, struct md_object *next,
 {
        struct echo_thread_info *info = echo_env_info(env);
        struct lu_buf           *buf = &info->eti_buf;
-       cfs_umode_t              mode = lu_object_attr(&next->mo_lu);
+       umode_t          mode = lu_object_attr(&next->mo_lu);
        int                      need = ma->ma_need;
        int                      rc = 0, rc2;
 
index 5c7dad7..089271a 100644 (file)
@@ -248,7 +248,7 @@ int lprocfs_ofd_rd_fmd_max_age(char *page, char **start, off_t off,
        struct ofd_device       *ofd = ofd_dev(obd->obd_lu_dev);
        int                      rc;
 
-       rc = snprintf(page, count, "%ld\n", ofd->ofd_fmd_max_age / CFS_HZ);
+       rc = snprintf(page, count, "%ld\n", ofd->ofd_fmd_max_age / HZ);
        return rc;
 }
 
@@ -267,7 +267,7 @@ int lprocfs_ofd_wr_fmd_max_age(struct file *file, const char *buffer,
        if (val > 65536 || val < 1)
                return -EINVAL;
 
-       ofd->ofd_fmd_max_age = val * CFS_HZ;
+       ofd->ofd_fmd_max_age = val * HZ;
        return count;
 }
 
index 5dac3ab..5d1b880 100644 (file)
@@ -70,7 +70,7 @@ struct ofd_mod_data {
 };
 
 #define OFD_FMD_MAX_NUM_DEFAULT 128
-#define OFD_FMD_MAX_AGE_DEFAULT ((obd_timeout + 10) * CFS_HZ)
+#define OFD_FMD_MAX_AGE_DEFAULT ((obd_timeout + 10) * HZ)
 
 enum {
        LPROC_OFD_READ_BYTES = 0,
index ba23711..986d563 100644 (file)
@@ -552,11 +552,11 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
         struct obd_device *dev = seq->private;
         struct client_obd *cli = &dev->u.cli;
         unsigned long read_tot = 0, write_tot = 0, read_cum, write_cum;
-        int i;
+       int i;
 
-        cfs_gettimeofday(&now);
+       do_gettimeofday(&now);
 
-        client_obd_list_lock(&cli->cl_loi_list_lock);
+       client_obd_list_lock(&cli->cl_loi_list_lock);
 
         seq_printf(seq, "snapshot_time:         %lu.%lu (secs.usecs)\n",
                    now.tv_sec, now.tv_usec);
@@ -664,21 +664,21 @@ LPROC_SEQ_FOPS(osc_rpc_stats);
 
 static int osc_stats_seq_show(struct seq_file *seq, void *v)
 {
-        struct timeval now;
-        struct obd_device *dev = seq->private;
-        struct osc_stats *stats = &obd2osc_dev(dev)->od_stats;
-
-        cfs_gettimeofday(&now);
-
-        seq_printf(seq, "snapshot_time:         %lu.%lu (secs.usecs)\n",
-                   now.tv_sec, now.tv_usec);
-        seq_printf(seq, "lockless_write_bytes\t\t"LPU64"\n",
-                   stats->os_lockless_writes);
-        seq_printf(seq, "lockless_read_bytes\t\t"LPU64"\n",
-                   stats->os_lockless_reads);
-        seq_printf(seq, "lockless_truncate\t\t"LPU64"\n",
-                   stats->os_lockless_truncates);
-        return 0;
+       struct timeval now;
+       struct obd_device *dev = seq->private;
+       struct osc_stats *stats = &obd2osc_dev(dev)->od_stats;
+
+       do_gettimeofday(&now);
+
+       seq_printf(seq, "snapshot_time:         %lu.%lu (secs.usecs)\n",
+                  now.tv_sec, now.tv_usec);
+       seq_printf(seq, "lockless_write_bytes\t\t"LPU64"\n",
+                  stats->os_lockless_writes);
+       seq_printf(seq, "lockless_read_bytes\t\t"LPU64"\n",
+                  stats->os_lockless_reads);
+       seq_printf(seq, "lockless_truncate\t\t"LPU64"\n",
+                  stats->os_lockless_truncates);
+       return 0;
 }
 
 static ssize_t osc_stats_seq_write(struct file *file, const char *buf,
index 02ea505..a66d90e 100644 (file)
@@ -1798,9 +1798,8 @@ struct dentry *osd_child_dentry_get(const struct lu_env *env,
 }
 
 static int osd_mkfile(struct osd_thread_info *info, struct osd_object *obj,
-                      cfs_umode_t mode,
-                      struct dt_allocation_hint *hint,
-                      struct thandle *th)
+                     umode_t mode, struct dt_allocation_hint *hint,
+                     struct thandle *th)
 {
         int result;
         struct osd_device  *osd = osd_obj2dev(obj);
@@ -1933,16 +1932,16 @@ static int osd_mksym(struct osd_thread_info *info, struct osd_object *obj,
 }
 
 static int osd_mknod(struct osd_thread_info *info, struct osd_object *obj,
-                     struct lu_attr *attr,
-                     struct dt_allocation_hint *hint,
-                     struct dt_object_format *dof,
-                     struct thandle *th)
+                    struct lu_attr *attr,
+                    struct dt_allocation_hint *hint,
+                    struct dt_object_format *dof,
+                    struct thandle *th)
 {
-        cfs_umode_t mode = attr->la_mode & (S_IFMT | S_IALLUGO | S_ISVTX);
-        int result;
+       umode_t mode = attr->la_mode & (S_IFMT | S_IALLUGO | S_ISVTX);
+       int result;
 
-        LINVRNT(osd_invariant(obj));
-        LASSERT(obj->oo_inode == NULL);
+       LINVRNT(osd_invariant(obj));
+       LASSERT(obj->oo_inode == NULL);
         LASSERT(S_ISCHR(mode) || S_ISBLK(mode) ||
                 S_ISFIFO(mode) || S_ISSOCK(mode));
 
@@ -1997,7 +1996,7 @@ static osd_obj_type_f osd_create_type_f(enum dt_format_type type)
 
 static void osd_ah_init(const struct lu_env *env, struct dt_allocation_hint *ah,
                        struct dt_object *parent, struct dt_object *child,
-                       cfs_umode_t child_mode)
+                       umode_t child_mode)
 {
         LASSERT(ah);
 
index 595cb89..eb6b2a0 100644 (file)
@@ -572,8 +572,8 @@ static int osd_write_prep(const struct lu_env *env, struct dt_object *dt,
         if (isize > osd->od_readcache_max_filesize)
                 cache = 0;
 
-        cfs_gettimeofday(&start);
-        for (i = 0; i < npages; i++) {
+       do_gettimeofday(&start);
+       for (i = 0; i < npages; i++) {
 
                 if (cache == 0)
                         generic_error_remove_page(inode->i_mapping,
@@ -603,11 +603,11 @@ static int osd_write_prep(const struct lu_env *env, struct dt_object *dt,
                         if (off)
                                memset(p + off, 0, PAGE_CACHE_SIZE - off);
                         kunmap(lnb[i].page);
-                }
-        }
-        cfs_gettimeofday(&end);
-        timediff = cfs_timeval_sub(&end, &start, NULL);
-        lprocfs_counter_add(osd->od_stats, LPROC_OSD_GET_PAGE, timediff);
+               }
+       }
+       do_gettimeofday(&end);
+       timediff = cfs_timeval_sub(&end, &start, NULL);
+       lprocfs_counter_add(osd->od_stats, LPROC_OSD_GET_PAGE, timediff);
 
         if (iobuf->dr_npages) {
                rc = osd->od_fsops->fs_map_inode_pages(inode, iobuf->dr_pages,
@@ -870,8 +870,8 @@ static int osd_read_prep(const struct lu_env *env, struct dt_object *dt,
        if (i_size_read(inode) > osd->od_readcache_max_filesize)
                cache = 0;
 
-        cfs_gettimeofday(&start);
-        for (i = 0; i < npages; i++) {
+       do_gettimeofday(&start);
+       for (i = 0; i < npages; i++) {
 
                if (i_size_read(inode) <= lnb[i].lnb_file_offset)
                         /* If there's no more data, abort early.
@@ -894,12 +894,12 @@ static int osd_read_prep(const struct lu_env *env, struct dt_object *dt,
                                             LPROC_OSD_CACHE_MISS, 1);
                         osd_iobuf_add_page(iobuf, lnb[i].page);
                 }
-                if (cache == 0)
-                        generic_error_remove_page(inode->i_mapping,lnb[i].page);
-        }
-        cfs_gettimeofday(&end);
-        timediff = cfs_timeval_sub(&end, &start, NULL);
-        lprocfs_counter_add(osd->od_stats, LPROC_OSD_GET_PAGE, timediff);
+               if (cache == 0)
+                       generic_error_remove_page(inode->i_mapping,lnb[i].page);
+       }
+       do_gettimeofday(&end);
+       timediff = cfs_timeval_sub(&end, &start, NULL);
+       lprocfs_counter_add(osd->od_stats, LPROC_OSD_GET_PAGE, timediff);
 
         if (iobuf->dr_npages) {
                rc = osd->od_fsops->fs_map_inode_pages(inode, iobuf->dr_pages,
index 251a97c..5171863 100644 (file)
@@ -125,12 +125,12 @@ static void display_brw_stats(struct seq_file *seq, char *name, char *units,
 
 static void brw_stats_show(struct seq_file *seq, struct brw_stats *brw_stats)
 {
-        struct timeval now;
+       struct timeval now;
 
-        /* this sampling races with updates */
-        cfs_gettimeofday(&now);
-        seq_printf(seq, "snapshot_time:         %lu.%lu (secs.usecs)\n",
-                   now.tv_sec, now.tv_usec);
+       /* this sampling races with updates */
+       do_gettimeofday(&now);
+       seq_printf(seq, "snapshot_time:         %lu.%lu (secs.usecs)\n",
+                  now.tv_sec, now.tv_usec);
 
         display_brw_stats(seq, "pages per bulk r/w", "rpcs",
                           &brw_stats->hist[BRW_R_PAGES],
@@ -152,9 +152,9 @@ static void brw_stats_show(struct seq_file *seq, struct brw_stats *brw_stats)
                           &brw_stats->hist[BRW_R_RPC_HIST],
                           &brw_stats->hist[BRW_W_RPC_HIST], 0);
 
-        display_brw_stats(seq, "I/O time (1/1000s)", "ios",
-                          &brw_stats->hist[BRW_R_IO_TIME],
-                          &brw_stats->hist[BRW_W_IO_TIME], 1000 / CFS_HZ);
+       display_brw_stats(seq, "I/O time (1/1000s)", "ios",
+                         &brw_stats->hist[BRW_R_IO_TIME],
+                         &brw_stats->hist[BRW_W_IO_TIME], 1000 / HZ);
 
         display_brw_stats(seq, "disk I/O size", "ios",
                           &brw_stats->hist[BRW_R_DISK_IOSIZE],
index 299b532..5e6ee4a 100644 (file)
@@ -46,7 +46,7 @@
 #include "osd_oi.h"
 #include "osd_scrub.h"
 
-#define HALF_SEC       (CFS_HZ >> 1)
+#define HALF_SEC       (HZ >> 1)
 
 #define OSD_OTABLE_MAX_HASH            0x00000000ffffffffULL
 
@@ -2625,7 +2625,7 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
        if (thread_is_running(&scrub->os_thread)) {
                cfs_duration_t duration = cfs_time_current() -
                                          scrub->os_time_last_checkpoint;
-               __u64 new_checked = scrub->os_new_checked * CFS_HZ;
+               __u64 new_checked = scrub->os_new_checked * HZ;
                __u32 rtime = sf->sf_run_time +
                              cfs_duration_sec(duration + HALF_SEC);
 
index 8cd6569..fa6fba9 100644 (file)
@@ -1058,7 +1058,7 @@ static int osd_attr_set(const struct lu_env *env, struct dt_object *dt,
 
 static void osd_ah_init(const struct lu_env *env, struct dt_allocation_hint *ah,
                        struct dt_object *parent, struct dt_object *child,
-                       cfs_umode_t child_mode)
+                       umode_t child_mode)
 {
        LASSERT(ah);
 
index 255407b..4bbcabe 100644 (file)
@@ -509,7 +509,7 @@ static void osp_md_ah_init(const struct lu_env *env,
                           struct dt_allocation_hint *ah,
                           struct dt_object *parent,
                           struct dt_object *child,
-                          cfs_umode_t child_mode)
+                          umode_t child_mode)
 {
        LASSERT(ah);
 
index 8b96c5d..a3e6fea 100644 (file)
@@ -1293,13 +1293,13 @@ static int after_reply(struct ptlrpc_request *req)
                RETURN(0);
        }
 
-        cfs_gettimeofday(&work_start);
-        timediff = cfs_timeval_sub(&work_start, &req->rq_arrival_time, NULL);
-        if (obd->obd_svc_stats != NULL) {
-                lprocfs_counter_add(obd->obd_svc_stats, PTLRPC_REQWAIT_CNTR,
-                                    timediff);
-                ptlrpc_lprocfs_rpc_sent(req, timediff);
-        }
+       do_gettimeofday(&work_start);
+       timediff = cfs_timeval_sub(&work_start, &req->rq_arrival_time, NULL);
+       if (obd->obd_svc_stats != NULL) {
+               lprocfs_counter_add(obd->obd_svc_stats, PTLRPC_REQWAIT_CNTR,
+                                   timediff);
+               ptlrpc_lprocfs_rpc_sent(req, timediff);
+       }
 
         if (lustre_msg_get_type(req->rq_repmsg) != PTL_RPC_MSG_REPLY &&
             lustre_msg_get_type(req->rq_repmsg) != PTL_RPC_MSG_ERR) {
index ceaade5..b25c72f 100644 (file)
@@ -334,12 +334,12 @@ void request_in_callback(lnet_event_t *ev)
          * size to non-zero if this was a successful receive. */
         req->rq_xid = ev->match_bits;
         req->rq_reqbuf = ev->md.start + ev->offset;
-        if (ev->type == LNET_EVENT_PUT && ev->status == 0)
-                req->rq_reqdata_len = ev->mlength;
-        cfs_gettimeofday(&req->rq_arrival_time);
-        req->rq_peer = ev->initiator;
-        req->rq_self = ev->target.nid;
-        req->rq_rqbd = rqbd;
+       if (ev->type == LNET_EVENT_PUT && ev->status == 0)
+               req->rq_reqdata_len = ev->mlength;
+       do_gettimeofday(&req->rq_arrival_time);
+       req->rq_peer = ev->initiator;
+       req->rq_self = ev->target.nid;
+       req->rq_rqbd = rqbd;
         req->rq_phase = RQ_PHASE_NEW;
        spin_lock_init(&req->rq_lock);
         CFS_INIT_LIST_HEAD(&req->rq_timed_list);
index 5abc75c..1f1fe15 100644 (file)
@@ -163,23 +163,22 @@ static void ctx_upcall_timeout_kr(unsigned long data)
         key_revoke_locked(key);
 }
 
-static
-void ctx_start_timer_kr(struct ptlrpc_cli_ctx *ctx, long timeout)
+static void ctx_start_timer_kr(struct ptlrpc_cli_ctx *ctx, long timeout)
 {
-        struct gss_cli_ctx_keyring *gctx_kr = ctx2gctx_keyring(ctx);
-        struct timer_list          *timer = gctx_kr->gck_timer;
+       struct gss_cli_ctx_keyring *gctx_kr = ctx2gctx_keyring(ctx);
+       struct timer_list          *timer = gctx_kr->gck_timer;
 
-        LASSERT(timer);
+       LASSERT(timer);
 
-        CDEBUG(D_SEC, "ctx %p: start timer %lds\n", ctx, timeout);
-        timeout = timeout * CFS_HZ + cfs_time_current();
+       CDEBUG(D_SEC, "ctx %p: start timer %lds\n", ctx, timeout);
+       timeout = timeout * HZ + cfs_time_current();
 
-        init_timer(timer);
-        timer->expires = timeout;
-        timer->data = (unsigned long ) ctx;
-        timer->function = ctx_upcall_timeout_kr;
+       init_timer(timer);
+       timer->expires = timeout;
+       timer->data = (unsigned long ) ctx;
+       timer->function = ctx_upcall_timeout_kr;
 
-        add_timer(timer);
+       add_timer(timer);
 }
 
 /*
index 07ef7ba..ded347f 100644 (file)
@@ -911,12 +911,12 @@ cache_check:
                                 cfs_set_current_state(CFS_TASK_INTERRUPTIBLE);
                         read_unlock(&rsi_cache.hash_lock);
 
-                        if (valid == 0)
-                                cfs_schedule_timeout(GSS_SVC_UPCALL_TIMEOUT *
-                                                     CFS_HZ);
+                       if (valid == 0)
+                               cfs_schedule_timeout(GSS_SVC_UPCALL_TIMEOUT *
+                                                    HZ);
 
-                        cache_get(&rsip->h);
-                        goto cache_check;
+                       cache_get(&rsip->h);
+                       goto cache_check;
                 }
                 CWARN("waited %ds timeout, drop\n", GSS_SVC_UPCALL_TIMEOUT);
                 break;
@@ -1078,13 +1078,13 @@ int __init gss_init_svc_upcall(void)
          * upcall issued before the channel be opened thus nfsv4 cache code will
          * drop the request direclty, thus lead to unnecessary recovery time.
          * here we wait at miximum 1.5 seconds. */
-        for (i = 0; i < 6; i++) {
-                if (atomic_read(&rsi_cache.readers) > 0)
-                        break;
-                cfs_set_current_state(TASK_UNINTERRUPTIBLE);
-                LASSERT(CFS_HZ >= 4);
-                cfs_schedule_timeout(CFS_HZ / 4);
-        }
+       for (i = 0; i < 6; i++) {
+               if (atomic_read(&rsi_cache.readers) > 0)
+                       break;
+               cfs_set_current_state(TASK_UNINTERRUPTIBLE);
+               LASSERT(HZ >= 4);
+               cfs_schedule_timeout(HZ / 4);
+       }
 
         if (atomic_read(&rsi_cache.readers) == 0)
                 CWARN("Init channel is not opened by lsvcgssd, following "
index 65506ea..6f2cebb 100644 (file)
@@ -810,12 +810,12 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
                 lprocfs_counter_add(obd->obd_svc_stats, PTLRPC_REQACTIVE_CNTR,
                         cfs_atomic_read(&request->rq_import->imp_inflight));
 
-        OBD_FAIL_TIMEOUT(OBD_FAIL_PTLRPC_DELAY_SEND, request->rq_timeout + 5);
+       OBD_FAIL_TIMEOUT(OBD_FAIL_PTLRPC_DELAY_SEND, request->rq_timeout + 5);
 
-        cfs_gettimeofday(&request->rq_arrival_time);
-        request->rq_sent = cfs_time_current_sec();
-        /* We give the server rq_timeout secs to process the req, and
-           add the network latency for our local timeout. */
+       do_gettimeofday(&request->rq_arrival_time);
+       request->rq_sent = cfs_time_current_sec();
+       /* We give the server rq_timeout secs to process the req, and
+          add the network latency for our local timeout. */
         request->rq_deadline = request->rq_sent + request->rq_timeout +
                 ptlrpc_at_get_net_latency(request);
 
index cf6d381..2553e68 100644 (file)
@@ -553,9 +553,9 @@ int sptlrpc_req_replace_dead_ctx(struct ptlrpc_request *req)
                        "ctx (%p, fl %lx) doesn't switch, relax a little bit\n",
                        newctx, newctx->cc_flags);
 
-                cfs_schedule_timeout_and_set_state(CFS_TASK_INTERRUPTIBLE,
-                                                   CFS_HZ);
-        } else {
+               cfs_schedule_timeout_and_set_state(CFS_TASK_INTERRUPTIBLE,
+                                                  HZ);
+       } else {
                 /*
                  * it's possible newctx == oldctx if we're switching
                  * subflavor with the same sec.
@@ -775,9 +775,9 @@ again:
        req->rq_restart = 0;
        spin_unlock(&req->rq_lock);
 
-        lwi = LWI_TIMEOUT_INTR(timeout * CFS_HZ, ctx_refresh_timeout,
-                               ctx_refresh_interrupt, req);
-        rc = l_wait_event(req->rq_reply_waitq, ctx_check_refresh(ctx), &lwi);
+       lwi = LWI_TIMEOUT_INTR(timeout * HZ, ctx_refresh_timeout,
+                              ctx_refresh_interrupt, req);
+       rc = l_wait_event(req->rq_reply_waitq, ctx_check_refresh(ctx), &lwi);
 
         /*
          * following cases could lead us here:
index 1e7f246..a3314d9 100644 (file)
@@ -177,11 +177,11 @@ int sptlrpc_proc_read_enc_pool(char *page, char **start, off_t off, int count,
                       page_pools.epp_st_grow_fails,
                       page_pools.epp_st_shrinks,
                       page_pools.epp_st_access,
-                      page_pools.epp_st_missings,
-                      page_pools.epp_st_lowfree,
-                      page_pools.epp_st_max_wqlen,
-                      page_pools.epp_st_max_wait, CFS_HZ
-                     );
+                     page_pools.epp_st_missings,
+                     page_pools.epp_st_lowfree,
+                     page_pools.epp_st_max_wqlen,
+                     page_pools.epp_st_max_wait, HZ
+                    );
 
        spin_unlock(&page_pools.epp_lock);
        return rc;
@@ -776,10 +776,10 @@ void sptlrpc_enc_pool_fini(void)
                        CFS_TIME_T"/%d\n",
                        page_pools.epp_st_max_pages, page_pools.epp_st_grows,
                        page_pools.epp_st_grow_fails,
-                       page_pools.epp_st_shrinks, page_pools.epp_st_access,
-                       page_pools.epp_st_missings, page_pools.epp_st_max_wqlen,
-                       page_pools.epp_st_max_wait, CFS_HZ);
-        }
+                      page_pools.epp_st_shrinks, page_pools.epp_st_access,
+                      page_pools.epp_st_missings, page_pools.epp_st_max_wqlen,
+                      page_pools.epp_st_max_wait, HZ);
+       }
 }
 
 #else /* !__KERNEL__ */
index 4c6f20d..022f749 100644 (file)
@@ -201,14 +201,14 @@ again:
                 }
                mutex_unlock(&sec_gc_mutex);
 
-                /* check ctx list again before sleep */
-                sec_process_ctx_list();
-
-                lwi = LWI_TIMEOUT(SEC_GC_INTERVAL * CFS_HZ, NULL, NULL);
-                l_wait_event(thread->t_ctl_waitq,
-                             thread_is_stopping(thread) ||
-                             thread_is_signal(thread),
-                             &lwi);
+               /* check ctx list again before sleep */
+               sec_process_ctx_list();
+
+               lwi = LWI_TIMEOUT(SEC_GC_INTERVAL * HZ, NULL, NULL);
+               l_wait_event(thread->t_ctl_waitq,
+                            thread_is_stopping(thread) ||
+                            thread_is_signal(thread),
+                            &lwi);
 
                 if (thread_test_and_clear_flags(thread, SVC_STOPPING))
                         break;
index 2a7976f..f26976e 100644 (file)
@@ -1949,12 +1949,12 @@ ptlrpc_server_handle_request(struct ptlrpc_service_part *svcpt,
 
         ptlrpc_rqphase_move(request, RQ_PHASE_INTERPRET);
 
-        if(OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_DUMP_LOG))
-                libcfs_debug_dumplog();
+       if(OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_DUMP_LOG))
+               libcfs_debug_dumplog();
 
-        cfs_gettimeofday(&work_start);
-        timediff = cfs_timeval_sub(&work_start, &request->rq_arrival_time,NULL);
-        if (likely(svc->srv_stats != NULL)) {
+       do_gettimeofday(&work_start);
+       timediff = cfs_timeval_sub(&work_start, &request->rq_arrival_time,NULL);
+       if (likely(svc->srv_stats != NULL)) {
                 lprocfs_counter_add(svc->srv_stats, PTLRPC_REQWAIT_CNTR,
                                     timediff);
                 lprocfs_counter_add(svc->srv_stats, PTLRPC_REQQDEPTH_CNTR,
@@ -2030,8 +2030,8 @@ put_conn:
                                            request->rq_deadline));
        }
 
-        cfs_gettimeofday(&work_end);
-        timediff = cfs_timeval_sub(&work_end, &work_start, NULL);
+       do_gettimeofday(&work_end);
+       timediff = cfs_timeval_sub(&work_end, &work_start, NULL);
        CDEBUG(D_RPCTRACE, "Handled RPC pname:cluuid+ref:pid:xid:nid:opc "
                "%s:%s+%d:%d:x"LPU64":%s:%d Request procesed in "
                "%ldus (%ldus total) trans "LPU64" rc %d/%d\n",
@@ -3199,10 +3199,10 @@ int ptlrpc_svcpt_health_check(struct ptlrpc_service_part *svcpt)
        struct timeval                  right_now;
        long                            timediff;
 
-       cfs_gettimeofday(&right_now);
+       do_gettimeofday(&right_now);
 
        spin_lock(&svcpt->scp_req_lock);
-        /* How long has the next entry been waiting? */
+       /* How long has the next entry been waiting? */
        if (ptlrpc_server_high_pending(svcpt, true))
                request = ptlrpc_nrs_req_peek_nolock(svcpt, true);
        else if (ptlrpc_server_normal_pending(svcpt, true))