1 // SPDX-License-Identifier: GPL-2.0
3 * bcache sysfs interfaces
5 * Copyright 2010, 2011 Kent Overstreet <kent.overstreet@gmail.com>
6 * Copyright 2012 Google, Inc.
9 #ifndef NO_BCACHEFS_SYSFS
12 #include "alloc_background.h"
13 #include "alloc_foreground.h"
15 #include "btree_cache.h"
17 #include "btree_iter.h"
18 #include "btree_key_cache.h"
19 #include "btree_update.h"
20 #include "btree_update_interior.h"
24 #include "disk_groups.h"
31 #include "rebalance.h"
36 #include <linux/blkdev.h>
37 #include <linux/sort.h>
38 #include <linux/sched/clock.h>
42 #define SYSFS_OPS(type) \
43 struct sysfs_ops type ## _sysfs_ops = { \
44 .show = type ## _show, \
45 .store = type ## _store \
49 static ssize_t fn ## _show(struct kobject *kobj, struct attribute *attr,\
53 static ssize_t fn ## _store(struct kobject *kobj, struct attribute *attr,\
54 const char *buf, size_t size) \
56 #define __sysfs_attribute(_name, _mode) \
57 static struct attribute sysfs_##_name = \
58 { .name = #_name, .mode = _mode }
60 #define write_attribute(n) __sysfs_attribute(n, S_IWUSR)
61 #define read_attribute(n) __sysfs_attribute(n, S_IRUGO)
62 #define rw_attribute(n) __sysfs_attribute(n, S_IRUGO|S_IWUSR)
64 #define sysfs_printf(file, fmt, ...) \
66 if (attr == &sysfs_ ## file) \
67 return scnprintf(buf, PAGE_SIZE, fmt "\n", __VA_ARGS__);\
70 #define sysfs_print(file, var) \
72 if (attr == &sysfs_ ## file) \
73 return snprint(buf, PAGE_SIZE, var); \
76 #define sysfs_hprint(file, val) \
78 if (attr == &sysfs_ ## file) { \
79 bch2_hprint(&out, val); \
81 return out.pos - buf; \
85 #define var_printf(_var, fmt) sysfs_printf(_var, fmt, var(_var))
86 #define var_print(_var) sysfs_print(_var, var(_var))
87 #define var_hprint(_var) sysfs_hprint(_var, var(_var))
89 #define sysfs_strtoul(file, var) \
91 if (attr == &sysfs_ ## file) \
92 return strtoul_safe(buf, var) ?: (ssize_t) size; \
95 #define sysfs_strtoul_clamp(file, var, min, max) \
97 if (attr == &sysfs_ ## file) \
98 return strtoul_safe_clamp(buf, var, min, max) \
102 #define strtoul_or_return(cp) \
105 int _r = kstrtoul(cp, 10, &_v); \
111 #define strtoul_restrict_or_return(cp, min, max) \
113 unsigned long __v = 0; \
114 int _r = strtoul_safe_restrict(cp, __v, min, max); \
120 #define strtoi_h_or_return(cp) \
123 int _r = strtoi_h(cp, &_v); \
129 #define sysfs_hatoi(file, var) \
131 if (attr == &sysfs_ ## file) \
132 return strtoi_h(buf, &var) ?: (ssize_t) size; \
135 write_attribute(trigger_gc);
136 write_attribute(prune_cache);
137 rw_attribute(btree_gc_periodic);
138 rw_attribute(gc_gens_pos);
140 read_attribute(uuid);
141 read_attribute(minor);
142 read_attribute(bucket_size);
143 read_attribute(first_bucket);
144 read_attribute(nbuckets);
145 read_attribute(durability);
146 read_attribute(iodone);
148 read_attribute(io_latency_read);
149 read_attribute(io_latency_write);
150 read_attribute(io_latency_stats_read);
151 read_attribute(io_latency_stats_write);
152 read_attribute(congested);
154 read_attribute(btree_avg_write_size);
156 read_attribute(reserve_stats);
157 read_attribute(btree_cache_size);
158 read_attribute(compression_stats);
159 read_attribute(journal_debug);
160 read_attribute(journal_pins);
161 read_attribute(btree_updates);
162 read_attribute(dirty_btree_nodes);
163 read_attribute(btree_cache);
164 read_attribute(btree_key_cache);
165 read_attribute(btree_transactions);
166 read_attribute(stripes_heap);
167 read_attribute(open_buckets);
169 read_attribute(internal_uuid);
171 read_attribute(has_data);
172 read_attribute(alloc_debug);
173 write_attribute(wake_allocator);
175 read_attribute(read_realloc_races);
176 read_attribute(extent_migrate_done);
177 read_attribute(extent_migrate_raced);
179 rw_attribute(discard);
182 rw_attribute(copy_gc_enabled);
183 read_attribute(copy_gc_wait);
185 rw_attribute(rebalance_enabled);
186 sysfs_pd_controller_attribute(rebalance);
187 read_attribute(rebalance_work);
188 rw_attribute(promote_whole_extents);
190 read_attribute(new_stripes);
192 read_attribute(io_timers_read);
193 read_attribute(io_timers_write);
195 read_attribute(data_op_data_progress);
197 #ifdef CONFIG_BCACHEFS_TESTS
198 write_attribute(perf_test);
199 #endif /* CONFIG_BCACHEFS_TESTS */
202 static struct attribute sysfs_time_stat_##_name = \
203 { .name = #_name, .mode = S_IRUGO };
207 static struct attribute sysfs_state_rw = {
212 static size_t bch2_btree_cache_size(struct bch_fs *c)
217 mutex_lock(&c->btree_cache.lock);
218 list_for_each_entry(b, &c->btree_cache.live, list)
219 ret += btree_bytes(c);
221 mutex_unlock(&c->btree_cache.lock);
225 static size_t bch2_btree_avg_write_size(struct bch_fs *c)
227 u64 nr = atomic64_read(&c->btree_writes_nr);
228 u64 sectors = atomic64_read(&c->btree_writes_sectors);
230 return nr ? div64_u64(sectors, nr) : 0;
233 static long stats_to_text(struct printbuf *out, struct bch_fs *c,
234 struct bch_move_stats *stats)
236 pr_buf(out, "%s: data type %s btree_id %s position: ",
238 bch2_data_types[stats->data_type],
239 bch2_btree_ids[stats->btree_id]);
240 bch2_bpos_to_text(out, stats->pos);
241 pr_buf(out, "%s", "\n");
246 static long data_progress_to_text(struct printbuf *out, struct bch_fs *c)
249 struct bch_move_stats *iter;
251 mutex_lock(&c->data_progress_lock);
253 if (list_empty(&c->data_progress_list))
254 pr_buf(out, "%s", "no progress to report\n");
256 list_for_each_entry(iter, &c->data_progress_list, list) {
257 stats_to_text(out, c, iter);
260 mutex_unlock(&c->data_progress_lock);
264 static int bch2_compression_stats_to_text(struct printbuf *out, struct bch_fs *c)
266 struct btree_trans trans;
267 struct btree_iter iter;
270 u64 nr_uncompressed_extents = 0,
271 nr_compressed_extents = 0,
272 nr_incompressible_extents = 0,
273 uncompressed_sectors = 0,
274 incompressible_sectors = 0,
275 compressed_sectors_compressed = 0,
276 compressed_sectors_uncompressed = 0;
279 if (!test_bit(BCH_FS_STARTED, &c->flags))
282 bch2_trans_init(&trans, c, 0, 0);
284 for (id = 0; id < BTREE_ID_NR; id++) {
285 if (!((1U << id) & BTREE_ID_HAS_PTRS))
288 for_each_btree_key(&trans, iter, id, POS_MIN,
289 BTREE_ITER_ALL_SNAPSHOTS, k, ret) {
290 struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k);
291 const union bch_extent_entry *entry;
292 struct extent_ptr_decoded p;
293 bool compressed = false, uncompressed = false, incompressible = false;
295 bkey_for_each_ptr_decode(k.k, ptrs, p, entry) {
296 switch (p.crc.compression_type) {
297 case BCH_COMPRESSION_TYPE_none:
299 uncompressed_sectors += k.k->size;
301 case BCH_COMPRESSION_TYPE_incompressible:
302 incompressible = true;
303 incompressible_sectors += k.k->size;
306 compressed_sectors_compressed +=
307 p.crc.compressed_size;
308 compressed_sectors_uncompressed +=
309 p.crc.uncompressed_size;
316 nr_incompressible_extents++;
317 else if (uncompressed)
318 nr_uncompressed_extents++;
320 nr_compressed_extents++;
322 bch2_trans_iter_exit(&trans, &iter);
325 bch2_trans_exit(&trans);
330 pr_buf(out, "uncompressed:\n");
331 pr_buf(out, " nr extents: %llu\n", nr_uncompressed_extents);
332 pr_buf(out, " size: ");
333 bch2_hprint(out, uncompressed_sectors << 9);
336 pr_buf(out, "compressed:\n");
337 pr_buf(out, " nr extents: %llu\n", nr_compressed_extents);
338 pr_buf(out, " compressed size: ");
339 bch2_hprint(out, compressed_sectors_compressed << 9);
341 pr_buf(out, " uncompressed size: ");
342 bch2_hprint(out, compressed_sectors_uncompressed << 9);
345 pr_buf(out, "incompressible:\n");
346 pr_buf(out, " nr extents: %llu\n", nr_incompressible_extents);
347 pr_buf(out, " size: ");
348 bch2_hprint(out, incompressible_sectors << 9);
353 static void bch2_gc_gens_pos_to_text(struct printbuf *out, struct bch_fs *c)
355 pr_buf(out, "%s: ", bch2_btree_ids[c->gc_gens_btree]);
356 bch2_bpos_to_text(out, c->gc_gens_pos);
362 struct bch_fs *c = container_of(kobj, struct bch_fs, kobj);
363 struct printbuf out = _PBUF(buf, PAGE_SIZE);
365 sysfs_print(minor, c->minor);
366 sysfs_printf(internal_uuid, "%pU", c->sb.uuid.b);
368 sysfs_hprint(btree_cache_size, bch2_btree_cache_size(c));
369 sysfs_hprint(btree_avg_write_size, bch2_btree_avg_write_size(c));
371 sysfs_print(read_realloc_races,
372 atomic_long_read(&c->read_realloc_races));
373 sysfs_print(extent_migrate_done,
374 atomic_long_read(&c->extent_migrate_done));
375 sysfs_print(extent_migrate_raced,
376 atomic_long_read(&c->extent_migrate_raced));
378 sysfs_printf(btree_gc_periodic, "%u", (int) c->btree_gc_periodic);
380 if (attr == &sysfs_gc_gens_pos) {
381 bch2_gc_gens_pos_to_text(&out, c);
382 return out.pos - buf;
385 sysfs_printf(copy_gc_enabled, "%i", c->copy_gc_enabled);
387 sysfs_printf(rebalance_enabled, "%i", c->rebalance.enabled);
388 sysfs_pd_controller_show(rebalance, &c->rebalance.pd); /* XXX */
389 sysfs_hprint(copy_gc_wait,
390 max(0LL, c->copygc_wait -
391 atomic64_read(&c->io_clock[WRITE].now)) << 9);
393 if (attr == &sysfs_rebalance_work) {
394 bch2_rebalance_work_to_text(&out, c);
395 return out.pos - buf;
398 sysfs_print(promote_whole_extents, c->promote_whole_extents);
402 if (attr == &sysfs_journal_debug) {
403 bch2_journal_debug_to_text(&out, &c->journal);
404 return out.pos - buf;
407 if (attr == &sysfs_journal_pins) {
408 bch2_journal_pins_to_text(&out, &c->journal);
409 return out.pos - buf;
412 if (attr == &sysfs_btree_updates) {
413 bch2_btree_updates_to_text(&out, c);
414 return out.pos - buf;
417 if (attr == &sysfs_dirty_btree_nodes) {
418 bch2_dirty_btree_nodes_to_text(&out, c);
419 return out.pos - buf;
422 if (attr == &sysfs_btree_cache) {
423 bch2_btree_cache_to_text(&out, c);
424 return out.pos - buf;
427 if (attr == &sysfs_btree_key_cache) {
428 bch2_btree_key_cache_to_text(&out, &c->btree_key_cache);
429 return out.pos - buf;
432 if (attr == &sysfs_btree_transactions) {
433 bch2_btree_trans_to_text(&out, c);
434 return out.pos - buf;
437 if (attr == &sysfs_stripes_heap) {
438 bch2_stripes_heap_to_text(&out, c);
439 return out.pos - buf;
442 if (attr == &sysfs_open_buckets) {
443 bch2_open_buckets_to_text(&out, c);
444 return out.pos - buf;
447 if (attr == &sysfs_compression_stats) {
448 bch2_compression_stats_to_text(&out, c);
449 return out.pos - buf;
452 if (attr == &sysfs_new_stripes) {
453 bch2_new_stripes_to_text(&out, c);
454 return out.pos - buf;
457 if (attr == &sysfs_io_timers_read) {
458 bch2_io_timers_to_text(&out, &c->io_clock[READ]);
459 return out.pos - buf;
461 if (attr == &sysfs_io_timers_write) {
462 bch2_io_timers_to_text(&out, &c->io_clock[WRITE]);
463 return out.pos - buf;
466 if (attr == &sysfs_data_op_data_progress) {
467 data_progress_to_text(&out, c);
468 return out.pos - buf;
476 struct bch_fs *c = container_of(kobj, struct bch_fs, kobj);
478 if (attr == &sysfs_btree_gc_periodic) {
479 ssize_t ret = strtoul_safe(buf, c->btree_gc_periodic)
482 wake_up_process(c->gc_thread);
486 if (attr == &sysfs_copy_gc_enabled) {
487 ssize_t ret = strtoul_safe(buf, c->copy_gc_enabled)
490 if (c->copygc_thread)
491 wake_up_process(c->copygc_thread);
495 if (attr == &sysfs_rebalance_enabled) {
496 ssize_t ret = strtoul_safe(buf, c->rebalance.enabled)
503 sysfs_pd_controller_store(rebalance, &c->rebalance.pd);
505 sysfs_strtoul(promote_whole_extents, c->promote_whole_extents);
509 if (!test_bit(BCH_FS_STARTED, &c->flags))
514 if (attr == &sysfs_trigger_gc) {
516 * Full gc is currently incompatible with btree key cache:
519 down_read(&c->state_lock);
520 bch2_gc(c, false, false);
521 up_read(&c->state_lock);
527 if (attr == &sysfs_prune_cache) {
528 struct shrink_control sc;
530 sc.gfp_mask = GFP_KERNEL;
531 sc.nr_to_scan = strtoul_or_return(buf);
532 c->btree_cache.shrink.scan_objects(&c->btree_cache.shrink, &sc);
535 #ifdef CONFIG_BCACHEFS_TESTS
536 if (attr == &sysfs_perf_test) {
537 char *tmp = kstrdup(buf, GFP_KERNEL), *p = tmp;
538 char *test = strsep(&p, " \t\n");
539 char *nr_str = strsep(&p, " \t\n");
540 char *threads_str = strsep(&p, " \t\n");
546 !(ret = kstrtouint(threads_str, 10, &threads)) &&
547 !(ret = bch2_strtoull_h(nr_str, &nr)))
548 ret = bch2_btree_perf_test(c, test, nr, threads);
559 struct attribute *bch2_fs_files[] = {
561 &sysfs_btree_cache_size,
562 &sysfs_btree_avg_write_size,
564 &sysfs_promote_whole_extents,
566 &sysfs_compression_stats,
568 #ifdef CONFIG_BCACHEFS_TESTS
574 /* internal dir - just a wrapper */
576 SHOW(bch2_fs_internal)
578 struct bch_fs *c = container_of(kobj, struct bch_fs, internal);
579 return bch2_fs_show(&c->kobj, attr, buf);
582 STORE(bch2_fs_internal)
584 struct bch_fs *c = container_of(kobj, struct bch_fs, internal);
585 return bch2_fs_store(&c->kobj, attr, buf, size);
587 SYSFS_OPS(bch2_fs_internal);
589 struct attribute *bch2_fs_internal_files[] = {
590 &sysfs_journal_debug,
592 &sysfs_btree_updates,
593 &sysfs_dirty_btree_nodes,
595 &sysfs_btree_key_cache,
596 &sysfs_btree_transactions,
600 &sysfs_io_timers_read,
601 &sysfs_io_timers_write,
606 &sysfs_read_realloc_races,
607 &sysfs_extent_migrate_done,
608 &sysfs_extent_migrate_raced,
612 &sysfs_copy_gc_enabled,
615 &sysfs_rebalance_enabled,
616 &sysfs_rebalance_work,
617 sysfs_pd_controller_files(rebalance),
619 &sysfs_data_op_data_progress,
621 &sysfs_internal_uuid,
627 SHOW(bch2_fs_opts_dir)
629 struct printbuf out = _PBUF(buf, PAGE_SIZE);
630 struct bch_fs *c = container_of(kobj, struct bch_fs, opts_dir);
631 const struct bch_option *opt = container_of(attr, struct bch_option, attr);
632 int id = opt - bch2_opt_table;
633 u64 v = bch2_opt_get_by_id(&c->opts, id);
635 bch2_opt_to_text(&out, c, opt, v, OPT_SHOW_FULL_LIST);
638 return out.pos - buf;
641 STORE(bch2_fs_opts_dir)
643 struct bch_fs *c = container_of(kobj, struct bch_fs, opts_dir);
644 const struct bch_option *opt = container_of(attr, struct bch_option, attr);
645 int ret, id = opt - bch2_opt_table;
649 tmp = kstrdup(buf, GFP_KERNEL);
653 ret = bch2_opt_parse(c, NULL, opt, strim(tmp), &v);
659 ret = bch2_opt_check_may_set(c, id, v);
663 bch2_opt_set_sb(c, opt, v);
664 bch2_opt_set_by_id(&c->opts, id, v);
666 if ((id == Opt_background_target ||
667 id == Opt_background_compression) && v) {
668 bch2_rebalance_add_work(c, S64_MAX);
674 SYSFS_OPS(bch2_fs_opts_dir);
676 struct attribute *bch2_fs_opts_dir_files[] = { NULL };
678 int bch2_opts_create_sysfs_files(struct kobject *kobj)
680 const struct bch_option *i;
683 for (i = bch2_opt_table;
684 i < bch2_opt_table + bch2_opts_nr;
686 if (!(i->flags & OPT_FS))
689 ret = sysfs_create_file(kobj, &i->attr);
699 SHOW(bch2_fs_time_stats)
701 struct bch_fs *c = container_of(kobj, struct bch_fs, time_stats);
702 struct printbuf out = _PBUF(buf, PAGE_SIZE);
705 if (attr == &sysfs_time_stat_##name) { \
706 bch2_time_stats_to_text(&out, &c->times[BCH_TIME_##name]);\
707 return out.pos - buf; \
715 STORE(bch2_fs_time_stats)
719 SYSFS_OPS(bch2_fs_time_stats);
721 struct attribute *bch2_fs_time_stats_files[] = {
723 &sysfs_time_stat_##name,
729 static void reserve_stats_to_text(struct printbuf *out, struct bch_dev *ca)
731 enum alloc_reserve i;
733 spin_lock(&ca->fs->freelist_lock);
735 pr_buf(out, "free_inc:\t%zu\t%zu\n",
736 fifo_used(&ca->free_inc),
739 for (i = 0; i < RESERVE_NR; i++)
740 pr_buf(out, "free[%u]:\t%zu\t%zu\n", i,
741 fifo_used(&ca->free[i]),
744 spin_unlock(&ca->fs->freelist_lock);
747 static void dev_alloc_debug_to_text(struct printbuf *out, struct bch_dev *ca)
749 struct bch_fs *c = ca->fs;
750 struct bch_dev_usage stats = bch2_dev_usage_read(ca);
751 unsigned i, nr[BCH_DATA_NR];
753 memset(nr, 0, sizeof(nr));
755 for (i = 0; i < ARRAY_SIZE(c->open_buckets); i++)
756 nr[c->open_buckets[i].data_type]++;
759 "\t\t buckets\t sectors fragmented\n"
761 ca->mi.nbuckets - ca->mi.first_bucket);
763 for (i = 1; i < BCH_DATA_NR; i++)
764 pr_buf(out, "%-8s%16llu%16llu%16llu\n",
765 bch2_data_types[i], stats.d[i].buckets,
766 stats.d[i].sectors, stats.d[i].fragmented);
772 "free_inc\t\t%zu/%zu\n"
773 "free[RESERVE_MOVINGGC]\t%zu/%zu\n"
774 "free[RESERVE_NONE]\t%zu/%zu\n"
775 "freelist_wait\t\t%s\n"
776 "open buckets allocated\t%u\n"
777 "open buckets this dev\t%u\n"
778 "open buckets total\t%u\n"
779 "open_buckets_wait\t%s\n"
780 "open_buckets_btree\t%u\n"
781 "open_buckets_user\t%u\n"
782 "btree reserve cache\t%u\n"
783 "thread state:\t\t%s\n",
785 __dev_buckets_available(ca, stats),
786 fifo_used(&ca->free_inc), ca->free_inc.size,
787 fifo_used(&ca->free[RESERVE_MOVINGGC]), ca->free[RESERVE_MOVINGGC].size,
788 fifo_used(&ca->free[RESERVE_NONE]), ca->free[RESERVE_NONE].size,
789 c->freelist_wait.list.first ? "waiting" : "empty",
790 OPEN_BUCKETS_COUNT - c->open_buckets_nr_free,
793 c->open_buckets_wait.list.first ? "waiting" : "empty",
796 c->btree_reserve_cache_nr,
797 bch2_allocator_states[ca->allocator_state]);
800 static const char * const bch2_rw[] = {
806 static void dev_iodone_to_text(struct printbuf *out, struct bch_dev *ca)
810 for (rw = 0; rw < 2; rw++) {
811 pr_buf(out, "%s:\n", bch2_rw[rw]);
813 for (i = 1; i < BCH_DATA_NR; i++)
814 pr_buf(out, "%-12s:%12llu\n",
816 percpu_u64_get(&ca->io_done->sectors[rw][i]) << 9);
822 struct bch_dev *ca = container_of(kobj, struct bch_dev, kobj);
823 struct bch_fs *c = ca->fs;
824 struct printbuf out = _PBUF(buf, PAGE_SIZE);
826 sysfs_printf(uuid, "%pU\n", ca->uuid.b);
828 sysfs_print(bucket_size, bucket_bytes(ca));
829 sysfs_print(first_bucket, ca->mi.first_bucket);
830 sysfs_print(nbuckets, ca->mi.nbuckets);
831 sysfs_print(durability, ca->mi.durability);
832 sysfs_print(discard, ca->mi.discard);
834 if (attr == &sysfs_label) {
836 mutex_lock(&c->sb_lock);
837 bch2_disk_path_to_text(&out, &c->disk_sb,
839 mutex_unlock(&c->sb_lock);
843 return out.pos - buf;
846 if (attr == &sysfs_has_data) {
847 bch2_flags_to_text(&out, bch2_data_types,
848 bch2_dev_has_data(c, ca));
850 return out.pos - buf;
853 if (attr == &sysfs_state_rw) {
854 bch2_string_opt_to_text(&out, bch2_member_states,
857 return out.pos - buf;
860 if (attr == &sysfs_iodone) {
861 dev_iodone_to_text(&out, ca);
862 return out.pos - buf;
865 sysfs_print(io_latency_read, atomic64_read(&ca->cur_latency[READ]));
866 sysfs_print(io_latency_write, atomic64_read(&ca->cur_latency[WRITE]));
868 if (attr == &sysfs_io_latency_stats_read) {
869 bch2_time_stats_to_text(&out, &ca->io_latency[READ]);
870 return out.pos - buf;
872 if (attr == &sysfs_io_latency_stats_write) {
873 bch2_time_stats_to_text(&out, &ca->io_latency[WRITE]);
874 return out.pos - buf;
877 sysfs_printf(congested, "%u%%",
878 clamp(atomic_read(&ca->congested), 0, CONGESTED_MAX)
879 * 100 / CONGESTED_MAX);
881 if (attr == &sysfs_reserve_stats) {
882 reserve_stats_to_text(&out, ca);
883 return out.pos - buf;
885 if (attr == &sysfs_alloc_debug) {
886 dev_alloc_debug_to_text(&out, ca);
887 return out.pos - buf;
895 struct bch_dev *ca = container_of(kobj, struct bch_dev, kobj);
896 struct bch_fs *c = ca->fs;
897 struct bch_member *mi;
899 if (attr == &sysfs_discard) {
900 bool v = strtoul_or_return(buf);
902 mutex_lock(&c->sb_lock);
903 mi = &bch2_sb_get_members(c->disk_sb.sb)->members[ca->dev_idx];
905 if (v != BCH_MEMBER_DISCARD(mi)) {
906 SET_BCH_MEMBER_DISCARD(mi, v);
909 mutex_unlock(&c->sb_lock);
912 if (attr == &sysfs_label) {
916 tmp = kstrdup(buf, GFP_KERNEL);
920 ret = bch2_dev_group_set(c, ca, strim(tmp));
926 if (attr == &sysfs_wake_allocator)
927 bch2_wake_allocator(ca);
933 struct attribute *bch2_dev_files[] = {
948 &sysfs_io_latency_read,
949 &sysfs_io_latency_write,
950 &sysfs_io_latency_stats_read,
951 &sysfs_io_latency_stats_write,
954 &sysfs_reserve_stats,
958 &sysfs_wake_allocator,
962 #endif /* _BCACHEFS_SYSFS_H_ */