diff options
author | Arnd Bergmann <arnd@arndb.de> | 2015-09-27 20:45:14 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-09-29 02:03:36 (GMT) |
commit | 1f4fc343c008981d3a91351c030e2c29f5cd1b1c (patch) | |
tree | cfb7ddc7009c251b688f0a31a20c1eb3d2cb6c21 /drivers/staging/lustre/lnet | |
parent | 473c4e01029f6692be7ddc0e7f9b75dc933c7057 (diff) | |
download | linux-1f4fc343c008981d3a91351c030e2c29f5cd1b1c.tar.xz |
staging/lustre: use 64-bit times for cfs_srand seed
Several functions in Lustre call cfs_srand with do_gettimeofday
as the seed to get a pseudo-random number.
There is no bug here, but changing it to use ktime_get_ts64()
gets us closer to deprecating do_gettimeofday() and makes it slightly
more random.
Affected functions are:
lnet_shuffle_seed, init_lustre_lite and class_handle_init
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>
Diffstat (limited to 'drivers/staging/lustre/lnet')
-rw-r--r-- | drivers/staging/lustre/lnet/lnet/router.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 75ff382..2cdda3f 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -237,7 +237,7 @@ static void lnet_shuffle_seed(void) { static int seeded; int lnd_type, seed[2]; - struct timeval tv; + struct timespec64 ts; lnet_ni_t *ni; struct list_head *tmp; @@ -256,8 +256,8 @@ static void lnet_shuffle_seed(void) seed[0] ^= (LNET_NIDADDR(ni->ni_nid) | lnd_type); } - do_gettimeofday(&tv); - cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]); + ktime_get_ts64(&ts); + cfs_srand(ts.tv_sec ^ seed[0], ts.tv_nsec ^ seed[1]); seeded = 1; } |