Whamcloud - gitweb
LU-9019 libcfs: remove the remaining cfs_time wrappers 68/31068/8
authorJames Simmons <uja.ornl@yahoo.com>
Thu, 12 Apr 2018 14:00:11 +0000 (10:00 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 6 May 2018 03:40:33 +0000 (03:40 +0000)
In the lustre code various small bits are left of the libcfs time
wrappers. Remove all the remaining wrappers except for the inline
function cfs_time_seconds(). For cfs_time_seconds() we have to
move to nsec_to_jiffies() since msecs_to_jiffies() has become an
inline function in jiffies.h which means HZ can be different on
the installation node verses what the target node is configured
for. Since nsec_to_jiffies() is a normal built in kernel function
we can avoid the LU-5443 issues. For cfs_duration_secs() we use
the internal kernel function jiffies_to_msec() since only the
newest kernels have jiffies_to_nsec() and that function is just
a wrapper around jiffies_to_msec(). All the reset of the libcfs
time abstractions are gone.

Change-Id: I166973071304f1d55a15b1e21fcfbe434ff58199
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/31068
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Ben Evans <bevans@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
27 files changed:
contrib/scripts/spelling.txt
libcfs/include/libcfs/Makefile.am
libcfs/include/libcfs/libcfs.h
libcfs/include/libcfs/libcfs_time.h [deleted file]
libcfs/include/libcfs/linux/linux-time.h
libcfs/libcfs/debug.c
libcfs/libcfs/linux/linux-prim.c
libcfs/libcfs/module.c
libcfs/libcfs/tracefile.c
lnet/include/lnet/lib-lnet.h
lnet/klnds/gnilnd/gnilnd.h
lnet/klnds/o2iblnd/o2iblnd.h
lnet/lnet/router_proc.c
lustre/include/lprocfs_status.h
lustre/include/lustre_dlm.h
lustre/include/lustre_lib.h
lustre/include/lustre_net.h
lustre/ldlm/ldlm_lib.c
lustre/ldlm/ldlm_lockd.c
lustre/ldlm/ldlm_pool.c
lustre/lod/lod_internal.h
lustre/lod/lod_qos.c
lustre/obdclass/jobid.c
lustre/obdclass/linkea.c
lustre/obdclass/upcall_cache.c
lustre/ptlrpc/import.c
lustre/ptlrpc/service.c

index 7c46e43..bab5813 100644 (file)
@@ -66,11 +66,17 @@ cfs_list_splice_init||list_splice_init
 cfs_list_splice_tail||list_splice_tail
 cfs_list_t||struct list_head
 struct timeval||struct timespec64
+get_seconds||ktime_get_real_seconds
 cfs_time_current_sec||ktime_get_real_seconds
 cfs_time_current_64||ktime_get
 cfs_time_add_64||ktime_add
+cfs_time_after|time_after
+cfs_time_aftereq|time_after_eq
+cfs_time_before|time_before
+cfs_time_beforeeq|time_before_eq
 cfs_time_before_64||ktime_before
 cfs_time_beforeq_64||ktime_compare
+cfs_time_current|jiffies
 CFS_PAGE_MASK||PAGE_MASK
 CFS_PAGE_SIZE||PAGE_SIZE
 PAGE_CACHE_MASK||PAGE_MASK
index 7209f43..1819c11 100644 (file)
@@ -16,6 +16,5 @@ EXTRA_DIST = \
        libcfs_prim.h \
        libcfs_private.h \
        libcfs_string.h \
-       libcfs_time.h \
        libcfs_workitem.h \
        libcfs_ptask.h
index 73842eb..9b4395e 100644 (file)
 #ifndef __LIBCFS_LIBCFS_H__
 #define __LIBCFS_LIBCFS_H__
 
+#include <linux/kernel.h>
+#include <linux/module.h>
+
+#include <libcfs/linux/linux-misc.h>
+#include <libcfs/linux/linux-time.h>
+
 #include <uapi/linux/lnet/libcfs_ioctl.h>
 #include <libcfs/libcfs_debug.h>
 #include <libcfs/libcfs_private.h>
 #include <libcfs/bitmap.h>
 #include <libcfs/libcfs_cpu.h>
 #include <libcfs/libcfs_prim.h>
-#include <libcfs/libcfs_time.h>
 #include <libcfs/libcfs_string.h>
 #include <libcfs/libcfs_workitem.h>
 #include <libcfs/libcfs_hash.h>
diff --git a/libcfs/include/libcfs/libcfs_time.h b/libcfs/include/libcfs/libcfs_time.h
deleted file mode 100644 (file)
index e9ce49f..0000000
+++ /dev/null
@@ -1,72 +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.gnu.org/licenses/gpl-2.0.html
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2008, 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/libcfs_time.h
- *
- * Time functions.
- *
- */
-
-#ifndef __LIBCFS_TIME_H__
-#define __LIBCFS_TIME_H__
-
-#include <libcfs/linux/linux-time.h>
-
-/*
- * generic time manipulation functions.
- */
-
-static inline cfs_time_t cfs_time_add(cfs_time_t t, cfs_duration_t d)
-{
-        return (cfs_time_t)(t + d);
-}
-
-static inline cfs_duration_t cfs_time_sub(cfs_time_t t1, cfs_time_t t2)
-{
-        return (cfs_time_t)(t1 - t2);
-}
-
-static inline int cfs_time_after(cfs_time_t t1, cfs_time_t t2)
-{
-        return cfs_time_before(t2, t1);
-}
-
-static inline int cfs_time_aftereq(cfs_time_t t1, cfs_time_t t2)
-{
-        return cfs_time_beforeq(t2, t1);
-}
-
-static inline cfs_time_t cfs_time_shift(int seconds)
-{
-        return cfs_time_add(cfs_time_current(), cfs_time_seconds(seconds));
-}
-
-#define CFS_TICK       1
-
-#endif
index 67fb5c7..eeced6b 100644 (file)
 #define __LIBCFS_LINUX_LINUX_TIME_H__
 
 /* Portable time API */
-
-/*
- * Platform provides three opaque data-types:
- *
- *  cfs_time_t        represents point in time. This is internal kernel
- *                    time rather than "wall clock". This time bears no
- *                    relation to gettimeofday().
- *
- *  cfs_duration_t    represents time interval with resolution of internal
- *                    platform clock
- *
- *  cfs_time_t     cfs_time_current(void);
- *  cfs_time_t     cfs_time_add    (cfs_time_t, cfs_duration_t);
- *  cfs_duration_t cfs_time_sub    (cfs_time_t, cfs_time_t);
- *
- *  time_t         cfs_duration_sec (cfs_duration_t);
- */
-
 #include <linux/hrtimer.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 /*
  * Generic kernel stuff
  */
-
-typedef unsigned long cfs_time_t;      /* jiffies */
-typedef long cfs_duration_t;
-
 #ifndef HAVE_TIMESPEC64
 
 typedef __s64 time64_t;
@@ -214,34 +192,9 @@ static inline ktime_t timespec64_to_ktime(struct timespec64 ts)
 }
 #endif
 
