Lines Matching refs:buf

175 		struct printbuf buf = PRINTBUF;  in __bch2_btree_verify()  local
177 bch2_bkey_val_to_text(&buf, c, bkey_i_to_s_c(&b->key)); in __bch2_btree_verify()
178 bch2_fs_fatal_error(c, ": btree node verify failed for: %s\n", buf.buf); in __bch2_btree_verify()
179 printbuf_exit(&buf); in __bch2_btree_verify()
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()
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()
347 i->buf = PRINTBUF; in bch2_dump_open()
356 printbuf_exit(&i->buf); in bch2_dump_release()
361 static ssize_t bch2_read_btree(struct file *file, char __user *buf, in bch2_read_btree() argument
366 i->ubuf = buf; 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()
391 static ssize_t bch2_read_btree_formats(struct file *file, char __user *buf, in bch2_read_btree_formats() argument
396 i->ubuf = buf; in bch2_read_btree_formats()
409 bch2_btree_node_to_text(&i->buf, i->c, b); in bch2_read_btree_formats()
425 static ssize_t bch2_read_bfloat_failed(struct file *file, char __user *buf, in bch2_read_bfloat_failed() argument
430 i->ubuf = buf; in bch2_read_bfloat_failed()
445 bch2_btree_node_to_text(&i->buf, i->c, l->b); in bch2_read_bfloat_failed()
449 bch2_bfloat_to_text(&i->buf, l->b, _k); in bch2_read_bfloat_failed()
498 static ssize_t bch2_cached_btree_nodes_read(struct file *file, char __user *buf, in bch2_cached_btree_nodes_read() argument
506 i->ubuf = buf; in bch2_cached_btree_nodes_read()
515 i->buf.atomic++; in bch2_cached_btree_nodes_read()
525 bch2_cached_btree_node_to_text(&i->buf, c, b); 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()
576 static ssize_t bch2_btree_transactions_read(struct file *file, char __user *buf, in bch2_btree_transactions_read() argument
584 i->ubuf = buf; 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()
630 if (i->buf.allocation_failure) in bch2_btree_transactions_read()
646 static ssize_t bch2_journal_pins_read(struct file *file, char __user *buf, in bch2_journal_pins_read() argument
654 i->ubuf = buf; in bch2_journal_pins_read()
669 done = bch2_journal_seq_pins_to_text(&i->buf, &c->journal, &i->iter); in bch2_journal_pins_read()
673 if (i->buf.allocation_failure) in bch2_journal_pins_read()
686 static ssize_t bch2_btree_updates_read(struct file *file, char __user *buf, in bch2_btree_updates_read() argument
693 i->ubuf = buf; in bch2_btree_updates_read()
698 bch2_btree_updates_to_text(&i->buf, c); in bch2_btree_updates_read()
706 if (i->buf.allocation_failure) in bch2_btree_updates_read()
730 i->buf = PRINTBUF; in btree_transaction_stats_open()
740 printbuf_exit(&i->buf); in btree_transaction_stats_release()
746 static ssize_t btree_transaction_stats_read(struct file *file, char __user *buf, in btree_transaction_stats_read() argument
753 i->ubuf = buf; 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()
812 if (i->buf.allocation_failure) in btree_transaction_stats_read()
860 static ssize_t bch2_simple_print(struct file *file, char __user *buf, in bch2_simple_print() argument
868 i->ubuf = buf; in bch2_simple_print()
873 fn(&i->buf, c); in bch2_simple_print()
877 if (i->buf.allocation_failure) in bch2_simple_print()
886 static ssize_t bch2_btree_deadlock_read(struct file *file, char __user *buf, in bch2_btree_deadlock_read() argument
889 return bch2_simple_print(file, buf, size, ppos, btree_deadlock_to_text); in bch2_btree_deadlock_read()
899 static ssize_t bch2_write_points_read(struct file *file, char __user *buf, in bch2_write_points_read() argument
902 return bch2_simple_print(file, buf, size, ppos, bch2_write_points_to_text); in bch2_write_points_read()