Whamcloud - gitweb
LU-9091 obdclass: allow bare KMGTPE param suffix 20/37620/9
authorAndreas Dilger <adilger@whamcloud.com>
Fri, 10 May 2019 21:09:41 +0000 (15:09 -0600)
committerOleg Drokin <green@whamcloud.com>
Tue, 24 Mar 2020 05:17:54 +0000 (05:17 +0000)
commitd105cc4a6448b3c842790d0e1f0380b94d087f6f
tree8d72936d3c1941c2e6d5b2db0fdb42dafbef5ff9
parentfc87b01f96e8485a3713d0e446551e985e0e4aa0
LU-9091 obdclass: allow bare KMGTPE param suffix

Allow sysfs_memparse() to parse bare "KMGTPE" suffixes as base-2.
This simplifies the code to not append the unnecessary "iB" if
the suffix is one of KMGTPE already, since these are assumed to
be binary units already.

Don't append a bare defunit of "B", since this unnecessarily copies
the input string and takes the slow path for parsing the string, but
doesn't actually change the resulting value.

The test_string_to_size_one() may only have printed an error and not
caused module load to actually fail.  Print a message and return an
error if the tests fail.  Some checks expect to fail, so add
test_string_to_size_err() to verify that an error was returned.

Mark the obd_init_checks() function with __init so it is dropped
after the module is loaded.

Fixes: d9e0c9f346d0 ("LU-9091 sysfs: use string helper like functions for sysfs")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I3cdf5f8f0aeca458ed1989366102c33ae83ebbe5
Reviewed-on: https://review.whamcloud.com/37620
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdclass/class_obd.c
lustre/obdclass/lprocfs_status.c