-static inline int cfs_time_before(cfs_time_t t1, cfs_time_t t2)
-{
-        return time_before(t1, t2);
-}
-
-static inline int cfs_time_beforeq(cfs_time_t t1, cfs_time_t t2)
-{
-        return time_before_eq(t1, t2);
-}
-
-static inline cfs_time_t cfs_time_current(void)
-{
-        return jiffies;
-}
-
-static inline time_t cfs_time_current_sec(void)
-{
-       return get_seconds();
-}
-
-static inline cfs_duration_t cfs_time_seconds(int seconds)
-{
-       return ((cfs_duration_t)seconds) * msecs_to_jiffies(MSEC_PER_SEC);
-}
-
-static inline time_t cfs_duration_sec(cfs_duration_t d)
+static inline unsigned long cfs_time_seconds(time64_t seconds)
 {
-       return d / msecs_to_jiffies(MSEC_PER_SEC);
+       return nsecs_to_jiffies(seconds * NSEC_PER_SEC);
 }
 
 #endif /* __LIBCFS_LINUX_LINUX_TIME_H__ */
index a329689..98c30b7 100644 (file)
@@ -39,7 +39,6 @@
 
 #include <linux/ctype.h>
 #include <linux/kthread.h>
-#include <libcfs/linux/linux-misc.h>
 #include <libcfs/libcfs.h>
 #include "tracefile.h"
 
