Lines Matching +full:read +full:- +full:out
1 // SPDX-License-Identifier: GPL-2.0
37 struct btree *v = c->verify_data; in bch2_btree_verify_replica()
38 struct btree_node *n_ondisk = c->verify_ondisk; in bch2_btree_verify_replica()
39 struct btree_node *n_sorted = c->verify_data->data; in bch2_btree_verify_replica()
40 struct bset *sorted, *inmemory = &b->data->keys; in bch2_btree_verify_replica()
44 struct bch_dev *ca = bch2_dev_get_ioref(c, pick.ptr.dev, READ); in bch2_btree_verify_replica()
48 bio = bio_alloc_bioset(ca->disk_sb.bdev, in bch2_btree_verify_replica()
52 &c->btree_bio); in bch2_btree_verify_replica()
53 bio->bi_iter.bi_sector = pick.ptr.offset; in bch2_btree_verify_replica()
59 percpu_ref_put(&ca->io_ref); in bch2_btree_verify_replica()
63 v->written = 0; in bch2_btree_verify_replica()
67 n_sorted = c->verify_data->data; in bch2_btree_verify_replica()
68 sorted = &n_sorted->keys; in bch2_btree_verify_replica()
70 if (inmemory->u64s != sorted->u64s || in bch2_btree_verify_replica()
71 memcmp(inmemory->start, in bch2_btree_verify_replica()
72 sorted->start, in bch2_btree_verify_replica()
73 vstruct_end(inmemory) - (void *) inmemory->start)) { in bch2_btree_verify_replica()
83 printk(KERN_ERR "*** read back in:\n"); in bch2_btree_verify_replica()
86 while (offset < v->written) { in bch2_btree_verify_replica()
88 i = &n_ondisk->keys; in bch2_btree_verify_replica()
89 sectors = vstruct_blocks(n_ondisk, c->block_bits) << in bch2_btree_verify_replica()
90 c->block_bits; in bch2_btree_verify_replica()
94 i = &bne->keys; in bch2_btree_verify_replica()
96 sectors = vstruct_blocks(bne, c->block_bits) << in bch2_btree_verify_replica()
97 c->block_bits; in bch2_btree_verify_replica()
106 for (j = 0; j < le16_to_cpu(inmemory->u64s); j++) in bch2_btree_verify_replica()
107 if (inmemory->_data[j] != sorted->_data[j]) in bch2_btree_verify_replica()
116 if (v->written != b->written) { in bch2_btree_verify_replica()
118 b->written, v->written); in bch2_btree_verify_replica()
131 struct bset *inmemory = &b->data->keys; in __bch2_btree_verify()
135 if (c->opts.nochanges) in __bch2_btree_verify()
139 mutex_lock(&c->verify_lock); in __bch2_btree_verify()
141 if (!c->verify_ondisk) { in __bch2_btree_verify()
142 c->verify_ondisk = kvmalloc(btree_buf_bytes(b), GFP_KERNEL); in __bch2_btree_verify()
143 if (!c->verify_ondisk) in __bch2_btree_verify()
144 goto out; in __bch2_btree_verify()
147 if (!c->verify_data) { in __bch2_btree_verify()
148 c->verify_data = __bch2_btree_node_mem_alloc(c); in __bch2_btree_verify()
149 if (!c->verify_data) in __bch2_btree_verify()
150 goto out; in __bch2_btree_verify()
152 list_del_init(&c->verify_data->list); in __bch2_btree_verify()
155 BUG_ON(b->nsets != 1); in __bch2_btree_verify()
157 for (k = inmemory->start; k != vstruct_last(inmemory); k = bkey_p_next(k)) in __bch2_btree_verify()
158 if (k->type == KEY_TYPE_btree_ptr_v2) in __bch2_btree_verify()
159 ((struct bch_btree_ptr_v2 *) bkeyp_val(&b->format, k))->mem_ptr = 0; in __bch2_btree_verify()
161 v = c->verify_data; in __bch2_btree_verify()
162 bkey_copy(&v->key, &b->key); in __bch2_btree_verify()
163 v->c.level = b->c.level; in __bch2_btree_verify()
164 v->c.btree_id = b->c.btree_id; in __bch2_btree_verify()
167 ptrs = bch2_bkey_ptrs_c(bkey_i_to_s_c(&b->key)); in __bch2_btree_verify()
168 bkey_for_each_ptr_decode(&b->key.k, ptrs, p, entry) in __bch2_btree_verify()
174 bch2_bkey_val_to_text(&buf, c, bkey_i_to_s_c(&b->key)); in __bch2_btree_verify()
178 out: in __bch2_btree_verify()
179 mutex_unlock(&c->verify_lock); in __bch2_btree_verify()
183 void bch2_btree_node_ondisk_to_text(struct printbuf *out, struct bch_fs *c, in bch2_btree_node_ondisk_to_text() argument
193 if (bch2_bkey_pick_read_device(c, bkey_i_to_s_c(&b->key), NULL, &pick) <= 0) { in bch2_btree_node_ondisk_to_text()
194 prt_printf(out, "error getting device to read from: invalid device\n"); in bch2_btree_node_ondisk_to_text()
198 ca = bch2_dev_get_ioref(c, pick.ptr.dev, READ); in bch2_btree_node_ondisk_to_text()
200 prt_printf(out, "error getting device to read from: not online\n"); in bch2_btree_node_ondisk_to_text()
206 prt_printf(out, "memory allocation failure\n"); in bch2_btree_node_ondisk_to_text()
207 goto out; in bch2_btree_node_ondisk_to_text()
210 bio = bio_alloc_bioset(ca->disk_sb.bdev, in bch2_btree_node_ondisk_to_text()
214 &c->btree_bio); in bch2_btree_node_ondisk_to_text()
215 bio->bi_iter.bi_sector = pick.ptr.offset; in bch2_btree_node_ondisk_to_text()
220 prt_printf(out, "IO error reading btree node: %s\n", bch2_err_str(ret)); in bch2_btree_node_ondisk_to_text()
221 goto out; in bch2_btree_node_ondisk_to_text()
232 i = &n_ondisk->keys; in bch2_btree_node_ondisk_to_text()
235 prt_printf(out, "unknown checksum type at offset %u: %llu\n", in bch2_btree_node_ondisk_to_text()
237 goto out; in bch2_btree_node_ondisk_to_text()
243 if (bch2_crc_cmp(csum, n_ondisk->csum)) { in bch2_btree_node_ondisk_to_text()
244 prt_printf(out, "invalid checksum\n"); in bch2_btree_node_ondisk_to_text()
245 goto out; in bch2_btree_node_ondisk_to_text()
250 sectors = vstruct_sectors(n_ondisk, c->block_bits); in bch2_btree_node_ondisk_to_text()
254 i = &bne->keys; in bch2_btree_node_ondisk_to_text()
256 if (i->seq != n_ondisk->keys.seq) in bch2_btree_node_ondisk_to_text()
260 prt_printf(out, "unknown checksum type at offset %u: %llu\n", in bch2_btree_node_ondisk_to_text()
262 goto out; in bch2_btree_node_ondisk_to_text()
268 if (bch2_crc_cmp(csum, bne->csum)) { in bch2_btree_node_ondisk_to_text()
269 prt_printf(out, "invalid checksum"); in bch2_btree_node_ondisk_to_text()
270 goto out; in bch2_btree_node_ondisk_to_text()
275 sectors = vstruct_sectors(bne, c->block_bits); in bch2_btree_node_ondisk_to_text()
278 prt_printf(out, " offset %u version %u, journal seq %llu\n", in bch2_btree_node_ondisk_to_text()
280 le16_to_cpu(i->version), in bch2_btree_node_ondisk_to_text()
281 le64_to_cpu(i->journal_seq)); in bch2_btree_node_ondisk_to_text()
284 printbuf_indent_add(out, 4); in bch2_btree_node_ondisk_to_text()
286 for (k = i->start; k != vstruct_last(i); k = bkey_p_next(k)) { in bch2_btree_node_ondisk_to_text()
289 bch2_bkey_val_to_text(out, c, bkey_disassemble(b, k, &u)); in bch2_btree_node_ondisk_to_text()
290 prt_newline(out); in bch2_btree_node_ondisk_to_text()
293 printbuf_indent_sub(out, 4); in bch2_btree_node_ondisk_to_text()
295 out: in bch2_btree_node_ondisk_to_text()
299 percpu_ref_put(&ca->io_ref); in bch2_btree_node_ondisk_to_text()
316 size_t size; /* size of requested read */
317 ssize_t ret; /* bytes read so far */
322 if (i->buf.pos) { in flush_buf()
323 size_t bytes = min_t(size_t, i->buf.pos, i->size); in flush_buf()
324 int copied = bytes - copy_to_user(i->ubuf, i->buf.buf, bytes); in flush_buf()
326 i->ret += copied; in flush_buf()
327 i->ubuf += copied; in flush_buf()
328 i->size -= copied; in flush_buf()
329 i->buf.pos -= copied; in flush_buf()
330 memmove(i->buf.buf, i->buf.buf + copied, i->buf.pos); in flush_buf()
333 return -EFAULT; in flush_buf()
336 return i->size ? 0 : i->ret; in flush_buf()
341 struct btree_debug *bd = inode->i_private; in bch2_dump_open()
346 return -ENOMEM; in bch2_dump_open()
348 file->private_data = i; in bch2_dump_open()
349 i->from = POS_MIN; in bch2_dump_open()
350 i->iter = 0; in bch2_dump_open()
351 i->c = container_of(bd, struct bch_fs, btree_debug[bd->id]); in bch2_dump_open()
352 i->id = bd->id; in bch2_dump_open()
353 i->buf = PRINTBUF; in bch2_dump_open()
360 struct dump_iter *i = file->private_data; in bch2_dump_release()
362 printbuf_exit(&i->buf); in bch2_dump_release()
370 struct dump_iter *i = file->private_data; in bch2_read_btree()
372 i->ubuf = buf; in bch2_read_btree()
373 i->size = size; in bch2_read_btree()
374 i->ret = 0; in bch2_read_btree()
377 bch2_trans_run(i->c, in bch2_read_btree()
378 for_each_btree_key(trans, iter, i->id, i->from, in bch2_read_btree()
381 bch2_bkey_val_to_text(&i->buf, i->c, k); in bch2_read_btree()
382 prt_newline(&i->buf); in bch2_read_btree()
384 i->from = bpos_successor(iter.pos); in bch2_read_btree()
387 i->ret; in bch2_read_btree()
394 .read = bch2_read_btree,
400 struct dump_iter *i = file->private_data; in bch2_read_btree_formats()
402 i->ubuf = buf; in bch2_read_btree_formats()
403 i->size = size; in bch2_read_btree_formats()
404 i->ret = 0; in bch2_read_btree_formats()
410 if (bpos_eq(SPOS_MAX, i->from)) in bch2_read_btree_formats()
411 return i->ret; in bch2_read_btree_formats()
413 return bch2_trans_run(i->c, in bch2_read_btree_formats()
414 for_each_btree_node(trans, iter, i->id, i->from, 0, b, ({ in bch2_read_btree_formats()
415 bch2_btree_node_to_text(&i->buf, i->c, b); in bch2_read_btree_formats()
416 i->from = !bpos_eq(SPOS_MAX, b->key.k.p) in bch2_read_btree_formats()
417 ? bpos_successor(b->key.k.p) in bch2_read_btree_formats()
418 : b->key.k.p; in bch2_read_btree_formats()
421 }))) ?: i->ret; in bch2_read_btree_formats()
428 .read = bch2_read_btree_formats,
434 struct dump_iter *i = file->private_data; in bch2_read_bfloat_failed()
436 i->ubuf = buf; in bch2_read_bfloat_failed()
437 i->size = size; in bch2_read_bfloat_failed()
438 i->ret = 0; in bch2_read_bfloat_failed()
441 bch2_trans_run(i->c, in bch2_read_bfloat_failed()
442 for_each_btree_key(trans, iter, i->id, i->from, in bch2_read_bfloat_failed()
446 &btree_iter_path(trans, &iter)->l[0]; in bch2_read_bfloat_failed()
448 bch2_btree_node_iter_peek(&l->iter, l->b); in bch2_read_bfloat_failed()
450 if (bpos_gt(l->b->key.k.p, i->prev_node)) { in bch2_read_bfloat_failed()
451 bch2_btree_node_to_text(&i->buf, i->c, l->b); in bch2_read_bfloat_failed()
452 i->prev_node = l->b->key.k.p; in bch2_read_bfloat_failed()
455 bch2_bfloat_to_text(&i->buf, l->b, _k); in bch2_read_bfloat_failed()
457 i->from = bpos_successor(iter.pos); in bch2_read_bfloat_failed()
460 i->ret; in bch2_read_bfloat_failed()
467 .read = bch2_read_bfloat_failed,
470 static void bch2_cached_btree_node_to_text(struct printbuf *out, struct bch_fs *c, in bch2_cached_btree_node_to_text() argument
473 if (!out->nr_tabstops) in bch2_cached_btree_node_to_text()
474 printbuf_tabstop_push(out, 32); in bch2_cached_btree_node_to_text()
476 prt_printf(out, "%px ", b); in bch2_cached_btree_node_to_text()
477 bch2_btree_id_level_to_text(out, b->c.btree_id, b->c.level); in bch2_cached_btree_node_to_text()
478 prt_printf(out, "\n"); in bch2_cached_btree_node_to_text()
480 printbuf_indent_add(out, 2); in bch2_cached_btree_node_to_text()
482 bch2_bkey_val_to_text(out, c, bkey_i_to_s_c(&b->key)); in bch2_cached_btree_node_to_text()
483 prt_newline(out); in bch2_cached_btree_node_to_text()
485 prt_printf(out, "flags:\t"); in bch2_cached_btree_node_to_text()
486 prt_bitflags(out, bch2_btree_node_flags, b->flags); in bch2_cached_btree_node_to_text()
487 prt_newline(out); in bch2_cached_btree_node_to_text()
489 prt_printf(out, "pcpu read locks:\t%u\n", b->c.lock.readers != NULL); in bch2_cached_btree_node_to_text()
490 prt_printf(out, "written:\t%u\n", b->written); in bch2_cached_btree_node_to_text()
491 prt_printf(out, "writes blocked:\t%u\n", !list_empty_careful(&b->write_blocked)); in bch2_cached_btree_node_to_text()
492 prt_printf(out, "will make reachable:\t%lx\n", b->will_make_reachable); in bch2_cached_btree_node_to_text()
494 prt_printf(out, "journal pin %px:\t%llu\n", in bch2_cached_btree_node_to_text()
495 &b->writes[0].journal, b->writes[0].journal.seq); in bch2_cached_btree_node_to_text()
496 prt_printf(out, "journal pin %px:\t%llu\n", in bch2_cached_btree_node_to_text()
497 &b->writes[1].journal, b->writes[1].journal.seq); in bch2_cached_btree_node_to_text()
499 printbuf_indent_sub(out, 2); in bch2_cached_btree_node_to_text()
505 struct dump_iter *i = file->private_data; in bch2_cached_btree_nodes_read()
506 struct bch_fs *c = i->c; in bch2_cached_btree_nodes_read()
510 i->ubuf = buf; in bch2_cached_btree_nodes_read()
511 i->size = size; in bch2_cached_btree_nodes_read()
512 i->ret = 0; in bch2_cached_btree_nodes_read()
524 i->buf.atomic++; in bch2_cached_btree_nodes_read()
525 tbl = rht_dereference_rcu(c->btree_cache.table.tbl, in bch2_cached_btree_nodes_read()
526 &c->btree_cache.table); in bch2_cached_btree_nodes_read()
527 if (i->iter < tbl->size) { in bch2_cached_btree_nodes_read()
528 rht_for_each_entry_rcu(b, pos, tbl, i->iter, hash) in bch2_cached_btree_nodes_read()
529 bch2_cached_btree_node_to_text(&i->buf, c, b); in bch2_cached_btree_nodes_read()
530 i->iter++; in bch2_cached_btree_nodes_read()
534 --i->buf.atomic; in bch2_cached_btree_nodes_read()
538 if (i->buf.allocation_failure) in bch2_cached_btree_nodes_read()
539 ret = -ENOMEM; in bch2_cached_btree_nodes_read()
544 return ret ?: i->ret; in bch2_cached_btree_nodes_read()
551 .read = bch2_cached_btree_nodes_read,
562 cmp(pos, pos->next) > 0) { in list_sort()
563 struct list_head *pos2, *next = pos->next; in list_sort()
583 struct dump_iter *i = file->private_data; in bch2_btree_transactions_read()
584 struct bch_fs *c = i->c; in bch2_btree_transactions_read()
588 i->ubuf = buf; in bch2_btree_transactions_read()
589 i->size = size; in bch2_btree_transactions_read()
590 i->ret = 0; in bch2_btree_transactions_read()
592 seqmutex_lock(&c->btree_trans_lock); in bch2_btree_transactions_read()
593 list_sort(&c->btree_trans_list, list_ptr_order_cmp); in bch2_btree_transactions_read()
595 list_for_each_entry(trans, &c->btree_trans_list, list) { in bch2_btree_transactions_read()
596 if ((ulong) trans <= i->iter) in bch2_btree_transactions_read()
599 i->iter = (ulong) trans; in bch2_btree_transactions_read()
601 if (!closure_get_not_zero(&trans->ref)) in bch2_btree_transactions_read()
604 u32 seq = seqmutex_unlock(&c->btree_trans_lock); in bch2_btree_transactions_read()
606 bch2_btree_trans_to_text(&i->buf, trans); in bch2_btree_transactions_read()
608 prt_printf(&i->buf, "backtrace:\n"); in bch2_btree_transactions_read()
609 printbuf_indent_add(&i->buf, 2); in bch2_btree_transactions_read()
610 bch2_prt_task_backtrace(&i->buf, trans->locking_wait.task, 0, GFP_KERNEL); in bch2_btree_transactions_read()
611 printbuf_indent_sub(&i->buf, 2); in bch2_btree_transactions_read()
612 prt_newline(&i->buf); in bch2_btree_transactions_read()
614 closure_put(&trans->ref); in bch2_btree_transactions_read()
620 if (!seqmutex_relock(&c->btree_trans_lock, seq)) in bch2_btree_transactions_read()
623 seqmutex_unlock(&c->btree_trans_lock); in bch2_btree_transactions_read()
625 if (i->buf.allocation_failure) in bch2_btree_transactions_read()
626 ret = -ENOMEM; in bch2_btree_transactions_read()
631 return ret ?: i->ret; in bch2_btree_transactions_read()
638 .read = bch2_btree_transactions_read,
644 struct dump_iter *i = file->private_data; in bch2_journal_pins_read()
645 struct bch_fs *c = i->c; in bch2_journal_pins_read()
649 i->ubuf = buf; in bch2_journal_pins_read()
650 i->size = size; in bch2_journal_pins_read()
651 i->ret = 0; in bch2_journal_pins_read()
658 if (!i->size) in bch2_journal_pins_read()
664 done = bch2_journal_seq_pins_to_text(&i->buf, &c->journal, &i->iter); in bch2_journal_pins_read()
665 i->iter++; in bch2_journal_pins_read()
668 if (i->buf.allocation_failure) in bch2_journal_pins_read()
669 return -ENOMEM; in bch2_journal_pins_read()
671 return i->ret; in bch2_journal_pins_read()
678 .read = bch2_journal_pins_read,
684 struct dump_iter *i = file->private_data; in bch2_btree_updates_read()
685 struct bch_fs *c = i->c; in bch2_btree_updates_read()
688 i->ubuf = buf; in bch2_btree_updates_read()
689 i->size = size; in bch2_btree_updates_read()
690 i->ret = 0; in bch2_btree_updates_read()
692 if (!i->iter) { in bch2_btree_updates_read()
693 bch2_btree_updates_to_text(&i->buf, c); in bch2_btree_updates_read()
694 i->iter++; in bch2_btree_updates_read()
701 if (i->buf.allocation_failure) in bch2_btree_updates_read()
702 return -ENOMEM; in bch2_btree_updates_read()
704 return i->ret; in bch2_btree_updates_read()
711 .read = bch2_btree_updates_read,
716 struct bch_fs *c = inode->i_private; in btree_transaction_stats_open()
721 return -ENOMEM; in btree_transaction_stats_open()
723 i->iter = 1; in btree_transaction_stats_open()
724 i->c = c; in btree_transaction_stats_open()
725 i->buf = PRINTBUF; in btree_transaction_stats_open()
726 file->private_data = i; in btree_transaction_stats_open()
733 struct dump_iter *i = file->private_data; in btree_transaction_stats_release()
735 printbuf_exit(&i->buf); in btree_transaction_stats_release()
744 struct dump_iter *i = file->private_data; in btree_transaction_stats_read()
745 struct bch_fs *c = i->c; in btree_transaction_stats_read()
748 i->ubuf = buf; in btree_transaction_stats_read()
749 i->size = size; in btree_transaction_stats_read()
750 i->ret = 0; in btree_transaction_stats_read()
753 struct btree_transaction_stats *s = &c->btree_transaction_stats[i->iter]; in btree_transaction_stats_read()
759 if (!i->size) in btree_transaction_stats_read()
762 if (i->iter == ARRAY_SIZE(bch2_btree_transaction_fns) || in btree_transaction_stats_read()
763 !bch2_btree_transaction_fns[i->iter]) in btree_transaction_stats_read()
766 prt_printf(&i->buf, "%s:\n", bch2_btree_transaction_fns[i->iter]); in btree_transaction_stats_read()
767 printbuf_indent_add(&i->buf, 2); in btree_transaction_stats_read()
769 mutex_lock(&s->lock); in btree_transaction_stats_read()
771 prt_printf(&i->buf, "Max mem used: %u\n", s->max_mem); in btree_transaction_stats_read()
772 prt_printf(&i->buf, "Transaction duration:\n"); in btree_transaction_stats_read()
774 printbuf_indent_add(&i->buf, 2); in btree_transaction_stats_read()
775 bch2_time_stats_to_text(&i->buf, &s->duration); in btree_transaction_stats_read()
776 printbuf_indent_sub(&i->buf, 2); in btree_transaction_stats_read()
779 prt_printf(&i->buf, "Lock hold times:\n"); in btree_transaction_stats_read()
781 printbuf_indent_add(&i->buf, 2); in btree_transaction_stats_read()
782 bch2_time_stats_to_text(&i->buf, &s->lock_hold_times); in btree_transaction_stats_read()
783 printbuf_indent_sub(&i->buf, 2); in btree_transaction_stats_read()
786 if (s->max_paths_text) { in btree_transaction_stats_read()
787 prt_printf(&i->buf, "Maximum allocated btree paths (%u):\n", s->nr_max_paths); in btree_transaction_stats_read()
789 printbuf_indent_add(&i->buf, 2); in btree_transaction_stats_read()
790 prt_str_indented(&i->buf, s->max_paths_text); in btree_transaction_stats_read()
791 printbuf_indent_sub(&i->buf, 2); in btree_transaction_stats_read()
794 mutex_unlock(&s->lock); in btree_transaction_stats_read()
796 printbuf_indent_sub(&i->buf, 2); in btree_transaction_stats_read()
797 prt_newline(&i->buf); in btree_transaction_stats_read()
798 i->iter++; in btree_transaction_stats_read()
801 if (i->buf.allocation_failure) in btree_transaction_stats_read()
802 return -ENOMEM; in btree_transaction_stats_read()
804 return i->ret; in btree_transaction_stats_read()
811 .read = btree_transaction_stats_read,
815 static void btree_deadlock_to_text(struct printbuf *out, struct bch_fs *c) in btree_deadlock_to_text() argument
820 seqmutex_lock(&c->btree_trans_lock); in btree_deadlock_to_text()
821 list_sort(&c->btree_trans_list, list_ptr_order_cmp); in btree_deadlock_to_text()
823 list_for_each_entry(trans, &c->btree_trans_list, list) { in btree_deadlock_to_text()
829 if (!closure_get_not_zero(&trans->ref)) in btree_deadlock_to_text()
832 u32 seq = seqmutex_unlock(&c->btree_trans_lock); in btree_deadlock_to_text()
834 bool found = bch2_check_for_deadlock(trans, out) != 0; in btree_deadlock_to_text()
836 closure_put(&trans->ref); in btree_deadlock_to_text()
841 if (!seqmutex_relock(&c->btree_trans_lock, seq)) in btree_deadlock_to_text()
844 seqmutex_unlock(&c->btree_trans_lock); in btree_deadlock_to_text()
850 struct dump_iter *i = file->private_data; in bch2_btree_deadlock_read()
851 struct bch_fs *c = i->c; in bch2_btree_deadlock_read()
854 i->ubuf = buf; in bch2_btree_deadlock_read()
855 i->size = size; in bch2_btree_deadlock_read()
856 i->ret = 0; in bch2_btree_deadlock_read()
858 if (!i->iter) { in bch2_btree_deadlock_read()
859 btree_deadlock_to_text(&i->buf, c); in bch2_btree_deadlock_read()
860 i->iter++; in bch2_btree_deadlock_read()
863 if (i->buf.allocation_failure) in bch2_btree_deadlock_read()
864 ret = -ENOMEM; in bch2_btree_deadlock_read()
869 return ret ?: i->ret; in bch2_btree_deadlock_read()
876 .read = bch2_btree_deadlock_read,
881 if (!IS_ERR_OR_NULL(c->fs_debug_dir)) in bch2_fs_debug_exit()
882 debugfs_remove_recursive(c->fs_debug_dir); in bch2_fs_debug_exit()
889 d = debugfs_create_dir(bch2_btree_id_str(bd->id), c->btree_debug_dir); in bch2_fs_debug_btree_init()
895 debugfs_create_file("bfloat-failed", 0400, d, bd, in bch2_fs_debug_btree_init()
907 snprintf(name, sizeof(name), "%pU", c->sb.user_uuid.b); in bch2_fs_debug_init()
908 c->fs_debug_dir = debugfs_create_dir(name, bch_debug); in bch2_fs_debug_init()
909 if (IS_ERR_OR_NULL(c->fs_debug_dir)) in bch2_fs_debug_init()
912 debugfs_create_file("cached_btree_nodes", 0400, c->fs_debug_dir, in bch2_fs_debug_init()
913 c->btree_debug, &cached_btree_nodes_ops); in bch2_fs_debug_init()
915 debugfs_create_file("btree_transactions", 0400, c->fs_debug_dir, in bch2_fs_debug_init()
916 c->btree_debug, &btree_transactions_ops); in bch2_fs_debug_init()
918 debugfs_create_file("journal_pins", 0400, c->fs_debug_dir, in bch2_fs_debug_init()
919 c->btree_debug, &journal_pins_ops); in bch2_fs_debug_init()
921 debugfs_create_file("btree_updates", 0400, c->fs_debug_dir, in bch2_fs_debug_init()
922 c->btree_debug, &btree_updates_ops); in bch2_fs_debug_init()
924 debugfs_create_file("btree_transaction_stats", 0400, c->fs_debug_dir, in bch2_fs_debug_init()
927 debugfs_create_file("btree_deadlock", 0400, c->fs_debug_dir, in bch2_fs_debug_init()
928 c->btree_debug, &btree_deadlock_ops); in bch2_fs_debug_init()
930 c->btree_debug_dir = debugfs_create_dir("btrees", c->fs_debug_dir); in bch2_fs_debug_init()
931 if (IS_ERR_OR_NULL(c->btree_debug_dir)) in bch2_fs_debug_init()
934 for (bd = c->btree_debug; in bch2_fs_debug_init()
935 bd < c->btree_debug + ARRAY_SIZE(c->btree_debug); in bch2_fs_debug_init()
937 bd->id = bd - c->btree_debug; in bch2_fs_debug_init()