Whamcloud - gitweb
LU-4423 obd: use ktime_t for calculating elapsed time
[fs/lustre-release.git] / lustre / obdclass / obd_config.c
index ad2f518..34c5711 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2015, Intel Corporation.
+ * Copyright (c) 2011, 2016, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -394,7 +394,7 @@ int class_attach(struct lustre_cfg *lcfg)
        /* XXX belongs in setup not attach  */
        init_rwsem(&obd->obd_observer_link_sem);
        /* recovery data */
-       cfs_init_timer(&obd->obd_recovery_timer);
+       init_timer(&obd->obd_recovery_timer);
        spin_lock_init(&obd->obd_recovery_task_lock);
        init_waitqueue_head(&obd->obd_next_transno_waitq);
        init_waitqueue_head(&obd->obd_evict_inprogress_waitq);
@@ -1096,8 +1096,8 @@ static int process_param2_config(struct lustre_cfg *lcfg)
                [2] = param,
                [3] = NULL
        };
-       struct timeval  start;
-       struct timeval  end;
+       ktime_t start;
+       ktime_t end;
        int             rc;
        ENTRY;
 
@@ -1107,18 +1107,18 @@ static int process_param2_config(struct lustre_cfg *lcfg)
                RETURN(-EINVAL);
        }
 
-       do_gettimeofday(&start);
+       start = ktime_get();
        rc = call_usermodehelper(argv[0], argv, NULL, UMH_WAIT_PROC);
-       do_gettimeofday(&end);
+       end = ktime_get();
 
        if (rc < 0) {
                CERROR("lctl: error invoking upcall %s %s %s: rc = %d; "
                       "time %ldus\n", argv[0], argv[1], argv[2], rc,
-                      cfs_timeval_sub(&end, &start, NULL));
+                      (long)ktime_us_delta(end, start));
        } else {
                CDEBUG(D_HA, "lctl: invoked upcall %s %s %s, time %ldus\n",
                       argv[0], argv[1], argv[2],
-                      cfs_timeval_sub(&end, &start, NULL));
+                      (long)ktime_us_delta(end, start));
                       rc = 0;
        }
 
@@ -1717,10 +1717,12 @@ EXPORT_SYMBOL(class_config_llog_handler);
 int class_config_parse_llog(const struct lu_env *env, struct llog_ctxt *ctxt,
                            char *name, struct config_llog_instance *cfg)
 {
-       struct llog_process_cat_data     cd = {0, 0};
-       struct llog_handle              *llh;
-       llog_cb_t                        callback;
-       int                              rc;
+       struct llog_process_cat_data cd = {
+               .lpcd_first_idx = 0,
+       };
+       struct llog_handle *llh;
+       llog_cb_t callback;
+       int rc;
        ENTRY;
 
        CDEBUG(D_INFO, "looking up llog %s\n", name);