@@ -417,6 +417,26 @@ static ssize_t queue_poll_store(struct request_queue *q, const char *page,
417
417
return ret ;
418
418
}
419
419
420
+ static ssize_t queue_io_timeout_show (struct request_queue * q , char * page )
421
+ {
422
+ return sprintf (page , "%u\n" , jiffies_to_msecs (q -> rq_timeout ));
423
+ }
424
+
425
+ static ssize_t queue_io_timeout_store (struct request_queue * q , const char * page ,
426
+ size_t count )
427
+ {
428
+ unsigned int val ;
429
+ int err ;
430
+
431
+ err = kstrtou32 (page , 10 , & val );
432
+ if (err || val == 0 )
433
+ return - EINVAL ;
434
+
435
+ blk_queue_rq_timeout (q , msecs_to_jiffies (val ));
436
+
437
+ return count ;
438
+ }
439
+
420
440
static ssize_t queue_wb_lat_show (struct request_queue * q , char * page )
421
441
{
422
442
if (!wbt_rq_qos (q ))
@@ -685,6 +705,12 @@ static struct queue_sysfs_entry queue_dax_entry = {
685
705
.show = queue_dax_show ,
686
706
};
687
707
708
+ static struct queue_sysfs_entry queue_io_timeout_entry = {
709
+ .attr = {.name = "io_timeout" , .mode = 0644 },
710
+ .show = queue_io_timeout_show ,
711
+ .store = queue_io_timeout_store ,
712
+ };
713
+
688
714
static struct queue_sysfs_entry queue_wb_lat_entry = {
689
715
.attr = {.name = "wbt_lat_usec" , .mode = 0644 },
690
716
.show = queue_wb_lat_show ,
@@ -734,6 +760,7 @@ static struct attribute *default_attrs[] = {
734
760
& queue_dax_entry .attr ,
735
761
& queue_wb_lat_entry .attr ,
736
762
& queue_poll_delay_entry .attr ,
763
+ & queue_io_timeout_entry .attr ,
737
764
#ifdef CONFIG_BLK_DEV_THROTTLING_LOW
738
765
& throtl_sample_time_entry .attr ,
739
766
#endif
0 commit comments