Lines Matching refs:i

80 		struct bset *i;  in bch2_btree_verify_replica()  local
93 i = &n_ondisk->keys; in bch2_btree_verify_replica()
99 i = &bne->keys; in bch2_btree_verify_replica()
106 bch2_dump_bset(c, b, i, offset); in bch2_btree_verify_replica()
229 struct bset *i; in bch2_btree_node_ondisk_to_text() local
236 i = &n_ondisk->keys; in bch2_btree_node_ondisk_to_text()
238 if (!bch2_checksum_type_valid(c, BSET_CSUM_TYPE(i))) { in bch2_btree_node_ondisk_to_text()
240 offset, BSET_CSUM_TYPE(i)); in bch2_btree_node_ondisk_to_text()
244 nonce = btree_nonce(i, offset << 9); in bch2_btree_node_ondisk_to_text()
245 csum = csum_vstruct(c, BSET_CSUM_TYPE(i), nonce, n_ondisk); in bch2_btree_node_ondisk_to_text()
252 bset_encrypt(c, i, offset << 9); in bch2_btree_node_ondisk_to_text()
258 i = &bne->keys; in bch2_btree_node_ondisk_to_text()
260 if (i->seq != n_ondisk->keys.seq) in bch2_btree_node_ondisk_to_text()
263 if (!bch2_checksum_type_valid(c, BSET_CSUM_TYPE(i))) { in bch2_btree_node_ondisk_to_text()
265 offset, BSET_CSUM_TYPE(i)); in bch2_btree_node_ondisk_to_text()
269 nonce = btree_nonce(i, offset << 9); in bch2_btree_node_ondisk_to_text()
270 csum = csum_vstruct(c, BSET_CSUM_TYPE(i), nonce, bne); in bch2_btree_node_ondisk_to_text()
277 bset_encrypt(c, i, offset << 9); in bch2_btree_node_ondisk_to_text()
284 le16_to_cpu(i->version), in bch2_btree_node_ondisk_to_text()
285 le64_to_cpu(i->journal_seq)); in bch2_btree_node_ondisk_to_text()
290 for (k = i->start; k != vstruct_last(i); k = bkey_p_next(k)) { in bch2_btree_node_ondisk_to_text()
309 ssize_t bch2_debugfs_flush_buf(struct dump_iter *i) in bch2_debugfs_flush_buf() argument
311 if (i->buf.pos) { in bch2_debugfs_flush_buf()
312 size_t bytes = min_t(size_t, i->buf.pos, i->size); in bch2_debugfs_flush_buf()
313 int copied = bytes - copy_to_user(i->ubuf, i->buf.buf, bytes); in bch2_debugfs_flush_buf()
315 i->ret += copied; in bch2_debugfs_flush_buf()
316 i->ubuf += copied; in bch2_debugfs_flush_buf()
317 i->size -= copied; in bch2_debugfs_flush_buf()
318 i->buf.pos -= copied; in bch2_debugfs_flush_buf()
319 memmove(i->buf.buf, i->buf.buf + copied, i->buf.pos); in bch2_debugfs_flush_buf()
321 if (i->buf.last_newline >= copied) in bch2_debugfs_flush_buf()
322 i->buf.last_newline -= copied; in bch2_debugfs_flush_buf()
323 if (i->buf.last_field >= copied) in bch2_debugfs_flush_buf()
324 i->buf.last_field -= copied; in bch2_debugfs_flush_buf()
330 return i->size ? 0 : i->ret; in bch2_debugfs_flush_buf()
336 struct dump_iter *i; in bch2_dump_open() local
338 i = kzalloc(sizeof(struct dump_iter), GFP_KERNEL); in bch2_dump_open()
339 if (!i) in bch2_dump_open()
342 file->private_data = i; in bch2_dump_open()
343 i->from = POS_MIN; in bch2_dump_open()
344 i->iter = 0; in bch2_dump_open()
345 i->c = container_of(bd, struct bch_fs, btree_debug[bd->id]); in bch2_dump_open()
346 i->id = bd->id; in bch2_dump_open()
347 i->buf = PRINTBUF; in bch2_dump_open()
354 struct dump_iter *i = file->private_data; in bch2_dump_release() local
356 printbuf_exit(&i->buf); in bch2_dump_release()
357 kfree(i); in bch2_dump_release()
364 struct dump_iter *i = file->private_data; in bch2_read_btree() local
366 i->ubuf = buf; in bch2_read_btree()
367 i->size = size; in bch2_read_btree()
368 i->ret = 0; in bch2_read_btree()
370 return bch2_debugfs_flush_buf(i) ?: in bch2_read_btree()
371 bch2_trans_run(i->c, in bch2_read_btree()
372 for_each_btree_key(trans, iter, i->id, i->from, in bch2_read_btree()
375 bch2_bkey_val_to_text(&i->buf, i->c, k); in bch2_read_btree()
376 prt_newline(&i->buf); in bch2_read_btree()
378 i->from = bpos_successor(iter.pos); in bch2_read_btree()
379 bch2_debugfs_flush_buf(i); in bch2_read_btree()
381 i->ret; in bch2_read_btree()
394 struct dump_iter *i = file->private_data; in bch2_read_btree_formats() local
396 i->ubuf = buf; in bch2_read_btree_formats()
397 i->size = size; in bch2_read_btree_formats()
398 i->ret = 0; in bch2_read_btree_formats()
400 ssize_t ret = bch2_debugfs_flush_buf(i); in bch2_read_btree_formats()
404 if (bpos_eq(SPOS_MAX, i->from)) in bch2_read_btree_formats()
405 return i->ret; in bch2_read_btree_formats()
407 return bch2_trans_run(i->c, in bch2_read_btree_formats()
408 for_each_btree_node(trans, iter, i->id, i->from, 0, b, ({ in bch2_read_btree_formats()
409 bch2_btree_node_to_text(&i->buf, i->c, b); in bch2_read_btree_formats()
410 i->from = !bpos_eq(SPOS_MAX, b->key.k.p) in bch2_read_btree_formats()
414 drop_locks_do(trans, bch2_debugfs_flush_buf(i)); in bch2_read_btree_formats()
415 }))) ?: i->ret; in bch2_read_btree_formats()
428 struct dump_iter *i = file->private_data; in bch2_read_bfloat_failed() local
430 i->ubuf = buf; in bch2_read_bfloat_failed()
431 i->size = size; in bch2_read_bfloat_failed()
432 i->ret = 0; in bch2_read_bfloat_failed()
434 return bch2_debugfs_flush_buf(i) ?: in bch2_read_bfloat_failed()
435 bch2_trans_run(i->c, in bch2_read_bfloat_failed()
436 for_each_btree_key(trans, iter, i->id, i->from, in bch2_read_bfloat_failed()
444 if (bpos_gt(l->b->key.k.p, i->prev_node)) { in bch2_read_bfloat_failed()
445 bch2_btree_node_to_text(&i->buf, i->c, l->b); in bch2_read_bfloat_failed()
446 i->prev_node = l->b->key.k.p; in bch2_read_bfloat_failed()
449 bch2_bfloat_to_text(&i->buf, l->b, _k); in bch2_read_bfloat_failed()
451 i->from = bpos_successor(iter.pos); in bch2_read_bfloat_failed()
452 bch2_debugfs_flush_buf(i); in bch2_read_bfloat_failed()
454 i->ret; in bch2_read_bfloat_failed()
501 struct dump_iter *i = file->private_data; in bch2_cached_btree_nodes_read() local
502 struct bch_fs *c = i->c; in bch2_cached_btree_nodes_read()
506 i->ubuf = buf; in bch2_cached_btree_nodes_read()
507 i->size = size; in bch2_cached_btree_nodes_read()
508 i->ret = 0; in bch2_cached_btree_nodes_read()
511 ret = bch2_debugfs_flush_buf(i); in bch2_cached_btree_nodes_read()
515 i->buf.atomic++; in bch2_cached_btree_nodes_read()
520 if (i->iter < tbl->size) { in bch2_cached_btree_nodes_read()
524 rht_for_each_entry_rcu(b, pos, tbl, i->iter, hash) in bch2_cached_btree_nodes_read()
525 bch2_cached_btree_node_to_text(&i->buf, c, b); in bch2_cached_btree_nodes_read()
526 i->iter++; in bch2_cached_btree_nodes_read()
531 --i->buf.atomic; in bch2_cached_btree_nodes_read()
534 if (i->buf.allocation_failure) in bch2_cached_btree_nodes_read()
538 ret = bch2_debugfs_flush_buf(i); in bch2_cached_btree_nodes_read()
540 return ret ?: i->ret; in bch2_cached_btree_nodes_read()
579 struct dump_iter *i = file->private_data; in bch2_btree_transactions_read() local
580 struct bch_fs *c = i->c; in bch2_btree_transactions_read()
584 i->ubuf = buf; in bch2_btree_transactions_read()
585 i->size = size; in bch2_btree_transactions_read()
586 i->ret = 0; in bch2_btree_transactions_read()
594 if ((ulong) trans <= i->iter) in bch2_btree_transactions_read()
597 i->iter = (ulong) trans; in bch2_btree_transactions_read()
609 bch2_btree_trans_to_text(&i->buf, trans); in bch2_btree_transactions_read()
611 prt_printf(&i->buf, "backtrace:\n"); in bch2_btree_transactions_read()
612 printbuf_indent_add(&i->buf, 2); in bch2_btree_transactions_read()
613 bch2_prt_task_backtrace(&i->buf, trans->locking_wait.task, 0, GFP_KERNEL); in bch2_btree_transactions_read()
614 printbuf_indent_sub(&i->buf, 2); in bch2_btree_transactions_read()
615 prt_newline(&i->buf); in bch2_btree_transactions_read()
619 ret = bch2_debugfs_flush_buf(i); in bch2_btree_transactions_read()
630 if (i->buf.allocation_failure) in bch2_btree_transactions_read()
634 ret = bch2_debugfs_flush_buf(i); in bch2_btree_transactions_read()
636 return ret ?: i->ret; in bch2_btree_transactions_read()
649 struct dump_iter *i = file->private_data; in bch2_journal_pins_read() local
650 struct bch_fs *c = i->c; in bch2_journal_pins_read()
654 i->ubuf = buf; in bch2_journal_pins_read()
655 i->size = size; in bch2_journal_pins_read()
656 i->ret = 0; in bch2_journal_pins_read()
659 err = bch2_debugfs_flush_buf(i); in bch2_journal_pins_read()
663 if (!i->size) in bch2_journal_pins_read()
669 done = bch2_journal_seq_pins_to_text(&i->buf, &c->journal, &i->iter); in bch2_journal_pins_read()
670 i->iter++; in bch2_journal_pins_read()
673 if (i->buf.allocation_failure) in bch2_journal_pins_read()
676 return i->ret; in bch2_journal_pins_read()
689 struct dump_iter *i = file->private_data; in bch2_btree_updates_read() local
690 struct bch_fs *c = i->c; in bch2_btree_updates_read()
693 i->ubuf = buf; in bch2_btree_updates_read()
694 i->size = size; in bch2_btree_updates_read()
695 i->ret = 0; in bch2_btree_updates_read()
697 if (!i->iter) { in bch2_btree_updates_read()
698 bch2_btree_updates_to_text(&i->buf, c); in bch2_btree_updates_read()
699 i->iter++; in bch2_btree_updates_read()
702 err = bch2_debugfs_flush_buf(i); in bch2_btree_updates_read()
706 if (i->buf.allocation_failure) in bch2_btree_updates_read()
709 return i->ret; in bch2_btree_updates_read()
722 struct dump_iter *i; in btree_transaction_stats_open() local
724 i = kzalloc(sizeof(struct dump_iter), GFP_KERNEL); in btree_transaction_stats_open()
725 if (!i) in btree_transaction_stats_open()
728 i->iter = 1; in btree_transaction_stats_open()
729 i->c = c; in btree_transaction_stats_open()
730 i->buf = PRINTBUF; in btree_transaction_stats_open()
731 file->private_data = i; in btree_transaction_stats_open()
738 struct dump_iter *i = file->private_data; in btree_transaction_stats_release() local
740 printbuf_exit(&i->buf); in btree_transaction_stats_release()
741 kfree(i); in btree_transaction_stats_release()
749 struct dump_iter *i = file->private_data; in btree_transaction_stats_read() local
750 struct bch_fs *c = i->c; in btree_transaction_stats_read()
753 i->ubuf = buf; in btree_transaction_stats_read()
754 i->size = size; in btree_transaction_stats_read()
755 i->ret = 0; in btree_transaction_stats_read()
758 struct btree_transaction_stats *s = &c->btree_transaction_stats[i->iter]; in btree_transaction_stats_read()
760 err = bch2_debugfs_flush_buf(i); in btree_transaction_stats_read()
764 if (!i->size) in btree_transaction_stats_read()
767 if (i->iter == ARRAY_SIZE(bch2_btree_transaction_fns) || in btree_transaction_stats_read()
768 !bch2_btree_transaction_fns[i->iter]) in btree_transaction_stats_read()
771 prt_printf(&i->buf, "%s:\n", bch2_btree_transaction_fns[i->iter]); in btree_transaction_stats_read()
772 printbuf_indent_add(&i->buf, 2); in btree_transaction_stats_read()
776 prt_printf(&i->buf, "Max mem used: %u\n", s->max_mem); in btree_transaction_stats_read()
778 printbuf_indent_add(&i->buf, 2); in btree_transaction_stats_read()
779 bch2_trans_kmalloc_trace_to_text(&i->buf, &s->trans_kmalloc_trace); in btree_transaction_stats_read()
780 printbuf_indent_sub(&i->buf, 2); in btree_transaction_stats_read()
783 prt_printf(&i->buf, "Transaction duration:\n"); in btree_transaction_stats_read()
785 printbuf_indent_add(&i->buf, 2); in btree_transaction_stats_read()
786 bch2_time_stats_to_text(&i->buf, &s->duration); in btree_transaction_stats_read()
787 printbuf_indent_sub(&i->buf, 2); in btree_transaction_stats_read()
790 prt_printf(&i->buf, "Lock hold times:\n"); in btree_transaction_stats_read()
792 printbuf_indent_add(&i->buf, 2); in btree_transaction_stats_read()
793 bch2_time_stats_to_text(&i->buf, &s->lock_hold_times); in btree_transaction_stats_read()
794 printbuf_indent_sub(&i->buf, 2); in btree_transaction_stats_read()
798 prt_printf(&i->buf, "Maximum allocated btree paths (%u):\n", s->nr_max_paths); in btree_transaction_stats_read()
800 printbuf_indent_add(&i->buf, 2); in btree_transaction_stats_read()
801 prt_str_indented(&i->buf, s->max_paths_text); in btree_transaction_stats_read()
802 printbuf_indent_sub(&i->buf, 2); in btree_transaction_stats_read()
807 printbuf_indent_sub(&i->buf, 2); in btree_transaction_stats_read()
808 prt_newline(&i->buf); in btree_transaction_stats_read()
809 i->iter++; in btree_transaction_stats_read()
812 if (i->buf.allocation_failure) in btree_transaction_stats_read()
815 return i->ret; in btree_transaction_stats_read()
864 struct dump_iter *i = file->private_data; in bch2_simple_print() local
865 struct bch_fs *c = i->c; in bch2_simple_print()
868 i->ubuf = buf; in bch2_simple_print()
869 i->size = size; in bch2_simple_print()
870 i->ret = 0; in bch2_simple_print()
872 if (!i->iter) { in bch2_simple_print()
873 fn(&i->buf, c); in bch2_simple_print()
874 i->iter++; in bch2_simple_print()
877 if (i->buf.allocation_failure) in bch2_simple_print()
881 ret = bch2_debugfs_flush_buf(i); in bch2_simple_print()
883 return ret ?: i->ret; in bch2_simple_print()