axboe / fio

Flexible I/O Tester
GNU General Public License v2.0
5.21k stars 1.26k forks source link

filesize parses GiB/MiB values incorrectly #1740

Open Rogach opened 6 months ago

Rogach commented 6 months ago

Please acknowledge the following before creating a ticket

Description of the bug: Passing in --filesize value with GiB suffix seems to result in incorrect file size being used:

$ fio --name=seq --filename=fio.bin --filesize=4GiB --rw=write
seq: (g=0): rw=write, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1
fio-3.36
Starting 1 process
seq: Laying out IO file (1 file / 3814MiB)

If using Gi suffix then file size is correct:

$ fio --name=seq --filename=fio.bin --filesize=4Gi --rw=write
seq: (g=0): rw=write, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1
fio-3.36
Starting 1 process
seq: Laying out IO file (1 file / 4096MiB)

Environment: Arch Linux

fio version: fio-3.36

vincentkfu commented 5 months ago

We are stuck between a rock and a hard place here. We could make the default conform to how the rest of the world interprets these units. However, this change would break scripts that have accommodated this fio quirk.

If you want fio to follow your expected interpretation use kb_base=1000 option. Make sure this option is set before any options with suffixes. See:

https://fio.readthedocs.io/en/latest/fio_doc.html#units

Rogach commented 5 months ago

I understand the value of backward compatibility, of course :) And the whole KB/KiB situation is just a big mess.

I've read the "Units" section prior to submitting the report. It was my understanding that the main issue was with KB units, since people commonly use them to mean both 1000 and 1024. However, I thought that KiB was unambiguous and always meant 1024. Are there scripts that were explicitly written with KiB=1000 in mind?