@@ -496,6 +496,27 @@ 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_timeout_show(struct request_queue *q, char *page)
+{
+ return sprintf(page, "%u\n", q->rq_timeout / HZ);
+}
+
+static ssize_t queue_timeout_store(struct request_queue *q, const char *page,
+ size_t count)
+{
+ unsigned long timeout;
+ ssize_t ret;
+
+ ret = queue_var_store(&timeout, page, count);
+ if (ret < 0)
+ return ret;
+ if (!timeout)
+ return -EINVAL;
+
+ blk_queue_rq_timeout(q, timeout * HZ);
+ return count;
+}
+
static struct queue_sysfs_entry queue_requests_entry = {
.attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR },
.show = queue_requests_show,
@@ -678,6 +699,12 @@ static struct queue_sysfs_entry throtl_sample_time_entry = {
};
#endif
+static struct queue_sysfs_entry queue_timeout_entry = {
+ .attr = {.name = "timeout", .mode = S_IRUGO | S_IWUSR },
+ .show = queue_timeout_show,
+ .store = queue_timeout_store,
+};
+
static struct attribute *default_attrs[] = {
&queue_requests_entry.attr,
&queue_ra_entry.attr,
@@ -714,6 +741,7 @@ static struct attribute *default_attrs[] = {
#ifdef CONFIG_BLK_DEV_THROTTLING_LOW
&throtl_sample_time_entry.attr,
#endif
+ &queue_timeout_entry.attr,
NULL,
};