Skip to content

Conversation

@hexiaole1994
Copy link

@hexiaole1994 hexiaole1994 commented Nov 5, 2025

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 #1618
Related PR #1827

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.

Signed-off-by: Xiaole He <[email protected]>
@sitsofe
Copy link
Collaborator

sitsofe commented Nov 5, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ki/Mi/Gi/etc parsed incorrectly when kb_base=1000

2 participants