@@ -148,7 +147,7 @@ static int param_get_delay(char *buffer, cfs_kernel_param_arg_t *kp)
 {
        unsigned int d = *(unsigned int *)kp->arg;
 
-       return sprintf(buffer, "%u", (unsigned int)cfs_duration_sec(d * 100));
+       return sprintf(buffer, "%lu", jiffies_to_msecs(d * 10) / MSEC_PER_SEC);
 }
 
 unsigned int libcfs_console_max_delay;
index d9fd96b..4f07340 100644 (file)
 #include <linux/sched/mm.h>
 #endif
 #include <linux/uaccess.h>
-#include <libcfs/libcfs.h>
 
 #if defined(CONFIG_KGDB)
 #include <asm/kgdb.h>
 #endif
 
+#include <libcfs/linux/linux-time.h>
+
 #ifndef HAVE_KTIME_GET_TS64
 void ktime_get_ts64(struct timespec64 *ts)
 {
index 9fbf40c..e6e6d0c 100644 (file)
@@ -53,7 +53,6 @@
 
 #include <libcfs/libcfs.h>
 #include <libcfs/libcfs_crypto.h>
-#include <libcfs/linux/linux-misc.h>
 #include <lnet/lib-lnet.h>
 #include "tracefile.h"
 
index 5074ab1..6e6a28f 100644 (file)
@@ -46,7 +46,6 @@
 #include <linux/pagemap.h>
 #include <linux/uaccess.h>
 #include <libcfs/linux/linux-fs.h>
-#include <libcfs/linux/linux-misc.h>
 #include <libcfs/libcfs.h>
 
 /* XXX move things up to the top, comment */
@@ -395,34 +394,34 @@ console:
                 return 1;
         }
 
