staging/lustre: use ktime_t for calculating elapsed time
authorArnd Bergmann <arnd@arndb.de>
Sun, 27 Sep 2015 20:45:07 +0000 (16:45 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Sep 2015 02:03:34 +0000 (04:03 +0200)
process_param2_config() tries to print how much time has passed
across a call_usermodehelper() function, and uses struct timeval
for that.

We want to remove this structure, so this is better expressed
in terms of ktime_t and ktime_us_delta().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/obdclass/obd_config.c

index b86a47c540296f2a878999f6d828e8277caa8680..3bbc80623b3a009e50df508087340f6ea92965f5 100644 (file)
@@ -1021,8 +1021,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;
 
 
@@ -1032,19 +1032,19 @@ static int process_param2_config(struct lustre_cfg *lcfg)
                return -EINVAL;
        }
 
-       do_gettimeofday(&start);
+       start = ktime_get();
        rc = call_usermodehelper(argv[0], argv, NULL, 1);
-       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;
        }