Fix 32-bit/LLP64 platform truncation issues
authorSitsofe Wheeler <sitsofe@yahoo.com>
Tue, 19 May 2020 21:41:49 +0000 (22:41 +0100)
committerSitsofe Wheeler <sitsofe@yahoo.com>
Tue, 19 May 2020 22:09:42 +0000 (23:09 +0100)
commiteda99d5530738bebdd355fa1df97d5d33d3b9f79
tree0cc97354c107fbb33a459f7f9b724589ed68cda5
parente1ce5b385c65803b170e512a1b5256bbe99f98f0
Fix 32-bit/LLP64 platform truncation issues

- After 140a6888 ("rate: Convert the rate and rate_min options to
  FIO_OPTS_ULL") landed 32-bit/LLP64 platforms need additional changes
  to cope with 64 bit I/O rate values
- The seed is 64 bit but was being being truncated to 32 bits in
  td_fill_rand_seeds_internal() on bit/LLP64 platforms

Prior to this commit when running an fio compiled with

CC=clang-9 ./configure \
  --extra-cflags="-fsanitize=undefined,implicit-integer-truncation "
  "-fno-builtin"

using this job

./fio --ioengine=null --bs=1M --rate=6G --rate_min=5G --name=test --size=100G

warnings like the following were produced

init.c:996:27: runtime error: implicit conversion from type 'uint64_t' (aka 'unsigned long long') of value 5942511153023025289 (64-bit, unsigned) to type 'unsigned int' changed the value to 2914779273 (32-bit, unsigned)
[..]
backend.c:212:25: runtime error: implicit conversion from type 'unsigned long long' of value 12886999040 (64-bit, unsigned) to type 'unsigned long' changed the value to 2097152 (32-bit, unsigned)

inside a 32-bit Ubuntu 18.04 docker container.

Fixes: https://github.com/axboe/fio/issues/716
fio.h
init.c
lib/rand.c
lib/rand.h