diff options
author | Coly Li <colyli@suse.de> | 2019-02-09 07:53:03 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-02-09 17:18:32 +0300 |
commit | f5c0b95d2eeb17cf8a81fde0461938d2a79303ab (patch) | |
tree | cf2f81a6742a8f499dfac0e72f139597dda233a2 /scripts/coccinelle/null | |
parent | e4db37fb69d56d9523bb540bd8e07bf221aa9f6d (diff) | |
download | linux-f5c0b95d2eeb17cf8a81fde0461938d2a79303ab.tar.xz |
bcache: use sysfs_strtoul_bool() to set bit-field variables
When setting bcache parameters via sysfs, there are some variables are
defined as bit-field value. Current bcache code in sysfs.c uses either
d_strtoul() or sysfs_strtoul() to convert the input string to unsigned
integer value and set it to the corresponded bit-field value.
The problem is, the bit-field value only takes the lowest bit of the
converted value. If input is 2, the expected value (like bool value)
of the bit-field value should be 1, but indeed it is 0.
The following sysfs files for bit-field variables have such problem,
bypass_torture_test, for dc->bypass_torture_test
writeback_metadata, for dc->writeback_metadata
writeback_running, for dc->writeback_running
verify, for c->verify
key_merging_disabled, for c->key_merging_disabled
gc_always_rewrite, for c->gc_always_rewrite
btree_shrinker_disabled,for c->shrinker_disabled
copy_gc_enabled, for c->copy_gc_enabled
This patch uses sysfs_strtoul_bool() to set such bit-field variables,
then if the converted value is non-zero, the bit-field variables will
be set to 1, like setting a bool value like expensive_debug_checks.
Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'scripts/coccinelle/null')
0 files changed, 0 insertions, 0 deletions