@@ -530,6 +530,23 @@ static ssize_t queue_dax_show(struct request_queue *q, char *page)
return queue_var_show(blk_queue_dax(q), page);
}
+static ssize_t queue_stat_show(struct request_queue *q, char *p)
+{
+ char name[3][8] = {"read", "write", "discard"};
+ int bkt, off, i;
+
+ off = 0;
+ for (i = 0; i < 3; i++) {
+ off += sprintf(p + off, "%s: ", name[i]);
+ for (bkt = 0; bkt < (BLK_DEV_STATS_BKTS / 3); bkt++) {
+ off += sprintf(p + off, "%llu ",
+ q->dev_stat[i + 3 * bkt].size);
+ }
+ off += sprintf(p + off, "\n");
+ }
+ return off;
+}
+
static ssize_t queue_histstat_show(struct request_queue *q, char *page)
{
return queue_var_show(test_bit(QUEUE_FLAG_HISTSTATS,
@@ -759,6 +776,11 @@ static struct queue_sysfs_entry throtl_sample_time_entry = {
};
#endif
+static struct queue_sysfs_entry queue_stat_entry = {
+ .attr = {.name = "stat", .mode = 0444 },
+ .show = queue_stat_show,
+};
+
static struct queue_sysfs_entry queue_histstat_entry = {
.attr = {.name = "histstat", .mode = 0644 },
.show = queue_histstat_show,
@@ -804,6 +826,7 @@ static struct attribute *default_attrs[] = {
#ifdef CONFIG_BLK_DEV_THROTTLING_LOW
&throtl_sample_time_entry.attr,
#endif
+ &queue_stat_entry.attr,
&queue_histstat_entry.attr,
NULL,
};