bcache: use sysfs_match_string() instead of __sysfs_match_string()
The arrays (of strings) that are passed to __sysfs_match_string() are static, so use sysfs_match_string() which does an implicit ARRAY_SIZE() over these arrays. Functionally, this doesn't change anything. The change is more cosmetic. It only shrinks the static arrays by 1 byte each. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Coly Li <colyli@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
f960facb39
commit
89e0341af0
@ -21,28 +21,24 @@ static const char * const bch_cache_modes[] = {
|
|||||||
"writethrough",
|
"writethrough",
|
||||||
"writeback",
|
"writeback",
|
||||||
"writearound",
|
"writearound",
|
||||||
"none",
|
"none"
|
||||||
NULL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Default is 0 ("auto") */
|
/* Default is 0 ("auto") */
|
||||||
static const char * const bch_stop_on_failure_modes[] = {
|
static const char * const bch_stop_on_failure_modes[] = {
|
||||||
"auto",
|
"auto",
|
||||||
"always",
|
"always"
|
||||||
NULL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * const cache_replacement_policies[] = {
|
static const char * const cache_replacement_policies[] = {
|
||||||
"lru",
|
"lru",
|
||||||
"fifo",
|
"fifo",
|
||||||
"random",
|
"random"
|
||||||
NULL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * const error_actions[] = {
|
static const char * const error_actions[] = {
|
||||||
"unregister",
|
"unregister",
|
||||||
"panic",
|
"panic"
|
||||||
NULL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
write_attribute(attach);
|
write_attribute(attach);
|
||||||
@ -333,7 +329,7 @@ STORE(__cached_dev)
|
|||||||
bch_cached_dev_run(dc);
|
bch_cached_dev_run(dc);
|
||||||
|
|
||||||
if (attr == &sysfs_cache_mode) {
|
if (attr == &sysfs_cache_mode) {
|
||||||
v = __sysfs_match_string(bch_cache_modes, -1, buf);
|
v = sysfs_match_string(bch_cache_modes, buf);
|
||||||
if (v < 0)
|
if (v < 0)
|
||||||
return v;
|
return v;
|
||||||
|
|
||||||
@ -344,7 +340,7 @@ STORE(__cached_dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (attr == &sysfs_stop_when_cache_set_failed) {
|
if (attr == &sysfs_stop_when_cache_set_failed) {
|
||||||
v = __sysfs_match_string(bch_stop_on_failure_modes, -1, buf);
|
v = sysfs_match_string(bch_stop_on_failure_modes, buf);
|
||||||
if (v < 0)
|
if (v < 0)
|
||||||
return v;
|
return v;
|
||||||
|
|
||||||
@ -799,7 +795,7 @@ STORE(__bch_cache_set)
|
|||||||
0, UINT_MAX);
|
0, UINT_MAX);
|
||||||
|
|
||||||
if (attr == &sysfs_errors) {
|
if (attr == &sysfs_errors) {
|
||||||
v = __sysfs_match_string(error_actions, -1, buf);
|
v = sysfs_match_string(error_actions, buf);
|
||||||
if (v < 0)
|
if (v < 0)
|
||||||
return v;
|
return v;
|
||||||
|
|
||||||
@ -1063,7 +1059,7 @@ STORE(__bch_cache)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (attr == &sysfs_cache_replacement_policy) {
|
if (attr == &sysfs_cache_replacement_policy) {
|
||||||
v = __sysfs_match_string(cache_replacement_policies, -1, buf);
|
v = sysfs_match_string(cache_replacement_policies, buf);
|
||||||
if (v < 0)
|
if (v < 0)
|
||||||
return v;
|
return v;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user