linux-stable/drivers/block
Tina Ruchandani 85cf955df8 aoe: use ktime_t instead of timeval
'struct frame' uses two variables to store the sent timestamp - 'struct
timeval' and jiffies. jiffies is used to avoid discrepancies caused by
updates to system time. 'struct timeval' is deprecated because it uses
32-bit representation for seconds which will overflow in year 2038.

This patch does the following:
- Replace the use of 'struct timeval' and jiffies with ktime_t, which
  is the recommended type for timestamping
- ktime_t provides both long range (like jiffies) and high resolution
  (like timeval). Using ktime_get (monotonic time) instead of wall-clock
  time prevents any discprepancies caused by updates to system time.

[updates by Arnd below]
The original patch from Tina never went anywhere as we discussed how
to keep the impact on performance minimal. I've started over now but
arrived at basically the same patch that she had originally, except for
an slightly improved tsince_hr() function. I'm making it more robust
against overflows, and also optimize explicitly for the common case
in which a frame is less than 4.2 seconds old, using only a 32-bit
division in that case.

This should make the new version more efficient than the old code,
since we replace the existing two 32-bit division in do_gettimeofday()
plus one multiplication with a single single 32-bit division in
tsince_hr() and drop the double bookkeeping. It's also more efficient
than the ktime_get_us() API we discussed before, since that would
also rely on multiple divisions.

Link: https://lists.linaro.org/pipermail/y2038/2015-May/000276.html
Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Cc: Ed Cashin <ed.cashin@acm.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2018-01-17 08:41:07 -07:00
..
aoe aoe: use ktime_t instead of timeval 2018-01-17 08:41:07 -07:00
drbd block: convert to bio_first_bvec_all & bio_first_page_all 2018-01-06 09:18:00 -07:00
mtip32xx Merge branch 'for-4.15/block' of git://git.kernel.dk/linux-block 2017-11-14 15:32:19 -08:00
paride Merge branch 'for-4.15/block' of git://git.kernel.dk/linux-block 2017-11-14 15:32:19 -08:00
rsxx treewide: setup_timer() -> timer_setup() (2 field) 2017-11-21 15:57:09 -08:00
xen-blkback Merge branch 'for-4.14/block' of git://git.kernel.dk/linux-block 2017-09-07 11:59:42 -07:00
zram block: convert to bio_first_bvec_all & bio_first_page_all 2018-01-06 09:18:00 -07:00
amiflop.c amifloppy: Convert timers to use timer_setup() 2017-11-14 20:11:57 -07:00
ataflop.c treewide: Switch DEFINE_TIMER callbacks to struct timer_list * 2017-11-21 15:57:05 -08:00
brd.c libnvdimm for 4.15 2017-11-17 09:51:57 -08:00
cryptoloop.c block: cryptoloop - Fix build warning 2017-09-26 07:41:22 -06:00
DAC960.c DAC960: split up ioctl function to reduce stack size 2018-01-06 09:18:00 -07:00
DAC960.h treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
floppy.c block/floppy: Convert callback to pass timer_list 2017-11-14 20:10:35 -07:00
Kconfig null_blk: remove explicit 'select FAULT_INJECTION' 2018-01-11 07:58:31 -07:00
loop.c block: fix a build error 2017-09-26 12:07:24 -06:00
loop.h block/loop: make loop cgroup aware 2017-09-26 07:41:22 -06:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nbd.c Merge branch 'for-4.15/block' of git://git.kernel.dk/linux-block 2017-11-14 15:32:19 -08:00
null_blk.c null_blk: remove explicit 'select FAULT_INJECTION' 2018-01-11 07:58:31 -07:00
pktcdvd.c pktcdvd: Fix a recently introduced NULL pointer dereference 2018-01-05 09:03:04 -07:00
ps3disk.c block: introduce new block status code type 2017-06-09 09:27:32 -06:00
ps3vram.c block/ps3vram: Check return of ps3vram_cache_init 2017-08-17 23:03:44 +10:00
rbd.c rbd: default to single-major device number scheme 2017-11-13 16:33:08 +01:00
rbd_types.h rbd: RBD_V{1,2}_DATA_FORMAT macros 2017-02-20 12:16:15 +01:00
skd_main.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
skd_s1120.h skd: Use __packed only when needed 2017-08-18 08:45:29 -06:00
smart1,2.h
sunvdc.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
swim.c block: don't set bounce limit in blk_init_queue 2017-06-27 12:13:45 -06:00
swim3.c treewide: Remove TIMER_FUNC_TYPE and TIMER_DATA_TYPE casts 2017-11-21 16:35:54 -08:00
swim_asm.S
sx8.c block: introduce new block status code type 2017-06-09 09:27:32 -06:00
umem.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
umem.h
virtio_blk.c virtio_blk: Fix an SG_IO regression 2017-10-27 08:23:21 -06:00
xen-blkfront.c Merge branch 'for-4.14/block' of git://git.kernel.dk/linux-block 2017-09-07 11:59:42 -07:00
xsysace.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
z2ram.c block: introduce new block status code type 2017-06-09 09:27:32 -06:00