diff options
Diffstat (limited to 'block/deadline-iosched.c')
-rw-r--r-- | block/deadline-iosched.c | 64 |
1 files changed, 21 insertions, 43 deletions
diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c index a3e3ff1e0c65..399fa1e60e1f 100644 --- a/block/deadline-iosched.c +++ b/block/deadline-iosched.c | |||
@@ -719,11 +719,11 @@ static ssize_t __FUNC(elevator_t *e, char *page) \ | |||
719 | __data = jiffies_to_msecs(__data); \ | 719 | __data = jiffies_to_msecs(__data); \ |
720 | return deadline_var_show(__data, (page)); \ | 720 | return deadline_var_show(__data, (page)); \ |
721 | } | 721 | } |
722 | SHOW_FUNCTION(deadline_readexpire_show, dd->fifo_expire[READ], 1); | 722 | SHOW_FUNCTION(deadline_read_expire_show, dd->fifo_expire[READ], 1); |
723 | SHOW_FUNCTION(deadline_writeexpire_show, dd->fifo_expire[WRITE], 1); | 723 | SHOW_FUNCTION(deadline_write_expire_show, dd->fifo_expire[WRITE], 1); |
724 | SHOW_FUNCTION(deadline_writesstarved_show, dd->writes_starved, 0); | 724 | SHOW_FUNCTION(deadline_writes_starved_show, dd->writes_starved, 0); |
725 | SHOW_FUNCTION(deadline_frontmerges_show, dd->front_merges, 0); | 725 | SHOW_FUNCTION(deadline_front_merges_show, dd->front_merges, 0); |
726 | SHOW_FUNCTION(deadline_fifobatch_show, dd->fifo_batch, 0); | 726 | SHOW_FUNCTION(deadline_fifo_batch_show, dd->fifo_batch, 0); |
727 | #undef SHOW_FUNCTION | 727 | #undef SHOW_FUNCTION |
728 | 728 | ||
729 | #define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX, __CONV) \ | 729 | #define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX, __CONV) \ |
@@ -742,46 +742,24 @@ static ssize_t __FUNC(elevator_t *e, const char *page, size_t count) \ | |||
742 | *(__PTR) = __data; \ | 742 | *(__PTR) = __data; \ |
743 | return ret; \ | 743 | return ret; \ |
744 | } | 744 | } |
745 | STORE_FUNCTION(deadline_readexpire_store, &dd->fifo_expire[READ], 0, INT_MAX, 1); | 745 | STORE_FUNCTION(deadline_read_expire_store, &dd->fifo_expire[READ], 0, INT_MAX, 1); |
746 | STORE_FUNCTION(deadline_writeexpire_store, &dd->fifo_expire[WRITE], 0, INT_MAX, 1); | 746 | STORE_FUNCTION(deadline_write_expire_store, &dd->fifo_expire[WRITE], 0, INT_MAX, 1); |
747 | STORE_FUNCTION(deadline_writesstarved_store, &dd->writes_starved, INT_MIN, INT_MAX, 0); | 747 | STORE_FUNCTION(deadline_writes_starved_store, &dd->writes_starved, INT_MIN, INT_MAX, 0); |
748 | STORE_FUNCTION(deadline_frontmerges_store, &dd->front_merges, 0, 1, 0); | 748 | STORE_FUNCTION(deadline_front_merges_store, &dd->front_merges, 0, 1, 0); |
749 | STORE_FUNCTION(deadline_fifobatch_store, &dd->fifo_batch, 0, INT_MAX, 0); | 749 | STORE_FUNCTION(deadline_fifo_batch_store, &dd->fifo_batch, 0, INT_MAX, 0); |
750 | #undef STORE_FUNCTION | 750 | #undef STORE_FUNCTION |
751 | 751 | ||
752 | static struct elv_fs_entry deadline_readexpire_entry = { | 752 | #define DD_ATTR(name) \ |
753 | .attr = {.name = "read_expire", .mode = S_IRUGO | S_IWUSR }, | 753 | __ATTR(name, S_IRUGO|S_IWUSR, deadline_##name##_show, \ |
754 | .show = deadline_readexpire_show, | 754 | deadline_##name##_store) |
755 | .store = deadline_readexpire_store, | 755 | |
756 | }; | 756 | static struct elv_fs_entry deadline_attrs[] = { |
757 | static struct elv_fs_entry deadline_writeexpire_entry = { | 757 | DD_ATTR(read_expire), |
758 | .attr = {.name = "write_expire", .mode = S_IRUGO | S_IWUSR }, | 758 | DD_ATTR(write_expire), |
759 | .show = deadline_writeexpire_show, | 759 | DD_ATTR(writes_starved), |
760 | .store = deadline_writeexpire_store, | 760 | DD_ATTR(front_merges), |
761 | }; | 761 | DD_ATTR(fifo_batch), |
762 | static struct elv_fs_entry deadline_writesstarved_entry = { | 762 | __ATTR_NULL |
763 | .attr = {.name = "writes_starved", .mode = S_IRUGO | S_IWUSR }, | ||
764 | .show = deadline_writesstarved_show, | ||
765 | .store = deadline_writesstarved_store, | ||
766 | }; | ||
767 | static struct elv_fs_entry deadline_frontmerges_entry = { | ||
768 | .attr = {.name = "front_merges", .mode = S_IRUGO | S_IWUSR }, | ||
769 | .show = deadline_frontmerges_show, | ||
770 | .store = deadline_frontmerges_store, | ||
771 | }; | ||
772 | static struct elv_fs_entry deadline_fifobatch_entry = { | ||
773 | .attr = {.name = "fifo_batch", .mode = S_IRUGO | S_IWUSR }, | ||
774 | .show = deadline_fifobatch_show, | ||
775 | .store = deadline_fifobatch_store, | ||
776 | }; | ||
777 | |||
778 | static struct attribute *deadline_attrs[] = { | ||
779 | &deadline_readexpire_entry.attr, | ||
780 | &deadline_writeexpire_entry.attr, | ||
781 | &deadline_writesstarved_entry.attr, | ||
782 | &deadline_frontmerges_entry.attr, | ||
783 | &deadline_fifobatch_entry.attr, | ||
784 | NULL, | ||
785 | }; | 763 | }; |
786 | 764 | ||
787 | static struct elevator_type iosched_deadline = { | 765 | static struct elevator_type iosched_deadline = { |