From d1b47781a3acd449473884f42e71ece2a7789670 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Tue, 17 Jan 2017 14:36:44 -0500 Subject: [PATCH 1/1] LU-9019 mdt: use ktime_t for calculating elapsed time 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 Reviewed-on: https://review.whamcloud.com/24923 Tested-by: Jenkins Reviewed-by: Dmitry Eremin Reviewed-by: Fan Yong Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/mdt/mdt_identity.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/lustre/mdt/mdt_identity.c b/lustre/mdt/mdt_identity.c index 85d782b..e8ec709 100644 --- a/lustre/mdt/mdt_identity.c +++ b/lustre/mdt/mdt_identity.c @@ -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; -- 1.8.3.1