Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/dasd: remove 'struct timespec' usage

getnstimeofday() and timespec are deprecated since they can
overflow on 32-bit architectures. This simply changes to the
explicitly typed timespec64 version that doesn't have that
problem.

It would be nice to also convert to monotonic timestamps
and call ktime_get_ts64() rather than ktime_get_real_ts64(),
but that would be a user-visible change.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Arnd Bergmann and committed by
Martin Schwidefsky
bd7a9b37 b23481fb

+6 -6
+5 -5
drivers/s390/block/dasd.c
··· 759 759 /* in case of an overflow, reset the whole profile */ 760 760 if (data->dasd_io_reqs == UINT_MAX) { 761 761 memset(data, 0, sizeof(*data)); 762 - getnstimeofday(&data->starttod); 762 + ktime_get_real_ts64(&data->starttod); 763 763 } 764 764 data->dasd_io_reqs++; 765 765 data->dasd_io_sects += sectors; ··· 894 894 return; 895 895 } 896 896 memset(data, 0, sizeof(*data)); 897 - getnstimeofday(&data->starttod); 897 + ktime_get_real_ts64(&data->starttod); 898 898 spin_unlock_bh(&profile->lock); 899 899 } 900 900 ··· 911 911 kfree(data); 912 912 return 0; 913 913 } 914 - getnstimeofday(&data->starttod); 914 + ktime_get_real_ts64(&data->starttod); 915 915 profile->data = data; 916 916 spin_unlock_bh(&profile->lock); 917 917 return 0; ··· 995 995 static void dasd_stats_seq_print(struct seq_file *m, 996 996 struct dasd_profile_info *data) 997 997 { 998 - seq_printf(m, "start_time %ld.%09ld\n", 999 - data->starttod.tv_sec, data->starttod.tv_nsec); 998 + seq_printf(m, "start_time %lld.%09ld\n", 999 + (s64)data->starttod.tv_sec, data->starttod.tv_nsec); 1000 1000 seq_printf(m, "total_requests %u\n", data->dasd_io_reqs); 1001 1001 seq_printf(m, "total_sectors %u\n", data->dasd_io_sects); 1002 1002 seq_printf(m, "total_pav %u\n", data->dasd_io_alias);
+1 -1
drivers/s390/block/dasd_int.h
··· 441 441 unsigned int dasd_io_nr_req[32]; /* hist. of # of requests in chanq */ 442 442 443 443 /* new data */ 444 - struct timespec starttod; /* time of start or last reset */ 444 + struct timespec64 starttod; /* time of start or last reset */ 445 445 unsigned int dasd_io_alias; /* requests using an alias */ 446 446 unsigned int dasd_io_tpm; /* requests using transport mode */ 447 447 unsigned int dasd_read_reqs; /* total number of read requests */