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/pretty-printers.h>
38 #include <linux/sort.h>
39 #include <linux/sched/clock.h>
43 #define SYSFS_OPS(type) \
44 const struct sysfs_ops type ## _sysfs_ops = { \
45 .show = type ## _show, \
46 .store = type ## _store \
50 static ssize_t fn ## _to_text(struct printbuf *, \
51 struct kobject *, struct attribute *); \
53 static ssize_t fn ## _show(struct kobject *kobj, struct attribute *attr,\
56 struct printbuf out = PRINTBUF; \
57 ssize_t ret = fn ## _to_text(&out, kobj, attr); \
59 if (out.pos && out.buf[out.pos - 1] != '\n') \
62 if (!ret && out.allocation_failure) \
66 ret = min_t(size_t, out.pos, PAGE_SIZE - 1); \
67 memcpy(buf, out.buf, ret); \
69 printbuf_exit(&out); \
70 return bch2_err_class(ret); \
73 static ssize_t fn ## _to_text(struct printbuf *out, struct kobject *kobj,\
74 struct attribute *attr)
77 static ssize_t fn ## _store_inner(struct kobject *, struct attribute *,\
78 const char *, size_t); \
80 static ssize_t fn ## _store(struct kobject *kobj, struct attribute *attr,\
81 const char *buf, size_t size) \
83 return bch2_err_class(fn##_store_inner(kobj, attr, buf, size)); \
86 static ssize_t fn ## _store_inner(struct kobject *kobj, struct attribute *attr,\
87 const char *buf, size_t size)
89 #define __sysfs_attribute(_name, _mode) \
90 static struct attribute sysfs_##_name = \
91 { .name = #_name, .mode = _mode }
93 #define write_attribute(n) __sysfs_attribute(n, 0200)
94 #define read_attribute(n) __sysfs_attribute(n, 0444)
95 #define rw_attribute(n) __sysfs_attribute(n, 0644)
97 #define sysfs_printf(file, fmt, ...) \
99 if (attr == &sysfs_ ## file) \
100 prt_printf(out, fmt "\n", __VA_ARGS__); \
103 #define sysfs_print(file, var) \
105 if (attr == &sysfs_ ## file) \
109 #define sysfs_hprint(file, val) \
111 if (attr == &sysfs_ ## file) \
112 prt_human_readable_s64(out, val); \
115 #define var_printf(_var, fmt) sysfs_printf(_var, fmt, var(_var))
116 #define var_print(_var) sysfs_print(_var, var(_var))
117 #define var_hprint(_var) sysfs_hprint(_var, var(_var))
119 #define sysfs_strtoul(file, var) \
121 if (attr == &sysfs_ ## file) \
122 return strtoul_safe(buf, var) ?: (ssize_t) size; \
125 #define sysfs_strtoul_clamp(file, var, min, max) \
127 if (attr == &sysfs_ ## file) \
128 return strtoul_safe_clamp(buf, var, min, max) \
132 #define strtoul_or_return(cp) \
135 int _r = kstrtoul(cp, 10, &_v); \
141 #define strtoul_restrict_or_return(cp, min, max) \
143 unsigned long __v = 0; \
144 int _r = strtoul_safe_restrict(cp, __v, min, max); \
150 #define strtoi_h_or_return(cp) \
153 int _r = strtoi_h(cp, &_v); \
159 #define sysfs_hatoi(file, var) \
161 if (attr == &sysfs_ ## file) \
162 return strtoi_h(buf, &var) ?: (ssize_t) size; \
165 write_attribute(trigger_gc);
166 write_attribute(trigger_discards);
167 write_attribute(trigger_invalidates);
168 write_attribute(prune_cache);
169 write_attribute(btree_wakeup);
170 rw_attribute(btree_gc_periodic);
171 rw_attribute(gc_gens_pos);
173 read_attribute(uuid);
174 read_attribute(minor);
175 read_attribute(bucket_size);
176 read_attribute(first_bucket);
177 read_attribute(nbuckets);
178 rw_attribute(durability);
179 read_attribute(iodone);
181 read_attribute(io_latency_read);
182 read_attribute(io_latency_write);
183 read_attribute(io_latency_stats_read);
184 read_attribute(io_latency_stats_write);
185 read_attribute(congested);
187 read_attribute(btree_write_stats);
189 read_attribute(btree_cache_size);
190 read_attribute(compression_stats);
191 read_attribute(journal_debug);
192 read_attribute(btree_updates);
193 read_attribute(btree_cache);
194 read_attribute(btree_key_cache);
195 read_attribute(stripes_heap);
196 read_attribute(open_buckets);
197 read_attribute(nocow_lock_table);
199 read_attribute(internal_uuid);
201 read_attribute(has_data);
202 read_attribute(alloc_debug);
204 #define x(t, n, ...) read_attribute(t);
205 BCH_PERSISTENT_COUNTERS()
208 rw_attribute(discard);
211 rw_attribute(copy_gc_enabled);
212 read_attribute(copy_gc_wait);
214 rw_attribute(rebalance_enabled);
215 sysfs_pd_controller_attribute(rebalance);
216 read_attribute(rebalance_work);
217 rw_attribute(promote_whole_extents);
219 read_attribute(new_stripes);
221 read_attribute(io_timers_read);
222 read_attribute(io_timers_write);
224 read_attribute(data_jobs);
226 #ifdef CONFIG_BCACHEFS_TESTS
227 write_attribute(perf_test);
228 #endif /* CONFIG_BCACHEFS_TESTS */
231 static struct attribute sysfs_time_stat_##_name = \
232 { .name = #_name, .mode = 0444 };
236 static struct attribute sysfs_state_rw = {
241 static size_t bch2_btree_cache_size(struct bch_fs *c)
246 mutex_lock(&c->btree_cache.lock);
247 list_for_each_entry(b, &c->btree_cache.live, list)
248 ret += btree_bytes(c);
250 mutex_unlock(&c->btree_cache.lock);
254 static long data_progress_to_text(struct printbuf *out, struct bch_fs *c)
257 struct bch_move_stats *stats;
259 mutex_lock(&c->data_progress_lock);
260 list_for_each_entry(stats, &c->data_progress_list, list) {
261 prt_printf(out, "%s: data type %s btree_id %s position: ",
263 bch2_data_types[stats->data_type],
264 bch2_btree_ids[stats->btree_id]);
265 bch2_bpos_to_text(out, stats->pos);
266 prt_printf(out, "%s", "\n");
269 mutex_unlock(&c->data_progress_lock);
273 static int bch2_compression_stats_to_text(struct printbuf *out, struct bch_fs *c)
275 struct btree_trans trans;
276 struct btree_iter iter;
279 u64 nr_uncompressed_extents = 0,
280 nr_compressed_extents = 0,
281 nr_incompressible_extents = 0,
282 uncompressed_sectors = 0,
283 incompressible_sectors = 0,
284 compressed_sectors_compressed = 0,
285 compressed_sectors_uncompressed = 0;
288 if (!test_bit(BCH_FS_STARTED, &c->flags))
291 bch2_trans_init(&trans, c, 0, 0);
293 for (id = 0; id < BTREE_ID_NR; id++) {
294 if (!btree_type_has_ptrs(id))
297 for_each_btree_key(&trans, iter, id, POS_MIN,
298 BTREE_ITER_ALL_SNAPSHOTS, k, ret) {
299 struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k);
300 const union bch_extent_entry *entry;
301 struct extent_ptr_decoded p;
302 bool compressed = false, uncompressed = false, incompressible = false;
304 bkey_for_each_ptr_decode(k.k, ptrs, p, entry) {
305 switch (p.crc.compression_type) {
306 case BCH_COMPRESSION_TYPE_none:
308 uncompressed_sectors += k.k->size;
310 case BCH_COMPRESSION_TYPE_incompressible:
311 incompressible = true;
312 incompressible_sectors += k.k->size;
315 compressed_sectors_compressed +=
316 p.crc.compressed_size;
317 compressed_sectors_uncompressed +=
318 p.crc.uncompressed_size;
325 nr_incompressible_extents++;
326 else if (uncompressed)
327 nr_uncompressed_extents++;
329 nr_compressed_extents++;
331 bch2_trans_iter_exit(&trans, &iter);
334 bch2_trans_exit(&trans);
339 prt_printf(out, "uncompressed:\n");
340 prt_printf(out, " nr extents: %llu\n", nr_uncompressed_extents);
341 prt_printf(out, " size: ");
342 prt_human_readable_u64(out, uncompressed_sectors << 9);
343 prt_printf(out, "\n");
345 prt_printf(out, "compressed:\n");
346 prt_printf(out, " nr extents: %llu\n", nr_compressed_extents);
347 prt_printf(out, " compressed size: ");
348 prt_human_readable_u64(out, compressed_sectors_compressed << 9);
349 prt_printf(out, "\n");
350 prt_printf(out, " uncompressed size: ");
351 prt_human_readable_u64(out, compressed_sectors_uncompressed << 9);
352 prt_printf(out, "\n");
354 prt_printf(out, "incompressible:\n");
355 prt_printf(out, " nr extents: %llu\n", nr_incompressible_extents);
356 prt_printf(out, " size: ");
357 prt_human_readable_u64(out, incompressible_sectors << 9);
358 prt_printf(out, "\n");
362 static void bch2_gc_gens_pos_to_text(struct printbuf *out, struct bch_fs *c)
364 prt_printf(out, "%s: ", bch2_btree_ids[c->gc_gens_btree]);
365 bch2_bpos_to_text(out, c->gc_gens_pos);
366 prt_printf(out, "\n");
369 static void bch2_btree_wakeup_all(struct bch_fs *c)
371 struct btree_trans *trans;
373 mutex_lock(&c->btree_trans_lock);
374 list_for_each_entry(trans, &c->btree_trans_list, list) {
375 struct btree_bkey_cached_common *b = READ_ONCE(trans->locking);
378 six_lock_wakeup_all(&b->lock);
381 mutex_unlock(&c->btree_trans_lock);
386 struct bch_fs *c = container_of(kobj, struct bch_fs, kobj);
388 sysfs_print(minor, c->minor);
389 sysfs_printf(internal_uuid, "%pU", c->sb.uuid.b);
391 sysfs_hprint(btree_cache_size, bch2_btree_cache_size(c));
393 if (attr == &sysfs_btree_write_stats)
394 bch2_btree_write_stats_to_text(out, c);
396 sysfs_printf(btree_gc_periodic, "%u", (int) c->btree_gc_periodic);
398 if (attr == &sysfs_gc_gens_pos)
399 bch2_gc_gens_pos_to_text(out, c);
401 sysfs_printf(copy_gc_enabled, "%i", c->copy_gc_enabled);
403 sysfs_printf(rebalance_enabled, "%i", c->rebalance.enabled);
404 sysfs_pd_controller_show(rebalance, &c->rebalance.pd); /* XXX */
405 sysfs_hprint(copy_gc_wait,
406 max(0LL, c->copygc_wait -
407 atomic64_read(&c->io_clock[WRITE].now)) << 9);
409 if (attr == &sysfs_rebalance_work)
410 bch2_rebalance_work_to_text(out, c);
412 sysfs_print(promote_whole_extents, c->promote_whole_extents);
416 if (attr == &sysfs_journal_debug)
417 bch2_journal_debug_to_text(out, &c->journal);
419 if (attr == &sysfs_btree_updates)
420 bch2_btree_updates_to_text(out, c);
422 if (attr == &sysfs_btree_cache)
423 bch2_btree_cache_to_text(out, &c->btree_cache);
425 if (attr == &sysfs_btree_key_cache)
426 bch2_btree_key_cache_to_text(out, &c->btree_key_cache);
428 if (attr == &sysfs_stripes_heap)
429 bch2_stripes_heap_to_text(out, c);
431 if (attr == &sysfs_open_buckets)
432 bch2_open_buckets_to_text(out, c);
434 if (attr == &sysfs_compression_stats)
435 bch2_compression_stats_to_text(out, c);
437 if (attr == &sysfs_new_stripes)
438 bch2_new_stripes_to_text(out, c);
440 if (attr == &sysfs_io_timers_read)
441 bch2_io_timers_to_text(out, &c->io_clock[READ]);
443 if (attr == &sysfs_io_timers_write)
444 bch2_io_timers_to_text(out, &c->io_clock[WRITE]);
446 if (attr == &sysfs_data_jobs)
447 data_progress_to_text(out, c);
449 if (attr == &sysfs_nocow_lock_table) {
453 last = atomic_long_read(&c->nocow_locks.l[0].v);
454 for (i = 1; i < BUCKET_NOCOW_LOCKS; i++) {
455 curr = atomic_long_read(&c->nocow_locks.l[i].v);
457 prt_printf(out, "%li: %d\n", last, count);
463 prt_printf(out, "%li: %d\n", last, count);
470 struct bch_fs *c = container_of(kobj, struct bch_fs, kobj);
472 if (attr == &sysfs_btree_gc_periodic) {
473 ssize_t ret = strtoul_safe(buf, c->btree_gc_periodic)
476 wake_up_process(c->gc_thread);
480 if (attr == &sysfs_copy_gc_enabled) {
481 ssize_t ret = strtoul_safe(buf, c->copy_gc_enabled)
484 if (c->copygc_thread)
485 wake_up_process(c->copygc_thread);
489 if (attr == &sysfs_rebalance_enabled) {
490 ssize_t ret = strtoul_safe(buf, c->rebalance.enabled)
497 sysfs_pd_controller_store(rebalance, &c->rebalance.pd);
499 sysfs_strtoul(promote_whole_extents, c->promote_whole_extents);
503 if (!test_bit(BCH_FS_STARTED, &c->flags))
508 if (!test_bit(BCH_FS_RW, &c->flags))
511 if (attr == &sysfs_prune_cache) {
512 struct shrink_control sc;
514 sc.gfp_mask = GFP_KERNEL;
515 sc.nr_to_scan = strtoul_or_return(buf);
516 c->btree_cache.shrink.scan_objects(&c->btree_cache.shrink, &sc);
519 if (attr == &sysfs_btree_wakeup)
520 bch2_btree_wakeup_all(c);
522 if (attr == &sysfs_trigger_gc) {
524 * Full gc is currently incompatible with btree key cache:
527 down_read(&c->state_lock);
528 bch2_gc(c, false, false);
529 up_read(&c->state_lock);
535 if (attr == &sysfs_trigger_discards)
538 if (attr == &sysfs_trigger_invalidates)
539 bch2_do_invalidates(c);
541 #ifdef CONFIG_BCACHEFS_TESTS
542 if (attr == &sysfs_perf_test) {
543 char *tmp = kstrdup(buf, GFP_KERNEL), *p = tmp;
544 char *test = strsep(&p, " \t\n");
545 char *nr_str = strsep(&p, " \t\n");
546 char *threads_str = strsep(&p, " \t\n");
552 !(ret = kstrtouint(threads_str, 10, &threads)) &&
553 !(ret = bch2_strtoull_h(nr_str, &nr)))
554 ret = bch2_btree_perf_test(c, test, nr, threads);
565 struct attribute *bch2_fs_files[] = {
567 &sysfs_btree_cache_size,
568 &sysfs_btree_write_stats,
570 &sysfs_promote_whole_extents,
572 &sysfs_compression_stats,
574 #ifdef CONFIG_BCACHEFS_TESTS
582 SHOW(bch2_fs_counters)
584 struct bch_fs *c = container_of(kobj, struct bch_fs, counters_kobj);
586 u64 counter_since_mount = 0;
588 printbuf_tabstop_push(out, 32);
591 if (attr == &sysfs_##t) { \
592 counter = percpu_u64_get(&c->counters[BCH_COUNTER_##t]);\
593 counter_since_mount = counter - c->counters_on_mount[BCH_COUNTER_##t];\
594 prt_printf(out, "since mount:"); \
596 prt_human_readable_u64(out, counter_since_mount << 9); \
599 prt_printf(out, "since filesystem creation:"); \
601 prt_human_readable_u64(out, counter << 9); \
604 BCH_PERSISTENT_COUNTERS()
609 STORE(bch2_fs_counters) {
613 SYSFS_OPS(bch2_fs_counters);
615 struct attribute *bch2_fs_counters_files[] = {
618 BCH_PERSISTENT_COUNTERS()
622 /* internal dir - just a wrapper */
624 SHOW(bch2_fs_internal)
626 struct bch_fs *c = container_of(kobj, struct bch_fs, internal);
628 return bch2_fs_to_text(out, &c->kobj, attr);
631 STORE(bch2_fs_internal)
633 struct bch_fs *c = container_of(kobj, struct bch_fs, internal);
635 return bch2_fs_store(&c->kobj, attr, buf, size);
637 SYSFS_OPS(bch2_fs_internal);
639 struct attribute *bch2_fs_internal_files[] = {
640 &sysfs_journal_debug,
641 &sysfs_btree_updates,
643 &sysfs_btree_key_cache,
647 &sysfs_nocow_lock_table,
648 &sysfs_io_timers_read,
649 &sysfs_io_timers_write,
652 &sysfs_trigger_discards,
653 &sysfs_trigger_invalidates,
659 &sysfs_copy_gc_enabled,
662 &sysfs_rebalance_enabled,
663 &sysfs_rebalance_work,
664 sysfs_pd_controller_files(rebalance),
668 &sysfs_internal_uuid,
674 SHOW(bch2_fs_opts_dir)
676 struct bch_fs *c = container_of(kobj, struct bch_fs, opts_dir);
677 const struct bch_option *opt = container_of(attr, struct bch_option, attr);
678 int id = opt - bch2_opt_table;
679 u64 v = bch2_opt_get_by_id(&c->opts, id);
681 bch2_opt_to_text(out, c, c->disk_sb.sb, opt, v, OPT_SHOW_FULL_LIST);
687 STORE(bch2_fs_opts_dir)
689 struct bch_fs *c = container_of(kobj, struct bch_fs, opts_dir);
690 const struct bch_option *opt = container_of(attr, struct bch_option, attr);
691 int ret, id = opt - bch2_opt_table;
696 * We don't need to take c->writes for correctness, but it eliminates an
697 * unsightly error message in the dmesg log when we're RO:
699 if (unlikely(!percpu_ref_tryget_live(&c->writes)))
702 tmp = kstrdup(buf, GFP_KERNEL);
708 ret = bch2_opt_parse(c, opt, strim(tmp), &v, NULL);
714 ret = bch2_opt_check_may_set(c, id, v);
718 bch2_opt_set_sb(c, opt, v);
719 bch2_opt_set_by_id(&c->opts, id, v);
721 if ((id == Opt_background_target ||
722 id == Opt_background_compression) && v) {
723 bch2_rebalance_add_work(c, S64_MAX);
729 percpu_ref_put(&c->writes);
732 SYSFS_OPS(bch2_fs_opts_dir);
734 struct attribute *bch2_fs_opts_dir_files[] = { NULL };
736 int bch2_opts_create_sysfs_files(struct kobject *kobj)
738 const struct bch_option *i;
741 for (i = bch2_opt_table;
742 i < bch2_opt_table + bch2_opts_nr;
744 if (!(i->flags & OPT_FS))
747 ret = sysfs_create_file(kobj, &i->attr);
757 SHOW(bch2_fs_time_stats)
759 struct bch_fs *c = container_of(kobj, struct bch_fs, time_stats);
762 if (attr == &sysfs_time_stat_##name) \
763 bch2_time_stats_to_text(out, &c->times[BCH_TIME_##name]);
770 STORE(bch2_fs_time_stats)
774 SYSFS_OPS(bch2_fs_time_stats);
776 struct attribute *bch2_fs_time_stats_files[] = {
778 &sysfs_time_stat_##name,
784 static void dev_alloc_debug_to_text(struct printbuf *out, struct bch_dev *ca)
786 struct bch_fs *c = ca->fs;
787 struct bch_dev_usage stats = bch2_dev_usage_read(ca);
788 unsigned i, nr[BCH_DATA_NR];
790 memset(nr, 0, sizeof(nr));
792 for (i = 0; i < ARRAY_SIZE(c->open_buckets); i++)
793 nr[c->open_buckets[i].data_type]++;
796 "\t\t\t buckets\t sectors fragmented\n"
797 "capacity\t%16llu\n",
798 ca->mi.nbuckets - ca->mi.first_bucket);
800 for (i = 0; i < BCH_DATA_NR; i++)
801 prt_printf(out, "%-16s%16llu%16llu%16llu\n",
802 bch2_data_types[i], stats.d[i].buckets,
803 stats.d[i].sectors, stats.d[i].fragmented);
808 "freelist_wait\t\t%s\n"
809 "open buckets allocated\t%u\n"
810 "open buckets this dev\t%u\n"
811 "open buckets total\t%u\n"
812 "open_buckets_wait\t%s\n"
813 "open_buckets_btree\t%u\n"
814 "open_buckets_user\t%u\n"
815 "buckets_to_invalidate\t%llu\n"
816 "btree reserve cache\t%u\n",
818 c->freelist_wait.list.first ? "waiting" : "empty",
819 OPEN_BUCKETS_COUNT - c->open_buckets_nr_free,
822 c->open_buckets_wait.list.first ? "waiting" : "empty",
825 should_invalidate_buckets(ca, stats),
826 c->btree_reserve_cache_nr);
829 static const char * const bch2_rw[] = {
835 static void dev_iodone_to_text(struct printbuf *out, struct bch_dev *ca)
839 for (rw = 0; rw < 2; rw++) {
840 prt_printf(out, "%s:\n", bch2_rw[rw]);
842 for (i = 1; i < BCH_DATA_NR; i++)
843 prt_printf(out, "%-12s:%12llu\n",
845 percpu_u64_get(&ca->io_done->sectors[rw][i]) << 9);
851 struct bch_dev *ca = container_of(kobj, struct bch_dev, kobj);
852 struct bch_fs *c = ca->fs;
854 sysfs_printf(uuid, "%pU\n", ca->uuid.b);
856 sysfs_print(bucket_size, bucket_bytes(ca));
857 sysfs_print(first_bucket, ca->mi.first_bucket);
858 sysfs_print(nbuckets, ca->mi.nbuckets);
859 sysfs_print(durability, ca->mi.durability);
860 sysfs_print(discard, ca->mi.discard);
862 if (attr == &sysfs_label) {
864 mutex_lock(&c->sb_lock);
865 bch2_disk_path_to_text(out, c->disk_sb.sb,
867 mutex_unlock(&c->sb_lock);
873 if (attr == &sysfs_has_data) {
874 prt_bitflags(out, bch2_data_types, bch2_dev_has_data(c, ca));
878 if (attr == &sysfs_state_rw) {
879 prt_string_option(out, bch2_member_states, ca->mi.state);
883 if (attr == &sysfs_iodone)
884 dev_iodone_to_text(out, ca);
886 sysfs_print(io_latency_read, atomic64_read(&ca->cur_latency[READ]));
887 sysfs_print(io_latency_write, atomic64_read(&ca->cur_latency[WRITE]));
889 if (attr == &sysfs_io_latency_stats_read)
890 bch2_time_stats_to_text(out, &ca->io_latency[READ]);
892 if (attr == &sysfs_io_latency_stats_write)
893 bch2_time_stats_to_text(out, &ca->io_latency[WRITE]);
895 sysfs_printf(congested, "%u%%",
896 clamp(atomic_read(&ca->congested), 0, CONGESTED_MAX)
897 * 100 / CONGESTED_MAX);
899 if (attr == &sysfs_alloc_debug)
900 dev_alloc_debug_to_text(out, ca);
907 struct bch_dev *ca = container_of(kobj, struct bch_dev, kobj);
908 struct bch_fs *c = ca->fs;
909 struct bch_member *mi;
911 if (attr == &sysfs_discard) {
912 bool v = strtoul_or_return(buf);
914 mutex_lock(&c->sb_lock);
915 mi = &bch2_sb_get_members(c->disk_sb.sb)->members[ca->dev_idx];
917 if (v != BCH_MEMBER_DISCARD(mi)) {
918 SET_BCH_MEMBER_DISCARD(mi, v);
921 mutex_unlock(&c->sb_lock);
924 if (attr == &sysfs_durability) {
925 u64 v = strtoul_or_return(buf);
927 mutex_lock(&c->sb_lock);
928 mi = &bch2_sb_get_members(c->disk_sb.sb)->members[ca->dev_idx];
930 if (v != BCH_MEMBER_DURABILITY(mi)) {
931 SET_BCH_MEMBER_DURABILITY(mi, v + 1);
934 mutex_unlock(&c->sb_lock);
937 if (attr == &sysfs_label) {
941 tmp = kstrdup(buf, GFP_KERNEL);
945 ret = bch2_dev_group_set(c, ca, strim(tmp));
955 struct attribute *bch2_dev_files[] = {
970 &sysfs_io_latency_read,
971 &sysfs_io_latency_write,
972 &sysfs_io_latency_stats_read,
973 &sysfs_io_latency_stats_write,
981 #endif /* _BCACHEFS_SYSFS_H_ */