Skip to content

Commit

Permalink
blk-mq: export software queue pending map to debugfs
Browse files Browse the repository at this point in the history
This is useful for debugging problems where we've gotten stuck with
requests in the software queues.

Reviewed-by: Hannes Reinecke <[email protected]>
Signed-off-by: Omar Sandoval <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
osandov authored and axboe committed Jan 27, 2017
1 parent 24af1cc commit 0bfa528
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions block/blk-mq-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,26 @@ static const struct file_operations hctx_dispatch_fops = {
.release = seq_release,
};

static int hctx_ctx_map_show(struct seq_file *m, void *v)
{
struct blk_mq_hw_ctx *hctx = m->private;

sbitmap_bitmap_show(&hctx->ctx_map, m);
return 0;
}

static int hctx_ctx_map_open(struct inode *inode, struct file *file)
{
return single_open(file, hctx_ctx_map_show, inode->i_private);
}

static const struct file_operations hctx_ctx_map_fops = {
.open = hctx_ctx_map_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};

static void *ctx_rq_list_start(struct seq_file *m, loff_t *pos)
{
struct blk_mq_ctx *ctx = m->private;
Expand Down Expand Up @@ -179,6 +199,7 @@ static const struct blk_mq_debugfs_attr blk_mq_debugfs_hctx_attrs[] = {
{"state", 0400, &hctx_state_fops},
{"flags", 0400, &hctx_flags_fops},
{"dispatch", 0400, &hctx_dispatch_fops},
{"ctx_map", 0400, &hctx_ctx_map_fops},
};

static const struct blk_mq_debugfs_attr blk_mq_debugfs_ctx_attrs[] = {
Expand Down

0 comments on commit 0bfa528

Please sign in to comment.