diff options
Diffstat (limited to 'fs/bcachefs/sysfs.c')
-rw-r--r-- | fs/bcachefs/sysfs.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c index 597e1f02bd6a..9a617dba21ef 100644 --- a/fs/bcachefs/sysfs.c +++ b/fs/bcachefs/sysfs.c @@ -25,6 +25,7 @@ #include "opts.h" #include "super-io.h" #include "tier.h" +#include "tests.h" #include <linux/blkdev.h> #include <linux/sort.h> @@ -181,6 +182,8 @@ rw_attribute(pd_controllers_update_seconds); read_attribute(meta_replicas_have); read_attribute(data_replicas_have); +write_attribute(perf_test); + #define BCH_DEBUG_PARAM(name, description) \ rw_attribute(name); @@ -432,6 +435,24 @@ STORE(__bch2_fs) c->btree_cache.shrink.scan_objects(&c->btree_cache.shrink, &sc); } + if (attr == &sysfs_perf_test) { + char *tmp = kstrdup(buf, GFP_KERNEL), *p = tmp; + char *test = strsep(&p, " \t\n"); + char *nr_str = strsep(&p, " \t\n"); + char *threads_str = strsep(&p, " \t\n"); + unsigned threads; + u64 nr; + int ret = -EINVAL; + + if (threads_str && + !(ret = kstrtouint(threads_str, 10, &threads)) && + !(ret = bch2_strtoull_h(nr_str, &nr))) + btree_perf_test(c, test, nr, threads); + else + size = ret; + kfree(tmp); + } + return size; } @@ -462,6 +483,8 @@ struct attribute *bch2_fs_files[] = { &sysfs_tiering_percent, &sysfs_compression_stats, + + &sysfs_perf_test, NULL }; |