Lines Matching full:i
76 struct bset *i; in bch2_btree_verify_replica() local
89 i = &n_ondisk->keys; in bch2_btree_verify_replica()
95 i = &bne->keys; in bch2_btree_verify_replica()
102 bch2_dump_bset(c, b, i, offset); in bch2_btree_verify_replica()
226 struct bset *i; in bch2_btree_node_ondisk_to_text() local
233 i = &n_ondisk->keys; in bch2_btree_node_ondisk_to_text()
235 if (!bch2_checksum_type_valid(c, BSET_CSUM_TYPE(i))) { in bch2_btree_node_ondisk_to_text()
237 offset, BSET_CSUM_TYPE(i)); in bch2_btree_node_ondisk_to_text()
241 nonce = btree_nonce(i, offset << 9); in bch2_btree_node_ondisk_to_text()
242 csum = csum_vstruct(c, BSET_CSUM_TYPE(i), nonce, n_ondisk); in bch2_btree_node_ondisk_to_text()
249 bset_encrypt(c, i, offset << 9); in bch2_btree_node_ondisk_to_text()
255 i = &bne->keys; in bch2_btree_node_ondisk_to_text()
257 if (i->seq != n_ondisk->keys.seq) in bch2_btree_node_ondisk_to_text()
260 if (!bch2_checksum_type_valid(c, BSET_CSUM_TYPE(i))) { in bch2_btree_node_ondisk_to_text()
262 offset, BSET_CSUM_TYPE(i)); in bch2_btree_node_ondisk_to_text()
266 nonce = btree_nonce(i, offset << 9); in bch2_btree_node_ondisk_to_text()
267 csum = csum_vstruct(c, BSET_CSUM_TYPE(i), nonce, bne); in bch2_btree_node_ondisk_to_text()
274 bset_encrypt(c, i, offset << 9); in bch2_btree_node_ondisk_to_text()
281 le16_to_cpu(i->version), in bch2_btree_node_ondisk_to_text()
282 le64_to_cpu(i->journal_seq)); in bch2_btree_node_ondisk_to_text()
287 for (k = i->start; k != vstruct_last(i); k = bkey_p_next(k)) { in bch2_btree_node_ondisk_to_text()
321 static ssize_t flush_buf(struct dump_iter *i) in flush_buf() argument
323 if (i->buf.pos) { in flush_buf()
324 size_t bytes = min_t(size_t, i->buf.pos, i->size); in flush_buf()
325 int copied = bytes - copy_to_user(i->ubuf, i->buf.buf, bytes); in flush_buf()
327 i->ret += copied; in flush_buf()
328 i->ubuf += copied; in flush_buf()
329 i->size -= copied; in flush_buf()
330 i->buf.pos -= copied; in flush_buf()
331 memmove(i->buf.buf, i->buf.buf + copied, i->buf.pos); in flush_buf()
337 return i->size ? 0 : i->ret; in flush_buf()
343 struct dump_iter *i; in bch2_dump_open() local
345 i = kzalloc(sizeof(struct dump_iter), GFP_KERNEL); in bch2_dump_open()
346 if (!i) in bch2_dump_open()
349 file->private_data = i; in bch2_dump_open()
350 i->from = POS_MIN; in bch2_dump_open()
351 i->iter = 0; in bch2_dump_open()
352 i->c = container_of(bd, struct bch_fs, btree_debug[bd->id]); in bch2_dump_open()
353 i->id = bd->id; in bch2_dump_open()
354 i->buf = PRINTBUF; in bch2_dump_open()
361 struct dump_iter *i = file->private_data; in bch2_dump_release() local
363 printbuf_exit(&i->buf); in bch2_dump_release()
364 kfree(i); in bch2_dump_release()
371 struct dump_iter *i = file->private_data; in bch2_read_btree() local
373 i->ubuf = buf; in bch2_read_btree()
374 i->size = size; in bch2_read_btree()
375 i->ret = 0; in bch2_read_btree()
377 return flush_buf(i) ?: in bch2_read_btree()
378 bch2_trans_run(i->c, in bch2_read_btree()
379 for_each_btree_key(trans, iter, i->id, i->from, in bch2_read_btree()
382 bch2_bkey_val_to_text(&i->buf, i->c, k); in bch2_read_btree()
383 prt_newline(&i->buf); in bch2_read_btree()
385 i->from = bpos_successor(iter.pos); in bch2_read_btree()
386 flush_buf(i); in bch2_read_btree()
388 i->ret; in bch2_read_btree()
401 struct dump_iter *i = file->private_data; in bch2_read_btree_formats() local
403 i->ubuf = buf; in bch2_read_btree_formats()
404 i->size = size; in bch2_read_btree_formats()
405 i->ret = 0; in bch2_read_btree_formats()
407 ssize_t ret = flush_buf(i); in bch2_read_btree_formats()
411 if (bpos_eq(SPOS_MAX, i->from)) in bch2_read_btree_formats()
412 return i->ret; in bch2_read_btree_formats()
414 return bch2_trans_run(i->c, in bch2_read_btree_formats()
415 for_each_btree_node(trans, iter, i->id, i->from, 0, b, ({ in bch2_read_btree_formats()
416 bch2_btree_node_to_text(&i->buf, i->c, b); in bch2_read_btree_formats()
417 i->from = !bpos_eq(SPOS_MAX, b->key.k.p) in bch2_read_btree_formats()
421 drop_locks_do(trans, flush_buf(i)); in bch2_read_btree_formats()
422 }))) ?: i->ret; in bch2_read_btree_formats()
435 struct dump_iter *i = file->private_data; in bch2_read_bfloat_failed() local
437 i->ubuf = buf; in bch2_read_bfloat_failed()
438 i->size = size; in bch2_read_bfloat_failed()
439 i->ret = 0; in bch2_read_bfloat_failed()
441 return flush_buf(i) ?: in bch2_read_bfloat_failed()
442 bch2_trans_run(i->c, in bch2_read_bfloat_failed()
443 for_each_btree_key(trans, iter, i->id, i->from, in bch2_read_bfloat_failed()
451 if (bpos_gt(l->b->key.k.p, i->prev_node)) { in bch2_read_bfloat_failed()
452 bch2_btree_node_to_text(&i->buf, i->c, l->b); in bch2_read_bfloat_failed()
453 i->prev_node = l->b->key.k.p; in bch2_read_bfloat_failed()
456 bch2_bfloat_to_text(&i->buf, l->b, _k); in bch2_read_bfloat_failed()
458 i->from = bpos_successor(iter.pos); in bch2_read_bfloat_failed()
459 flush_buf(i); in bch2_read_bfloat_failed()
461 i->ret; in bch2_read_bfloat_failed()
506 struct dump_iter *i = file->private_data; in bch2_cached_btree_nodes_read() local
507 struct bch_fs *c = i->c; in bch2_cached_btree_nodes_read()
511 i->ubuf = buf; in bch2_cached_btree_nodes_read()
512 i->size = size; in bch2_cached_btree_nodes_read()
513 i->ret = 0; in bch2_cached_btree_nodes_read()
520 ret = flush_buf(i); in bch2_cached_btree_nodes_read()
525 i->buf.atomic++; in bch2_cached_btree_nodes_read()
528 if (i->iter < tbl->size) { in bch2_cached_btree_nodes_read()
529 rht_for_each_entry_rcu(b, pos, tbl, i->iter, hash) in bch2_cached_btree_nodes_read()
530 bch2_cached_btree_node_to_text(&i->buf, c, b); in bch2_cached_btree_nodes_read()
531 i->iter++; in bch2_cached_btree_nodes_read()
535 --i->buf.atomic; in bch2_cached_btree_nodes_read()
539 if (i->buf.allocation_failure) in bch2_cached_btree_nodes_read()
543 ret = flush_buf(i); in bch2_cached_btree_nodes_read()
545 return ret ?: i->ret; in bch2_cached_btree_nodes_read()
584 struct dump_iter *i = file->private_data; in bch2_btree_transactions_read() local
585 struct bch_fs *c = i->c; in bch2_btree_transactions_read()
589 i->ubuf = buf; in bch2_btree_transactions_read()
590 i->size = size; in bch2_btree_transactions_read()
591 i->ret = 0; in bch2_btree_transactions_read()
597 if ((ulong) trans <= i->iter) in bch2_btree_transactions_read()
600 i->iter = (ulong) trans; in bch2_btree_transactions_read()
607 bch2_btree_trans_to_text(&i->buf, trans); in bch2_btree_transactions_read()
609 prt_printf(&i->buf, "backtrace:\n"); in bch2_btree_transactions_read()
610 printbuf_indent_add(&i->buf, 2); in bch2_btree_transactions_read()
611 bch2_prt_task_backtrace(&i->buf, trans->locking_wait.task, 0, GFP_KERNEL); in bch2_btree_transactions_read()
612 printbuf_indent_sub(&i->buf, 2); in bch2_btree_transactions_read()
613 prt_newline(&i->buf); in bch2_btree_transactions_read()
617 ret = flush_buf(i); in bch2_btree_transactions_read()
626 if (i->buf.allocation_failure) in bch2_btree_transactions_read()
630 ret = flush_buf(i); in bch2_btree_transactions_read()
632 return ret ?: i->ret; in bch2_btree_transactions_read()
645 struct dump_iter *i = file->private_data; in bch2_journal_pins_read() local
646 struct bch_fs *c = i->c; in bch2_journal_pins_read()
650 i->ubuf = buf; in bch2_journal_pins_read()
651 i->size = size; in bch2_journal_pins_read()
652 i->ret = 0; in bch2_journal_pins_read()
655 err = flush_buf(i); in bch2_journal_pins_read()
659 if (!i->size) in bch2_journal_pins_read()
665 done = bch2_journal_seq_pins_to_text(&i->buf, &c->journal, &i->iter); in bch2_journal_pins_read()
666 i->iter++; in bch2_journal_pins_read()
669 if (i->buf.allocation_failure) in bch2_journal_pins_read()
672 return i->ret; in bch2_journal_pins_read()
685 struct dump_iter *i = file->private_data; in bch2_btree_updates_read() local
686 struct bch_fs *c = i->c; in bch2_btree_updates_read()
689 i->ubuf = buf; in bch2_btree_updates_read()
690 i->size = size; in bch2_btree_updates_read()
691 i->ret = 0; in bch2_btree_updates_read()
693 if (!i->iter) { in bch2_btree_updates_read()
694 bch2_btree_updates_to_text(&i->buf, c); in bch2_btree_updates_read()
695 i->iter++; in bch2_btree_updates_read()
698 err = flush_buf(i); in bch2_btree_updates_read()
702 if (i->buf.allocation_failure) in bch2_btree_updates_read()
705 return i->ret; in bch2_btree_updates_read()
718 struct dump_iter *i; in btree_transaction_stats_open() local
720 i = kzalloc(sizeof(struct dump_iter), GFP_KERNEL); in btree_transaction_stats_open()
721 if (!i) in btree_transaction_stats_open()
724 i->iter = 1; in btree_transaction_stats_open()
725 i->c = c; in btree_transaction_stats_open()
726 i->buf = PRINTBUF; in btree_transaction_stats_open()
727 file->private_data = i; in btree_transaction_stats_open()
734 struct dump_iter *i = file->private_data; in btree_transaction_stats_release() local
736 printbuf_exit(&i->buf); in btree_transaction_stats_release()
737 kfree(i); in btree_transaction_stats_release()
745 struct dump_iter *i = file->private_data; in btree_transaction_stats_read() local
746 struct bch_fs *c = i->c; in btree_transaction_stats_read()
749 i->ubuf = buf; in btree_transaction_stats_read()
750 i->size = size; in btree_transaction_stats_read()
751 i->ret = 0; in btree_transaction_stats_read()
754 struct btree_transaction_stats *s = &c->btree_transaction_stats[i->iter]; in btree_transaction_stats_read()
756 err = flush_buf(i); in btree_transaction_stats_read()
760 if (!i->size) in btree_transaction_stats_read()
763 if (i->iter == ARRAY_SIZE(bch2_btree_transaction_fns) || in btree_transaction_stats_read()
764 !bch2_btree_transaction_fns[i->iter]) in btree_transaction_stats_read()
767 prt_printf(&i->buf, "%s:\n", bch2_btree_transaction_fns[i->iter]); in btree_transaction_stats_read()
768 printbuf_indent_add(&i->buf, 2); in btree_transaction_stats_read()
772 prt_printf(&i->buf, "Max mem used: %u\n", s->max_mem); in btree_transaction_stats_read()
773 prt_printf(&i->buf, "Transaction duration:\n"); in btree_transaction_stats_read()
775 printbuf_indent_add(&i->buf, 2); in btree_transaction_stats_read()
776 bch2_time_stats_to_text(&i->buf, &s->duration); in btree_transaction_stats_read()
777 printbuf_indent_sub(&i->buf, 2); in btree_transaction_stats_read()
780 prt_printf(&i->buf, "Lock hold times:\n"); in btree_transaction_stats_read()
782 printbuf_indent_add(&i->buf, 2); in btree_transaction_stats_read()
783 bch2_time_stats_to_text(&i->buf, &s->lock_hold_times); in btree_transaction_stats_read()
784 printbuf_indent_sub(&i->buf, 2); in btree_transaction_stats_read()
788 prt_printf(&i->buf, "Maximum allocated btree paths (%u):\n", s->nr_max_paths); in btree_transaction_stats_read()
790 printbuf_indent_add(&i->buf, 2); in btree_transaction_stats_read()
791 prt_str_indented(&i->buf, s->max_paths_text); in btree_transaction_stats_read()
792 printbuf_indent_sub(&i->buf, 2); in btree_transaction_stats_read()
797 printbuf_indent_sub(&i->buf, 2); in btree_transaction_stats_read()
798 prt_newline(&i->buf); in btree_transaction_stats_read()
799 i->iter++; in btree_transaction_stats_read()
802 if (i->buf.allocation_failure) in btree_transaction_stats_read()
805 return i->ret; in btree_transaction_stats_read()
854 struct dump_iter *i = file->private_data; in bch2_simple_print() local
855 struct bch_fs *c = i->c; in bch2_simple_print()
858 i->ubuf = buf; in bch2_simple_print()
859 i->size = size; in bch2_simple_print()
860 i->ret = 0; in bch2_simple_print()
862 if (!i->iter) { in bch2_simple_print()
863 fn(&i->buf, c); in bch2_simple_print()
864 i->iter++; in bch2_simple_print()
867 if (i->buf.allocation_failure) in bch2_simple_print()
871 ret = flush_buf(i); in bch2_simple_print()
873 return ret ?: i->ret; in bch2_simple_print()