diff options
Diffstat (limited to 'block/deadline-iosched.c')
-rw-r--r-- | block/deadline-iosched.c | 64 |
1 files changed, 12 insertions, 52 deletions
diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c index 27e494b1bf97..a3e3ff1e0c65 100644 --- a/block/deadline-iosched.c +++ b/block/deadline-iosched.c | |||
@@ -694,11 +694,6 @@ deadline_set_request(request_queue_t *q, struct request *rq, struct bio *bio, | |||
694 | /* | 694 | /* |
695 | * sysfs parts below | 695 | * sysfs parts below |
696 | */ | 696 | */ |
697 | struct deadline_fs_entry { | ||
698 | struct attribute attr; | ||
699 | ssize_t (*show)(struct deadline_data *, char *); | ||
700 | ssize_t (*store)(struct deadline_data *, const char *, size_t); | ||
701 | }; | ||
702 | 697 | ||
703 | static ssize_t | 698 | static ssize_t |
704 | deadline_var_show(int var, char *page) | 699 | deadline_var_show(int var, char *page) |
@@ -716,9 +711,10 @@ deadline_var_store(int *var, const char *page, size_t count) | |||
716 | } | 711 | } |
717 | 712 | ||
718 | #define SHOW_FUNCTION(__FUNC, __VAR, __CONV) \ | 713 | #define SHOW_FUNCTION(__FUNC, __VAR, __CONV) \ |
719 | static ssize_t __FUNC(struct deadline_data *dd, char *page) \ | 714 | static ssize_t __FUNC(elevator_t *e, char *page) \ |
720 | { \ | 715 | { \ |
721 | int __data = __VAR; \ | 716 | struct deadline_data *dd = e->elevator_data; \ |
717 | int __data = __VAR; \ | ||
722 | if (__CONV) \ | 718 | if (__CONV) \ |
723 | __data = jiffies_to_msecs(__data); \ | 719 | __data = jiffies_to_msecs(__data); \ |
724 | return deadline_var_show(__data, (page)); \ | 720 | return deadline_var_show(__data, (page)); \ |
@@ -731,8 +727,9 @@ SHOW_FUNCTION(deadline_fifobatch_show, dd->fifo_batch, 0); | |||
731 | #undef SHOW_FUNCTION | 727 | #undef SHOW_FUNCTION |
732 | 728 | ||
733 | #define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX, __CONV) \ | 729 | #define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX, __CONV) \ |
734 | static ssize_t __FUNC(struct deadline_data *dd, const char *page, size_t count) \ | 730 | static ssize_t __FUNC(elevator_t *e, const char *page, size_t count) \ |
735 | { \ | 731 | { \ |
732 | struct deadline_data *dd = e->elevator_data; \ | ||
736 | int __data; \ | 733 | int __data; \ |
737 | int ret = deadline_var_store(&__data, (page), count); \ | 734 | int ret = deadline_var_store(&__data, (page), count); \ |
738 | if (__data < (MIN)) \ | 735 | if (__data < (MIN)) \ |
@@ -752,33 +749,33 @@ STORE_FUNCTION(deadline_frontmerges_store, &dd->front_merges, 0, 1, 0); | |||
752 | STORE_FUNCTION(deadline_fifobatch_store, &dd->fifo_batch, 0, INT_MAX, 0); | 749 | STORE_FUNCTION(deadline_fifobatch_store, &dd->fifo_batch, 0, INT_MAX, 0); |
753 | #undef STORE_FUNCTION | 750 | #undef STORE_FUNCTION |
754 | 751 | ||
755 | static struct deadline_fs_entry deadline_readexpire_entry = { | 752 | static struct elv_fs_entry deadline_readexpire_entry = { |
756 | .attr = {.name = "read_expire", .mode = S_IRUGO | S_IWUSR }, | 753 | .attr = {.name = "read_expire", .mode = S_IRUGO | S_IWUSR }, |
757 | .show = deadline_readexpire_show, | 754 | .show = deadline_readexpire_show, |
758 | .store = deadline_readexpire_store, | 755 | .store = deadline_readexpire_store, |
759 | }; | 756 | }; |
760 | static struct deadline_fs_entry deadline_writeexpire_entry = { | 757 | static struct elv_fs_entry deadline_writeexpire_entry = { |
761 | .attr = {.name = "write_expire", .mode = S_IRUGO | S_IWUSR }, | 758 | .attr = {.name = "write_expire", .mode = S_IRUGO | S_IWUSR }, |
762 | .show = deadline_writeexpire_show, | 759 | .show = deadline_writeexpire_show, |
763 | .store = deadline_writeexpire_store, | 760 | .store = deadline_writeexpire_store, |
764 | }; | 761 | }; |
765 | static struct deadline_fs_entry deadline_writesstarved_entry = { | 762 | static struct elv_fs_entry deadline_writesstarved_entry = { |
766 | .attr = {.name = "writes_starved", .mode = S_IRUGO | S_IWUSR }, | 763 | .attr = {.name = "writes_starved", .mode = S_IRUGO | S_IWUSR }, |
767 | .show = deadline_writesstarved_show, | 764 | .show = deadline_writesstarved_show, |
768 | .store = deadline_writesstarved_store, | 765 | .store = deadline_writesstarved_store, |
769 | }; | 766 | }; |
770 | static struct deadline_fs_entry deadline_frontmerges_entry = { | 767 | static struct elv_fs_entry deadline_frontmerges_entry = { |
771 | .attr = {.name = "front_merges", .mode = S_IRUGO | S_IWUSR }, | 768 | .attr = {.name = "front_merges", .mode = S_IRUGO | S_IWUSR }, |
772 | .show = deadline_frontmerges_show, | 769 | .show = deadline_frontmerges_show, |
773 | .store = deadline_frontmerges_store, | 770 | .store = deadline_frontmerges_store, |
774 | }; | 771 | }; |
775 | static struct deadline_fs_entry deadline_fifobatch_entry = { | 772 | static struct elv_fs_entry deadline_fifobatch_entry = { |
776 | .attr = {.name = "fifo_batch", .mode = S_IRUGO | S_IWUSR }, | 773 | .attr = {.name = "fifo_batch", .mode = S_IRUGO | S_IWUSR }, |
777 | .show = deadline_fifobatch_show, | 774 | .show = deadline_fifobatch_show, |
778 | .store = deadline_fifobatch_store, | 775 | .store = deadline_fifobatch_store, |
779 | }; | 776 | }; |
780 | 777 | ||
781 | static struct attribute *default_attrs[] = { | 778 | static struct attribute *deadline_attrs[] = { |
782 | &deadline_readexpire_entry.attr, | 779 | &deadline_readexpire_entry.attr, |
783 | &deadline_writeexpire_entry.attr, | 780 | &deadline_writeexpire_entry.attr, |
784 | &deadline_writesstarved_entry.attr, | 781 | &deadline_writesstarved_entry.attr, |
@@ -787,43 +784,6 @@ static struct attribute *default_attrs[] = { | |||
787 | NULL, | 784 | NULL, |
788 | }; | 785 | }; |
789 | 786 | ||
790 | #define to_deadline(atr) container_of((atr), struct deadline_fs_entry, attr) | ||
791 | |||
792 | static ssize_t | ||
793 | deadline_attr_show(struct kobject *kobj, struct attribute *attr, char *page) | ||
794 | { | ||
795 | elevator_t *e = container_of(kobj, elevator_t, kobj); | ||
796 | struct deadline_fs_entry *entry = to_deadline(attr); | ||
797 | |||
798 | if (!entry->show) | ||
799 | return -EIO; | ||
800 | |||
801 | return entry->show(e->elevator_data, page); | ||
802 | } | ||
803 | |||
804 | static ssize_t | ||
805 | deadline_attr_store(struct kobject *kobj, struct attribute *attr, | ||
806 | const char *page, size_t length) | ||
807 | { | ||
808 | elevator_t *e = container_of(kobj, elevator_t, kobj); | ||
809 | struct deadline_fs_entry *entry = to_deadline(attr); | ||
810 | |||
811 | if (!entry->store) | ||
812 | return -EIO; | ||
813 | |||
814 | return entry->store(e->elevator_data, page, length); | ||
815 | } | ||
816 | |||
817 | static struct sysfs_ops deadline_sysfs_ops = { | ||
818 | .show = deadline_attr_show, | ||
819 | .store = deadline_attr_store, | ||
820 | }; | ||
821 | |||
822 | static struct kobj_type deadline_ktype = { | ||
823 | .sysfs_ops = &deadline_sysfs_ops, | ||
824 | .default_attrs = default_attrs, | ||
825 | }; | ||
826 | |||
827 | static struct elevator_type iosched_deadline = { | 787 | static struct elevator_type iosched_deadline = { |
828 | .ops = { | 788 | .ops = { |
829 | .elevator_merge_fn = deadline_merge, | 789 | .elevator_merge_fn = deadline_merge, |
@@ -840,7 +800,7 @@ static struct elevator_type iosched_deadline = { | |||
840 | .elevator_exit_fn = deadline_exit_queue, | 800 | .elevator_exit_fn = deadline_exit_queue, |
841 | }, | 801 | }, |
842 | 802 | ||
843 | .elevator_ktype = &deadline_ktype, | 803 | .elevator_attrs = deadline_attrs, |
844 | .elevator_name = "deadline", | 804 | .elevator_name = "deadline", |
845 | .elevator_owner = THIS_MODULE, | 805 | .elevator_owner = THIS_MODULE, |
846 | }; | 806 | }; |