On 9/16/19 5:35 PM, Chaitanya Kulkarni wrote:
diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index b3f2ba483992..1e46f2cbf84e 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -679,8 +679,21 @@ static ssize_t ctx_dispatched_write(void *data, const char 
__user *buf,
  static int ctx_merged_show(void *data, struct seq_file *m)
  {
        struct blk_mq_ctx *ctx = data;
+       unsigned long *rm = ctx->rq_merged;
+
+       seq_printf(m, "READ             %8lu\n", rm[REQ_OP_READ]);
+       seq_printf(m, "WRITE            %8lu\n", rm[REQ_OP_WRITE]);
+       seq_printf(m, "FLUSH            %8lu\n", rm[REQ_OP_FLUSH]);
+       seq_printf(m, "DISCARD          %8lu\n", rm[REQ_OP_DISCARD]);
+       seq_printf(m, "SECURE_ERASE     %8lu\n", rm[REQ_OP_SECURE_ERASE]);
+       seq_printf(m, "ZONE_RESET       %8lu\n", rm[REQ_OP_ZONE_RESET]);
+       seq_printf(m, "ZONE_RESET_ALL   %8lu\n", rm[REQ_OP_ZONE_RESET_ALL]);
+       seq_printf(m, "WRITE_ZEROES     %8lu\n", rm[REQ_OP_WRITE_ZEROES]);
+       seq_printf(m, "SCSI_IN          %8lu\n", rm[REQ_OP_SCSI_IN]);
+       seq_printf(m, "SCSI_OUT         %8lu\n", rm[REQ_OP_SCSI_OUT]);
+       seq_printf(m, "DRV_IN           %8lu\n", rm[REQ_OP_DRV_IN]);
+       seq_printf(m, "DRV_OUT          %8lu\n", rm[REQ_OP_DRV_OUT]);
- seq_printf(m, "%lu\n", ctx->rq_merged);
        return 0;
  }

Several request types shown above are never merged, e.g. FLUSH, WRITE_ZEROES, SCSI_IN, SCSI_OUT, DRV_IN and DRV_OUT (see also rq_mergeable()). Showing zero for these request types may confuse users. Can the body of this function be changed into a loop that does not print statistics for request types for which ctx->rq_merged[] is zero?

Thanks,

Bart.

Reply via email to