]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - block/blk-mq-debugfs.c
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
[linux.git] / block / blk-mq-debugfs.c
index 2793e91bc7a42a74b2256e949b56a98c25f65a96..90d68760af086bd6de78c71dc4a1f6954ceb7a5b 100644 (file)
@@ -447,6 +447,21 @@ static int hctx_busy_show(void *data, struct seq_file *m)
        return 0;
 }
 
+static const char *const hctx_types[] = {
+       [HCTX_TYPE_DEFAULT]     = "default",
+       [HCTX_TYPE_READ]        = "read",
+       [HCTX_TYPE_POLL]        = "poll",
+};
+
+static int hctx_type_show(void *data, struct seq_file *m)
+{
+       struct blk_mq_hw_ctx *hctx = data;
+
+       BUILD_BUG_ON(ARRAY_SIZE(hctx_types) != HCTX_MAX_TYPES);
+       seq_printf(m, "%s\n", hctx_types[hctx->type]);
+       return 0;
+}
+
 static int hctx_ctx_map_show(void *data, struct seq_file *m)
 {
        struct blk_mq_hw_ctx *hctx = data;
@@ -637,36 +652,43 @@ static int hctx_dispatch_busy_show(void *data, struct seq_file *m)
        return 0;
 }
 
-static void *ctx_rq_list_start(struct seq_file *m, loff_t *pos)
-       __acquires(&ctx->lock)
-{
-       struct blk_mq_ctx *ctx = m->private;
-
-       spin_lock(&ctx->lock);
-       return seq_list_start(&ctx->rq_list, *pos);
-}
+#define CTX_RQ_SEQ_OPS(name, type)                                     \
+static void *ctx_##name##_rq_list_start(struct seq_file *m, loff_t *pos) \
+       __acquires(&ctx->lock)                                          \
+{                                                                      \
+       struct blk_mq_ctx *ctx = m->private;                            \
+                                                                       \
+       spin_lock(&ctx->lock);                                          \
+       return seq_list_start(&ctx->rq_lists[type], *pos);              \
+}                                                                      \
+                                                                       \
+static void *ctx_##name##_rq_list_next(struct seq_file *m, void *v,    \
+                                    loff_t *pos)                       \
+{                                                                      \
+       struct blk_mq_ctx *ctx = m->private;                            \
+                                                                       \
+       return seq_list_next(v, &ctx->rq_lists[type], pos);             \
+}                                                                      \
+                                                                       \
+static void ctx_##name##_rq_list_stop(struct seq_file *m, void *v)     \
+       __releases(&ctx->lock)                                          \
+{                                                                      \
+       struct blk_mq_ctx *ctx = m->private;                            \
+                                                                       \
+       spin_unlock(&ctx->lock);                                        \
+}                                                                      \
+                                                                       \
+static const struct seq_operations ctx_##name##_rq_list_seq_ops = {    \
+       .start  = ctx_##name##_rq_list_start,                           \
+       .next   = ctx_##name##_rq_list_next,                            \
+       .stop   = ctx_##name##_rq_list_stop,                            \
+       .show   = blk_mq_debugfs_rq_show,                               \
+}
+
+CTX_RQ_SEQ_OPS(default, HCTX_TYPE_DEFAULT);
+CTX_RQ_SEQ_OPS(read, HCTX_TYPE_READ);
+CTX_RQ_SEQ_OPS(poll, HCTX_TYPE_POLL);
 
-static void *ctx_rq_list_next(struct seq_file *m, void *v, loff_t *pos)
-{
-       struct blk_mq_ctx *ctx = m->private;
-
-       return seq_list_next(v, &ctx->rq_list, pos);
-}
-
-static void ctx_rq_list_stop(struct seq_file *m, void *v)
-       __releases(&ctx->lock)
-{
-       struct blk_mq_ctx *ctx = m->private;
-
-       spin_unlock(&ctx->lock);
-}
-
-static const struct seq_operations ctx_rq_list_seq_ops = {
-       .start  = ctx_rq_list_start,
-       .next   = ctx_rq_list_next,
-       .stop   = ctx_rq_list_stop,
-       .show   = blk_mq_debugfs_rq_show,
-};
 static int ctx_dispatched_show(void *data, struct seq_file *m)
 {
        struct blk_mq_ctx *ctx = data;
@@ -799,11 +821,14 @@ static const struct blk_mq_debugfs_attr blk_mq_debugfs_hctx_attrs[] = {
        {"run", 0600, hctx_run_show, hctx_run_write},
        {"active", 0400, hctx_active_show},
        {"dispatch_busy", 0400, hctx_dispatch_busy_show},
+       {"type", 0400, hctx_type_show},
        {},
 };
 
 static const struct blk_mq_debugfs_attr blk_mq_debugfs_ctx_attrs[] = {
-       {"rq_list", 0400, .seq_ops = &ctx_rq_list_seq_ops},
+       {"default_rq_list", 0400, .seq_ops = &ctx_default_rq_list_seq_ops},
+       {"read_rq_list", 0400, .seq_ops = &ctx_read_rq_list_seq_ops},
+       {"poll_rq_list", 0400, .seq_ops = &ctx_poll_rq_list_seq_ops},
        {"dispatched", 0600, ctx_dispatched_show, ctx_dispatched_write},
        {"merged", 0600, ctx_merged_show, ctx_merged_write},
        {"completed", 0600, ctx_completed_show, ctx_completed_write},