aboutsummaryrefslogtreecommitdiffstats
path: root/block/as-iosched.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-03-18 22:27:18 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2006-03-18 22:27:18 -0500
commite572ec7e4e432de7ecf7bd2e62117646fa64e518 (patch)
tree56b4b738fb566128d2db6d62aed28cfd41b5398a /block/as-iosched.c
parent3d1ab40f4c20767afbd361b258a531d73e3e6fc2 (diff)
[PATCH] fix rmmod problems with elevator attributes, clean them up
Diffstat (limited to 'block/as-iosched.c')
-rw-r--r--block/as-iosched.c71
1 files changed, 22 insertions, 49 deletions
diff --git a/block/as-iosched.c b/block/as-iosched.c
index 3fb60eb7093b..296708ceceb2 100644
--- a/block/as-iosched.c
+++ b/block/as-iosched.c
@@ -1725,7 +1725,7 @@ as_var_store(unsigned long *var, const char *page, size_t count)
1725 return count; 1725 return count;
1726} 1726}
1727 1727
1728static ssize_t as_est_show(elevator_t *e, char *page) 1728static ssize_t est_time_show(elevator_t *e, char *page)
1729{ 1729{
1730 struct as_data *ad = e->elevator_data; 1730 struct as_data *ad = e->elevator_data;
1731 int pos = 0; 1731 int pos = 0;
@@ -1748,11 +1748,11 @@ static ssize_t __FUNC(elevator_t *e, char *page) \
1748 struct as_data *ad = e->elevator_data; \ 1748 struct as_data *ad = e->elevator_data; \
1749 return as_var_show(jiffies_to_msecs((__VAR)), (page)); \ 1749 return as_var_show(jiffies_to_msecs((__VAR)), (page)); \
1750} 1750}
1751SHOW_FUNCTION(as_readexpire_show, ad->fifo_expire[REQ_SYNC]); 1751SHOW_FUNCTION(as_read_expire_show, ad->fifo_expire[REQ_SYNC]);
1752SHOW_FUNCTION(as_writeexpire_show, ad->fifo_expire[REQ_ASYNC]); 1752SHOW_FUNCTION(as_write_expire_show, ad->fifo_expire[REQ_ASYNC]);
1753SHOW_FUNCTION(as_anticexpire_show, ad->antic_expire); 1753SHOW_FUNCTION(as_antic_expire_show, ad->antic_expire);
1754SHOW_FUNCTION(as_read_batchexpire_show, ad->batch_expire[REQ_SYNC]); 1754SHOW_FUNCTION(as_read_batch_expire_show, ad->batch_expire[REQ_SYNC]);
1755SHOW_FUNCTION(as_write_batchexpire_show, ad->batch_expire[REQ_ASYNC]); 1755SHOW_FUNCTION(as_write_batch_expire_show, ad->batch_expire[REQ_ASYNC]);
1756#undef SHOW_FUNCTION 1756#undef SHOW_FUNCTION
1757 1757
1758#define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX) \ 1758#define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX) \
@@ -1767,53 +1767,26 @@ static ssize_t __FUNC(elevator_t *e, const char *page, size_t count) \
1767 *(__PTR) = msecs_to_jiffies(*(__PTR)); \ 1767 *(__PTR) = msecs_to_jiffies(*(__PTR)); \
1768 return ret; \ 1768 return ret; \
1769} 1769}
1770STORE_FUNCTION(as_readexpire_store, &ad->fifo_expire[REQ_SYNC], 0, INT_MAX); 1770STORE_FUNCTION(as_read_expire_store, &ad->fifo_expire[REQ_SYNC], 0, INT_MAX);
1771STORE_FUNCTION(as_writeexpire_store, &ad->fifo_expire[REQ_ASYNC], 0, INT_MAX); 1771STORE_FUNCTION(as_write_expire_store, &ad->fifo_expire[REQ_ASYNC], 0, INT_MAX);
1772STORE_FUNCTION(as_anticexpire_store, &ad->antic_expire, 0, INT_MAX); 1772STORE_FUNCTION(as_antic_expire_store, &ad->antic_expire, 0, INT_MAX);
1773STORE_FUNCTION(as_read_batchexpire_store, 1773STORE_FUNCTION(as_read_batch_expire_store,
1774 &ad->batch_expire[REQ_SYNC], 0, INT_MAX); 1774 &ad->batch_expire[REQ_SYNC], 0, INT_MAX);
1775STORE_FUNCTION(as_write_batchexpire_store, 1775STORE_FUNCTION(as_write_batch_expire_store,
1776 &ad->batch_expire[REQ_ASYNC], 0, INT_MAX); 1776 &ad->batch_expire[REQ_ASYNC], 0, INT_MAX);
1777#undef STORE_FUNCTION 1777#undef STORE_FUNCTION
1778 1778
1779static struct elv_fs_entry as_est_entry = { 1779#define AS_ATTR(name) \
1780 .attr = {.name = "est_time", .mode = S_IRUGO }, 1780 __ATTR(name, S_IRUGO|S_IWUSR, as_##name##_show, as_##name##_store)
1781 .show = as_est_show, 1781
1782}; 1782static struct elv_fs_entry as_attrs[] = {
1783static struct elv_fs_entry as_readexpire_entry = { 1783 __ATTR_RO(est_time),
1784 .attr = {.name = "read_expire", .mode = S_IRUGO | S_IWUSR }, 1784 AS_ATTR(read_expire),
1785 .show = as_readexpire_show, 1785 AS_ATTR(write_expire),
1786 .store = as_readexpire_store, 1786 AS_ATTR(antic_expire),
1787}; 1787 AS_ATTR(read_batch_expire),
1788static struct elv_fs_entry as_writeexpire_entry = { 1788 AS_ATTR(write_batch_expire),
1789 .attr = {.name = "write_expire", .mode = S_IRUGO | S_IWUSR }, 1789 __ATTR_NULL
1790 .show = as_writeexpire_show,
1791 .store = as_writeexpire_store,
1792};
1793static struct elv_fs_entry as_anticexpire_entry = {
1794 .attr = {.name = "antic_expire", .mode = S_IRUGO | S_IWUSR },
1795 .show = as_anticexpire_show,
1796 .store = as_anticexpire_store,
1797};
1798static struct elv_fs_entry as_read_batchexpire_entry = {
1799 .attr = {.name = "read_batch_expire", .mode = S_IRUGO | S_IWUSR },
1800 .show = as_read_batchexpire_show,
1801 .store = as_read_batchexpire_store,
1802};
1803static struct elv_fs_entry as_write_batchexpire_entry = {
1804 .attr = {.name = "write_batch_expire", .mode = S_IRUGO | S_IWUSR },
1805 .show = as_write_batchexpire_show,
1806 .store = as_write_batchexpire_store,
1807};
1808
1809static struct attribute *as_attrs[] = {
1810 &as_est_entry.attr,
1811 &as_readexpire_entry.attr,
1812 &as_writeexpire_entry.attr,
1813 &as_anticexpire_entry.attr,
1814 &as_read_batchexpire_entry.attr,
1815 &as_write_batchexpire_entry.attr,
1816 NULL,
1817}; 1790};
1818 1791
1819static struct elevator_type iosched_as = { 1792static struct elevator_type iosched_as = {