#include <linux/kernel.h>
#include <linux/blkdev.h>
#include <linux/debugfs.h>
#include <linux/blk-mq.h>
#include "blk-mq-debugfs.h"
static void print_stat(struct seq_file *m, struct blk_rq_stat *stat)
seq_printf(m, "samples=%d, mean=%lld, min=%llu, max=%llu",
stat->nr_samples, stat->mean, stat->min, stat->max);
seq_puts(m, "samples=0");
static int queue_poll_stat_show(void *data, struct seq_file *m)
struct request_queue *q = data;
for (bucket = 0; bucket < BLK_MQ_POLL_STATS_BKTS/2; bucket++) {
seq_printf(m, "read (%d Bytes): ", 1 << (9+bucket));
print_stat(m, &q->poll_stat[2*bucket]);
seq_printf(m, "write (%d Bytes): ", 1 << (9+bucket));
print_stat(m, &q->poll_stat[2*bucket+1]);
static void *queue_requeue_list_start(struct seq_file *m, loff_t *pos)
__acquires(&q->requeue_lock)
struct request_queue *q = m->private;
spin_lock_irq(&q->requeue_lock);
return seq_list_start(&q->requeue_list, *pos);
static void *queue_requeue_list_next(struct seq_file *m, void *v, loff_t *pos)
struct request_queue *q = m->private;
return seq_list_next(v, &q->requeue_list, pos);
static void queue_requeue_list_stop(struct seq_file *m, void *v)
__releases(&q->requeue_lock)
struct request_queue *q = m->private;
spin_unlock_irq(&q->requeue_lock);
static const struct seq_operations queue_requeue_list_seq_ops = {
.start = queue_requeue_list_start,
.next = queue_requeue_list_next,
.stop = queue_requeue_list_stop,
.show = blk_mq_debugfs_rq_show,
static int blk_flags_show(struct seq_file *m, const unsigned long flags,
const char *const *flag_name, int flag_name_count)
for (i = 0; i < sizeof(flags) * BITS_PER_BYTE; i++) {