-        if (cdls != NULL) {
-                if (libcfs_console_ratelimit &&
-                    cdls->cdls_next != 0 &&     /* not first time ever */
-                    !cfs_time_after(cfs_time_current(), cdls->cdls_next)) {
-                        /* skipping a console message */
-                        cdls->cdls_count++;
-                        if (tcd != NULL)
-                                cfs_trace_put_tcd(tcd);
-                        return 1;
-                }
+       if (cdls != NULL) {
+               if (libcfs_console_ratelimit &&
+                   cdls->cdls_next != 0 &&     /* not first time ever */
+                   time_after(jiffies, cdls->cdls_next)) {
+                       /* skipping a console message */
+                       cdls->cdls_count++;
+                       if (tcd != NULL)
+                               cfs_trace_put_tcd(tcd);
+                       return 1;
+               }
 
-                if (cfs_time_after(cfs_time_current(), cdls->cdls_next +
-                                                       libcfs_console_max_delay
-                                                       + cfs_time_seconds(10))) {
-                        /* last timeout was a long time ago */
-                        cdls->cdls_delay /= libcfs_console_backoff * 4;
-                } else {
-                        cdls->cdls_delay *= libcfs_console_backoff;
-                }
+               if (time_after(jiffies, cdls->cdls_next +
+                                       libcfs_console_max_delay +
+                                       cfs_time_seconds(10))) {
+                       /* last timeout was a long time ago */
+                       cdls->cdls_delay /= libcfs_console_backoff * 4;
+               } else {
+                       cdls->cdls_delay *= libcfs_console_backoff;
+               }
 
                if (cdls->cdls_delay < libcfs_console_min_delay)
                        cdls->cdls_delay = libcfs_console_min_delay;
                else if (cdls->cdls_delay > libcfs_console_max_delay)
                        cdls->cdls_delay = libcfs_console_max_delay;
 
-                /* ensure cdls_next is never zero after it's been seen */
-                cdls->cdls_next = (cfs_time_current() + cdls->cdls_delay) | 1;
-        }
+               /* ensure cdls_next is never zero after it's been seen */
+               cdls->cdls_next = (jiffies + cdls->cdls_delay) | 1;
+       }
 
         if (tcd != NULL) {
                 cfs_print_to_console(&header, mask, string_buf, needed, file,
index 985d9a9..6197be6 100644 (file)
@@ -41,7 +41,6 @@
 # error This include is only for kernel use.
 #endif
 
-#include <libcfs/linux/linux-misc.h>
 #include <libcfs/libcfs.h>
 #include <lnet/api.h>
 #include <lnet/lib-types.h>
index 4a05d98..b511c9f 100644 (file)
 #include <gni_pub.h>
 #include "gnilnd_version.h"
 
+static inline time_t cfs_duration_sec(long duration_jiffies)
+{
+       return jiffies_to_msecs(duration_jiffies) / MSEC_PER_SEC;
+}
+
 #ifdef CONFIG_SLAB
 #define GNILND_MBOX_SIZE       KMALLOC_MAX_SIZE
 #else
index 8ac9c45..7c0d7f6 100644 (file)
@@ -79,7 +79,7 @@
 
 #define DEBUG_SUBSYSTEM S_LND
 
-#include <libcfs/libcfs_time.h>
+#include <libcfs/libcfs.h>
 #include <lnet/lib-lnet.h>
 
 #define IBLND_PEER_HASH_SIZE           101     /* # peer_ni lists */
index 329e43f..ea2aa6c 100644 (file)
@@ -24,7 +24,6 @@
 
 #include <linux/uaccess.h>
 
-#include <libcfs/linux/linux-misc.h>
 #include <libcfs/libcfs.h>
 #include <lnet/lib-lnet.h>
 
index 6c9b1f0..de1f0c6 100644 (file)
@@ -45,8 +45,7 @@
 #include <linux/spinlock.h>
 #include <linux/seq_file.h>
 
-#include <libcfs/libcfs_time.h>
-#include <libcfs/linux/linux-misc.h>
+#include <libcfs/libcfs.h>
 #include <uapi/linux/lustre/lustre_idl.h>
 
 struct lprocfs_vars {
index 10438ce..c400795 100644 (file)
@@ -1666,7 +1666,7 @@ void unlock_res_and_lock(struct ldlm_lock *lock);
  * There are not used outside of ldlm.
  * @{
  */
-int ldlm_pools_recalc(enum ldlm_side client);
+time64_t ldlm_pools_recalc(enum ldlm_side client);
 int ldlm_pools_init(void);
 void ldlm_pools_fini(void);
 
@@ -1675,7 +1675,7 @@ int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns,
 int ldlm_pool_shrink(struct ldlm_pool *pl, int nr, gfp_t gfp_mask);
 void ldlm_pool_fini(struct ldlm_pool *pl);
 int ldlm_pool_setup(struct ldlm_pool *pl, int limit);
-int ldlm_pool_recalc(struct ldlm_pool *pl);
+time64_t ldlm_pool_recalc(struct ldlm_pool *pl);
 __u32 ldlm_pool_get_lvf(struct ldlm_pool *pl);
 __u64 ldlm_pool_get_slv(struct ldlm_pool *pl);
 __u64 ldlm_pool_get_clv(struct ldlm_pool *pl);
index 5acfd89..4ab0db6 100644 (file)
@@ -47,7 +47,6 @@
 #include <linux/sched/mm.h>
 #endif
 
-#include <libcfs/linux/linux-misc.h>
 #include <libcfs/libcfs.h>
 #include <uapi/linux/lustre/lustre_idl.h>
 #include <uapi/linux/lustre/lustre_ver.h>
@@ -166,9 +165,9 @@ static inline int back_to_sleep(void *arg)
 #define LWI_ON_SIGNAL_NOOP ((void (*)(void *))(-1))
 
 struct l_wait_info {
-        cfs_duration_t lwi_timeout;
-        cfs_duration_t lwi_interval;
-        int            lwi_allow_intr;
+       long            lwi_timeout;
+       long            lwi_interval;
+       int             lwi_allow_intr;
         int  (*lwi_on_timeout)(void *);
         void (*lwi_on_signal)(void *);
         void  *lwi_cb_data;
@@ -260,8 +259,8 @@ static inline void __add_wait_queue_exclusive(wait_queue_head_t *q,
 #define __l_wait_event(wq, condition, info, ret, l_add_wait)                   \
 do {                                                                           \
        wait_queue_entry_t __wait;                                             \
-       cfs_duration_t __timeout = info->lwi_timeout;                          \
-       sigset_t   __blocked;                                              \
+       long __timeout = info->lwi_timeout;                                    \
+       sigset_t __blocked;                                                    \
        int   __allow_intr = info->lwi_allow_intr;                             \
                                                                               \
        ret = 0;                                                               \
@@ -310,13 +309,12 @@ do {                                                                           \
                if (__timeout == 0) {                                          \
                        schedule();                                            \
                } else {                                                       \
-                       cfs_duration_t interval = info->lwi_interval?          \
-                                            min_t(cfs_duration_t,             \
-                                                info->lwi_interval,__timeout):\
-                                            __timeout;                        \
-                       cfs_duration_t remaining = schedule_timeout(interval); \
-                       __timeout = cfs_time_sub(__timeout,                    \
-                                           cfs_time_sub(interval, remaining));\
+                       long interval = info->lwi_interval ?                   \
+                                               min_t(long, info->lwi_interval,\
+                                                     __timeout) : __timeout;  \
+                       long remaining = schedule_timeout(interval);           \
+                                                                              \
+                       __timeout -= interval - remaining;                     \
                        if (__timeout == 0) {                                  \
                                if (info->lwi_on_timeout == NULL ||            \
                                    info->lwi_on_timeout(info->lwi_cb_data)) { \
index 335cfe0..9e655e6 100644 (file)
@@ -1787,8 +1787,8 @@ struct ptlrpc_service_part {
        struct list_head                scp_rqbd_posted;
        /** incoming reqs */
        struct list_head                scp_req_incoming;
-       /** timeout before re-posting reqs, in tick */
-       cfs_duration_t                  scp_rqbd_timeout;
+       /** timeout before re-posting reqs, in jiffies */
+       long                            scp_rqbd_timeout;
        /**
         * all threads sleep on this. This wait-queue is signalled when new
         * incoming request arrives and when difficult reply has to be handled.
@@ -1839,7 +1839,7 @@ struct ptlrpc_service_part {
        /** early reply timer */
        struct timer_list               scp_at_timer;
        /** debug */
-       cfs_time_t                      scp_at_checktime;
+       ktime_t                         scp_at_checktime;
        /** check early replies */
        unsigned                        scp_at_check;
        /** @} */
index 5c122fb..45bbad4 100644 (file)
@@ -39,6 +39,7 @@
 
 #define DEBUG_SUBSYSTEM S_LDLM
 
+#include <linux/jiffies.h>
 #include <linux/kthread.h>
 #include <libcfs/libcfs.h>
 #include <obd.h>
@@ -787,7 +788,8 @@ static int target_handle_reconnect(struct lustre_handle *conn,
        }
 
        now = ktime_get_seconds();
-       deadline = cfs_duration_sec(target->obd_recovery_timer.expires);
+       deadline = jiffies_to_msecs(target->obd_recovery_timer.expires) /
+                  MSEC_PER_SEC;
        if (now < deadline) {
                struct target_distribute_txn_data *tdtd;
                int size = 0;
@@ -1254,8 +1256,8 @@ no_export:
                        i = atomic_read(&target->obd_lock_replay_clients);
                        k = target->obd_max_recoverable_clients;
                        s = target->obd_stale_clients;
-                       t = target->obd_recovery_timer.expires;
-                       t = cfs_duration_sec(target->obd_recovery_timer.expires);
+                       t = jiffies_to_msecs(target->obd_recovery_timer.expires);
+                       t /= MSEC_PER_SEC;
                        t -= ktime_get_seconds();
                        LCONSOLE_WARN("%s: Denying connection for new client %s"
                                      "(at %s), waiting for %d known clients "
index 81ed655..122c284 100644 (file)
@@ -245,9 +245,8 @@ static int expired_lock_main(void *arg)
                                spin_unlock_bh(&export->exp_bl_list_lock);
 
                                LDLM_ERROR(lock,
-                                          "lock callback timer expired after "
-                                          "%llds: evicting client at %s ",
-                                          cfs_time_current_sec() -
+                                          "lock callback timer expired after %llds: evicting client at %s ",
+                                          ktime_get_real_seconds() -
                                           lock->l_last_activity,
                                           obd_export_nid2str(export));
                                ldlm_lock_to_ns(lock)->ns_timeouts++;
index dd1856b..7e49fba 100644 (file)
@@ -575,7 +575,7 @@ static struct ldlm_pool_ops ldlm_cli_pool_ops = {
  * Pool recalc wrapper. Will call either client or server pool recalc callback
  * depending what pool \a pl is used.
  */
-int ldlm_pool_recalc(struct ldlm_pool *pl)
+time64_t ldlm_pool_recalc(struct ldlm_pool *pl)
 {
        time64_t recalc_interval_sec;
        int count;
@@ -1244,15 +1244,15 @@ static int ldlm_pools_cli_shrink(SHRINKER_ARGS(sc, nr_to_scan, gfp_mask))
 
 #endif /* HAVE_SHRINKER_COUNT */
 
-int ldlm_pools_recalc(enum ldlm_side client)
+time64_t ldlm_pools_recalc(enum ldlm_side client)
 {
        unsigned long nr_l = 0, nr_p = 0, l;
        struct ldlm_namespace *ns;
        struct ldlm_namespace *ns_old = NULL;
        int nr, equal = 0;
        /* seconds of sleep if no active namespaces */
-       int time = client ? LDLM_POOL_CLI_DEF_RECALC_PERIOD :
-                           LDLM_POOL_SRV_DEF_RECALC_PERIOD;
+       time64_t time = client ? LDLM_POOL_CLI_DEF_RECALC_PERIOD :
+                                LDLM_POOL_SRV_DEF_RECALC_PERIOD;
 
        /*
         * No need to setup pool limit for client pools.
@@ -1388,7 +1388,7 @@ int ldlm_pools_recalc(enum ldlm_side client)
                 * After setup is done - recalc the pool.
                 */
                if (!skip) {
-                       int ttime = ldlm_pool_recalc(&ns->ns_pool);
+                       time64_t ttime = ldlm_pool_recalc(&ns->ns_pool);
 
                        if (ttime < time)
                                time = ttime;
@@ -1406,9 +1406,9 @@ int ldlm_pools_recalc(enum ldlm_side client)
 static int ldlm_pools_thread_main(void *arg)
 {
        struct ptlrpc_thread *thread = (struct ptlrpc_thread *)arg;
-       int s_time, c_time;
-       ENTRY;
+       time64_t s_time, c_time;
 
+       ENTRY;
        thread_set_flags(thread, SVC_RUNNING);
        wake_up(&thread->t_ctl_waitq);
 
@@ -1540,7 +1540,7 @@ int ldlm_pool_setup(struct ldlm_pool *pl, int limit)
         return 0;
 }
 
-int ldlm_pool_recalc(struct ldlm_pool *pl)
+time64_t ldlm_pool_recalc(struct ldlm_pool *pl)
 {
         return 0;
 }
@@ -1617,7 +1617,7 @@ void ldlm_pools_fini(void)
        return;
 }
 
-int ldlm_pools_recalc(enum ldlm_side client)
+time64_t ldlm_pools_recalc(enum ldlm_side client)
 {
        return 0;
 }
index f6bee8a..c2b9346 100644 (file)
@@ -100,7 +100,7 @@ struct lod_qos_oss {
        __u64                    lqo_penalty;   /* current penalty */
        __u64                    lqo_penalty_per_obj; /* penalty decrease
                                                         every obj*/
-       time_t                   lqo_used;      /* last used time, seconds */
+       time64_t                 lqo_used;      /* last used time, seconds */
        __u32                    lqo_ost_count; /* number of osts on this oss */
 };
 
@@ -110,7 +110,7 @@ struct ltd_qos {
        __u64                    ltq_penalty_per_obj; /* penalty decrease
                                                         every obj*/
        __u64                    ltq_weight;    /* net weighting */
-       time_t                   ltq_used;      /* last used time, seconds */
+       time64_t                 ltq_used;      /* last used time, seconds */
        bool                     ltq_usable:1;  /* usable for striping */
 };
 
index 98f8daf..e00b172 100644 (file)
@@ -320,7 +320,7 @@ static int lod_qos_calc_ppo(struct lod_device *lod)
        __u32               num_active;
        unsigned int        i;
        int                 rc, prio_wide;
-       time_t              now, age;
+       time64_t            now, age;
        ENTRY;
 
        if (!lod->lod_qos.lq_dirty)
@@ -344,9 +344,10 @@ static int lod_qos_calc_ppo(struct lod_device *lod)
 
        ba_min = (__u64)(-1);
        ba_max = 0;
-       now = cfs_time_current_sec();
+       now = ktime_get_real_seconds();
        /* Calculate OST penalty per object
-        * (lod ref taken in lod_qos_prep_create()) */
+        * (lod ref taken in lod_qos_prep_create())
+        */
        cfs_foreach_bit(lod->lod_ost_bitmap, i) {
                LASSERT(OST_TGT(lod,i));
                temp = TGT_BAVAIL(i);
@@ -482,7 +483,7 @@ static int lod_qos_used(struct lod_device *lod, struct ost_pool *osts,
        oss->lqo_penalty >>= 1;
 
        /* mark the OSS and OST as recently used */
-       ost->ltd_qos.ltq_used = oss->lqo_used = cfs_time_current_sec();
+       ost->ltd_qos.ltq_used = oss->lqo_used = ktime_get_real_seconds();
 
        /* Set max penalties for this OST and OSS */
        ost->ltd_qos.ltq_penalty +=
index 842def4..75fd29b 100644 (file)
@@ -38,7 +38,7 @@
 #endif
 #include <linux/utsname.h>
 
-#include <libcfs/linux/linux-misc.h>
+#include <libcfs/libcfs.h>
 #include <obd_support.h>
 #include <obd_class.h>
 #include <lustre_net.h>
index a501021..cf17a50 100644 (file)
@@ -143,10 +143,11 @@ int linkea_add_buf(struct linkea_data *ldata, const struct lu_name *lname,
        reclen = lname->ln_namelen + sizeof(struct link_ea_entry);
        if (unlikely(leh->leh_len + reclen > MAX_LINKEA_SIZE)) {
                /* Use 32-bits to save the overflow time, although it will
-                * shrink the cfs_time_current_sec() returned 64-bits value
+                * shrink the ktime_get_real_seconds() returned 64-bits value
                 * to 32-bits value, it is still quite large and can be used
-                * for about 140 years. That is enough. */
-               leh->leh_overflow_time = cfs_time_current_sec();
+                * for about 140 years. That is enough.
+                */
+               leh->leh_overflow_time = ktime_get_real_seconds();
                if (unlikely(leh->leh_overflow_time == 0))
                        leh->leh_overflow_time++;
 
@@ -235,7 +236,7 @@ int linkea_overflow_shrink(struct linkea_data *ldata)
        if (unlikely(leh->leh_reccount == 0))
                return 0;
 
-       leh->leh_overflow_time = cfs_time_current_sec();
+       leh->leh_overflow_time = ktime_get_real_seconds();
        if (unlikely(leh->leh_overflow_time == 0))
                leh->leh_overflow_time++;
        ldata->ld_reclen = 0;
index 6023346..5622410 100644 (file)
@@ -35,7 +35,6 @@
  */
 #define DEBUG_SUBSYSTEM S_SEC
 
-#include <libcfs/linux/linux-misc.h>
 #include <libcfs/libcfs.h>
 #include <uapi/linux/lnet/lnet-types.h>
 #include <upcall_cache.h>
index 2e7ac0e..3ecc4dc 100644 (file)
@@ -256,7 +256,7 @@ static time64_t ptlrpc_inflight_deadline(struct ptlrpc_request *req,
         return dl - now;
 }
 
-static unsigned int ptlrpc_inflight_timeout(struct obd_import *imp)
+static time64_t ptlrpc_inflight_timeout(struct obd_import *imp)
 {
        time64_t now = ktime_get_real_seconds();
        struct list_head *tmp, *n;
index 89154e0..ab7aea1 100644 (file)
@@ -482,7 +482,7 @@ static void ptlrpc_at_timer(unsigned long castmeharder)
        svcpt = (struct ptlrpc_service_part *)castmeharder;
 
        svcpt->scp_at_check = 1;
-       svcpt->scp_at_checktime = cfs_time_current();
+       svcpt->scp_at_checktime = ktime_get();
        wake_up(&svcpt->scp_waitq);
 }
 
@@ -1183,7 +1183,7 @@ static int ptlrpc_check_req(struct ptlrpc_request *req)
 static void ptlrpc_at_set_timer(struct ptlrpc_service_part *svcpt)
 {
        struct ptlrpc_at_array *array = &svcpt->scp_at_array;
-       __s32 next;
+       time64_t next;
 
        if (array->paa_count == 0) {
                del_timer(&svcpt->scp_at_timer);
@@ -1191,13 +1191,14 @@ static void ptlrpc_at_set_timer(struct ptlrpc_service_part *svcpt)
        }
 
        /* Set timer for closest deadline */
-       next = (__s32)(array->paa_deadline - ktime_get_real_seconds() -
-                      at_early_margin);
+       next = array->paa_deadline - ktime_get_real_seconds() -
+              at_early_margin;
        if (next <= 0) {
                ptlrpc_at_timer((unsigned long)svcpt);
        } else {
-               mod_timer(&svcpt->scp_at_timer, cfs_time_shift(next));
-               CDEBUG(D_INFO, "armed %s at %+ds\n",
+               mod_timer(&svcpt->scp_at_timer,
+                         jiffies + nsecs_to_jiffies(next * NSEC_PER_SEC));
+               CDEBUG(D_INFO, "armed %s at %+llds\n",
                       svcpt->scp_service->srv_name, next);
        }
 }
@@ -1449,16 +1450,16 @@ static int ptlrpc_at_check_timed(struct ptlrpc_service_part *svcpt)
         __u32  index, count;
        time64_t deadline;
        time64_t now = ktime_get_real_seconds();
-        cfs_duration_t delay;
-        int first, counter = 0;
-        ENTRY;
+       s64 delay;
+       int first, counter = 0;
 
+       ENTRY;
        spin_lock(&svcpt->scp_at_lock);
        if (svcpt->scp_at_check == 0) {
                spin_unlock(&svcpt->scp_at_lock);
                RETURN(0);
        }
-       delay = cfs_time_sub(cfs_time_current(), svcpt->scp_at_checktime);
+       delay = ktime_ms_delta(ktime_get(), svcpt->scp_at_checktime);
        svcpt->scp_at_check = 0;
 
        if (array->paa_count == 0) {
@@ -1522,7 +1523,7 @@ static int ptlrpc_at_check_timed(struct ptlrpc_service_part *svcpt)
                 LCONSOLE_WARN("%s: This server is not able to keep up with "
                              "request traffic (cpu-bound).\n",
                              svcpt->scp_service->srv_name);
-               CWARN("earlyQ=%d reqQ=%d recA=%d, svcEst=%d, delay=%ld(jiff)\n",
+               CWARN("earlyQ=%d reqQ=%d recA=%d, svcEst=%d, delay=%lld\n",
                      counter, svcpt->scp_nreqs_incoming,
                      svcpt->scp_nreqs_active,
                      at_get(&svcpt->scp_at_estimate), delay);