Whamcloud - gitweb
LU-9019 mdt: use ktime_t for calculating elapsed time 23/24923/2
authorJames Simmons <uja.ornl@yahoo.com>
Tue, 17 Jan 2017 19:36:44 +0000 (14:36 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 31 Jan 2017 04:07:23 +0000 (04:07 +0000)
mdt_identity_do_upcall() 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().

Change-Id: I2d167a50c537c525600622977b8cb422f0a88ba4
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/24923
Tested-by: Jenkins
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdt/mdt_identity.c

index 85d782b..e8ec709 100644 (file)
@@ -102,7 +102,7 @@ static int mdt_identity_do_upcall(struct upcall_cache *cache,
                   [1] = "PATH=/sbin:/usr/sbin",
                   [2] = NULL
         };
-        struct timeval start, end;
+       ktime_t start, end;
         int rc;
         ENTRY;
 
@@ -120,22 +120,20 @@ static int mdt_identity_do_upcall(struct upcall_cache *cache,
        argv[0] = cache->uc_upcall;
        snprintf(keystr, sizeof(keystr), "%llu", entry->ue_key);
 
-       do_gettimeofday(&start);
+       start = ktime_get();
        rc = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC);
-       do_gettimeofday(&end);
+       end = ktime_get();
        if (rc < 0) {
-                CERROR("%s: error invoking upcall %s %s %s: rc %d; "
-                       "check /proc/fs/lustre/mdt/%s/identity_upcall, "
-                       "time %ldus\n",
-                       cache->uc_name, argv[0], argv[1], argv[2], rc,
-                       cache->uc_name, cfs_timeval_sub(&end, &start, NULL));
-        } else {
-                CDEBUG(D_HA, "%s: invoked upcall %s %s %s, time %ldus\n",
-                       cache->uc_name, argv[0], argv[1], argv[2],
-                       cfs_timeval_sub(&end, &start, NULL));
-                rc = 0;
-        }
-        EXIT;
+               CERROR("%s: error invoking upcall %s %s %s: rc %d; check /proc/fs/lustre/mdt/%s/identity_upcall, time %ldus\n",
+                      cache->uc_name, argv[0], argv[1], argv[2], rc,
+                      cache->uc_name, (long)ktime_us_delta(end, start));
+       } else {
+               CDEBUG(D_HA, "%s: invoked upcall %s %s %s, time %ldus\n",
+                      cache->uc_name, argv[0], argv[1], argv[2],
+                      (long)ktime_us_delta(end, start));
+               rc = 0;
+       }
+       EXIT;
 out:
        up_read(&cache->uc_upcall_rwsem);
        return rc;