-
Improvement
-
Resolution: Unresolved
-
Medium
-
None
-
None
-
None
-
3
-
9223372036854775807
1) Support decimal (SI) size suffixes.
Every KMGTPE suffix is a power of two today, so "1G", "1GiB" and "1GB" all mean 1073741824. There is no way to enter a size in the decimal units that capacity documents are written in, and a value copied from
one is over-provisioned by 7.4% at GB and 10% at TB. A trailing "B" should select decimal units:
1G, 1GiB -> 2^30 (unchanged)
1GB -> 10^9
This is the meaning the kernel side already has: sysfs_memparse() -> string_to_blksize() in lustre/obdclass/lprocfs_status.c reads "MB" as 10^6, so "lctl set_param llite.*.pcc_async_threshold=5MB" is 5000000
while "lfs setquota -B 5MB" is 5242880 today.
The suffix text alone decides, so no new flag or API is needed and every caller of llapi_parse_size() behaves the same way: lfs setstripe (and migrate, mirror create/extend/split/delete, which share its option parser), lfs find, lfs getstripe, lfs ladvise, lfs mirror resync, lfs setquota, llsom_sync and lhsmtool_posix - 19 call sites, 43 command/option combinations in total.
2) Reject anything that is not a standard spelling.
Only the first character after the suffix is checked, so "1GBjunk" and "1Gi" are silently accepted as 1 GiB. Accept exactly "1G", "1GB" and "1GiB", in either case, and reject the rest. The same pass also refuses a value that would overflow 64 bits once scaled by its unit, which the current per-suffix bit-mask checks cannot express for a
10^3-based unit.