fio icon indicating copy to clipboard operation
fio copied to clipboard

Fix incorrect unit prefix examples in manpage

Open hexiaole1994 opened this issue 2 months ago • 1 comments

The examples in the manpage for kb_base=1000 and kb_base=1024 had multiple errors in unit prefixes and values:

For kb_base=1000 (IEC/SI standard mode):

  • Fix 4 KiB example: use IEC prefix 'ki' instead of 'k' (4k -> 4ki to correctly represent 4096 bytes)
  • Fix 1 MiB example: use IEC prefix 'mi' instead of 'm' (1m -> 1mi to correctly represent 1048576 bytes)
  • Fix 1 MB example: use SI prefix 'm' instead of 'mi' (1mi -> 1m to correctly represent 1000000 bytes)
  • Fix 1 TiB example: use IEC prefix 'ti' instead of 't' (1t -> 1ti to correctly represent 1099511627776 bytes)
  • Fix 1 TiB value: 1073741824 -> 1099511627776
  • Fix 1 TB example: use SI prefix 't' instead of 'ti' (1ti -> 1t to correctly represent 1000000000000 bytes)
  • Fix 1 TB value: 1000000000 -> 1000000000000
  • Fix 1 TB prefixes: 1000mi -> 1000g, 1000000ki -> 1000000m

For kb_base=1024 (compatibility mode):

  • Fix 1 TiB value: 1073741824 -> 1099511627776
  • Fix 1 TiB prefixes: 1024m -> 1024g, 1048576k -> 1048576m (to correctly represent 1099511627776 bytes)
  • Fix 1 TB value: 1000000000 -> 1000000000000
  • Fix 1 TB prefixes: 1000mi -> 1000gi, 1000000ki -> 1000000mi (to correctly represent 1000000000000 bytes)

All examples now correctly match the actual behavior implemented in parse.c.

Fixes https://github.com/axboe/fio/issues/1618 Related PR https://github.com/axboe/fio/pull/1827

hexiaole1994 avatar Nov 05 '25 09:11 hexiaole1994

I myself use bs=4k to mean bs=4096 in fio's default mode as it's convenient even though it could be seen as ambiguous so I'm not sure that should change. Fio also has unexpected behaviour with its units:

% rm -f /tmp/fio.tmp; ./fio --minimal --filename /tmp/fio.tmp --kb_base=1024 --bs=4ki --size=4ki --name=go > /dev/null; stat -f'%z' /tmp/fio.tmp
4096
% rm -f /tmp/fio.tmp; ./fio --minimal --filename /tmp/fio.tmp --kb_base=1000 --bs=4ki --size=4ki --name=go > /dev/null; stat -f'%z' /tmp/fio.tmp
4000

So care needs to be taken if we are going to update that section. Due to the previous point I don't know if the HOWTO would need updating too.

sitsofe avatar Nov 05 '25 20:11 sitsofe