aboutsummaryrefslogtreecommitdiffstats
path: root/block
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
parent3d1ab40f4c20767afbd361b258a531d73e3e6fc2 (diff)
[PATCH] fix rmmod problems with elevator attributes, clean them up
Diffstat (limited to 'block')
-rw-r--r--block/as-iosched.c71
-rw-r--r--block/cfq-iosched.c93
-rw-r--r--block/deadline-iosched.c64
-rw-r--r--block/elevator.c7
4 files changed, 67 insertions, 168 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 = {
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 6dc156e1c29b..c4a0d5d8d7f0 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -2304,8 +2304,8 @@ SHOW_FUNCTION(cfq_quantum_show, cfqd->cfq_quantum, 0);
2304SHOW_FUNCTION(cfq_queued_show, cfqd->cfq_queued, 0); 2304SHOW_FUNCTION(cfq_queued_show, cfqd->cfq_queued, 0);
2305SHOW_FUNCTION(cfq_fifo_expire_sync_show, cfqd->cfq_fifo_expire[1], 1); 2305SHOW_FUNCTION(cfq_fifo_expire_sync_show, cfqd->cfq_fifo_expire[1], 1);
2306SHOW_FUNCTION(cfq_fifo_expire_async_show, cfqd->cfq_fifo_expire[0], 1); 2306SHOW_FUNCTION(cfq_fifo_expire_async_show, cfqd->cfq_fifo_expire[0], 1);
2307SHOW_FUNCTION(cfq_back_max_show, cfqd->cfq_back_max, 0); 2307SHOW_FUNCTION(cfq_back_seek_max_show, cfqd->cfq_back_max, 0);
2308SHOW_FUNCTION(cfq_back_penalty_show, cfqd->cfq_back_penalty, 0); 2308SHOW_FUNCTION(cfq_back_seek_penalty_show, cfqd->cfq_back_penalty, 0);
2309SHOW_FUNCTION(cfq_slice_idle_show, cfqd->cfq_slice_idle, 1); 2309SHOW_FUNCTION(cfq_slice_idle_show, cfqd->cfq_slice_idle, 1);
2310SHOW_FUNCTION(cfq_slice_sync_show, cfqd->cfq_slice[1], 1); 2310SHOW_FUNCTION(cfq_slice_sync_show, cfqd->cfq_slice[1], 1);
2311SHOW_FUNCTION(cfq_slice_async_show, cfqd->cfq_slice[0], 1); 2311SHOW_FUNCTION(cfq_slice_async_show, cfqd->cfq_slice[0], 1);
@@ -2333,8 +2333,8 @@ STORE_FUNCTION(cfq_quantum_store, &cfqd->cfq_quantum, 1, UINT_MAX, 0);
2333STORE_FUNCTION(cfq_queued_store, &cfqd->cfq_queued, 1, UINT_MAX, 0); 2333STORE_FUNCTION(cfq_queued_store, &cfqd->cfq_queued, 1, UINT_MAX, 0);
2334STORE_FUNCTION(cfq_fifo_expire_sync_store, &cfqd->cfq_fifo_expire[1], 1, UINT_MAX, 1); 2334STORE_FUNCTION(cfq_fifo_expire_sync_store, &cfqd->cfq_fifo_expire[1], 1, UINT_MAX, 1);
2335STORE_FUNCTION(cfq_fifo_expire_async_store, &cfqd->cfq_fifo_expire[0], 1, UINT_MAX, 1); 2335STORE_FUNCTION(cfq_fifo_expire_async_store, &cfqd->cfq_fifo_expire[0], 1, UINT_MAX, 1);
2336STORE_FUNCTION(cfq_back_max_store, &cfqd->cfq_back_max, 0, UINT_MAX, 0); 2336STORE_FUNCTION(cfq_back_seek_max_store, &cfqd->cfq_back_max, 0, UINT_MAX, 0);
2337STORE_FUNCTION(cfq_back_penalty_store, &cfqd->cfq_back_penalty, 1, UINT_MAX, 0); 2337STORE_FUNCTION(cfq_back_seek_penalty_store, &cfqd->cfq_back_penalty, 1, UINT_MAX, 0);
2338STORE_FUNCTION(cfq_slice_idle_store, &cfqd->cfq_slice_idle, 0, UINT_MAX, 1); 2338STORE_FUNCTION(cfq_slice_idle_store, &cfqd->cfq_slice_idle, 0, UINT_MAX, 1);
2339STORE_FUNCTION(cfq_slice_sync_store, &cfqd->cfq_slice[1], 1, UINT_MAX, 1); 2339STORE_FUNCTION(cfq_slice_sync_store, &cfqd->cfq_slice[1], 1, UINT_MAX, 1);
2340STORE_FUNCTION(cfq_slice_async_store, &cfqd->cfq_slice[0], 1, UINT_MAX, 1); 2340STORE_FUNCTION(cfq_slice_async_store, &cfqd->cfq_slice[0], 1, UINT_MAX, 1);
@@ -2342,75 +2342,22 @@ STORE_FUNCTION(cfq_slice_async_rq_store, &cfqd->cfq_slice_async_rq, 1, UINT_MAX,
2342STORE_FUNCTION(cfq_max_depth_store, &cfqd->cfq_max_depth, 1, UINT_MAX, 0); 2342STORE_FUNCTION(cfq_max_depth_store, &cfqd->cfq_max_depth, 1, UINT_MAX, 0);
2343#undef STORE_FUNCTION 2343#undef STORE_FUNCTION
2344 2344
2345static struct elv_fs_entry cfq_quantum_entry = { 2345#define CFQ_ATTR(name) \
2346 .attr = {.name = "quantum", .mode = S_IRUGO | S_IWUSR }, 2346 __ATTR(name, S_IRUGO|S_IWUSR, cfq_##name##_show, cfq_##name##_store)
2347 .show = cfq_quantum_show, 2347
2348 .store = cfq_quantum_store, 2348static struct elv_fs_entry cfq_attrs[] = {
2349}; 2349 CFQ_ATTR(quantum),
2350static struct elv_fs_entry cfq_queued_entry = { 2350 CFQ_ATTR(queued),
2351 .attr = {.name = "queued", .mode = S_IRUGO | S_IWUSR }, 2351 CFQ_ATTR(fifo_expire_sync),
2352 .show = cfq_queued_show, 2352 CFQ_ATTR(fifo_expire_async),
2353 .store = cfq_queued_store, 2353 CFQ_ATTR(back_seek_max),
2354}; 2354 CFQ_ATTR(back_seek_penalty),
2355static struct elv_fs_entry cfq_fifo_expire_sync_entry = { 2355 CFQ_ATTR(slice_sync),
2356 .attr = {.name = "fifo_expire_sync", .mode = S_IRUGO | S_IWUSR }, 2356 CFQ_ATTR(slice_async),
2357 .show = cfq_fifo_expire_sync_show, 2357 CFQ_ATTR(slice_async_rq),
2358 .store = cfq_fifo_expire_sync_store, 2358 CFQ_ATTR(slice_idle),
2359}; 2359 CFQ_ATTR(max_depth),
2360static struct elv_fs_entry cfq_fifo_expire_async_entry = { 2360 __ATTR_NULL
2361 .attr = {.name = "fifo_expire_async", .mode = S_IRUGO | S_IWUSR },
2362 .show = cfq_fifo_expire_async_show,
2363 .store = cfq_fifo_expire_async_store,
2364};
2365static struct elv_fs_entry cfq_back_max_entry = {
2366 .attr = {.name = "back_seek_max", .mode = S_IRUGO | S_IWUSR },
2367 .show = cfq_back_max_show,
2368 .store = cfq_back_max_store,
2369};
2370static struct elv_fs_entry cfq_back_penalty_entry = {
2371 .attr = {.name = "back_seek_penalty", .mode = S_IRUGO | S_IWUSR },
2372 .show = cfq_back_penalty_show,
2373 .store = cfq_back_penalty_store,
2374};
2375static struct elv_fs_entry cfq_slice_sync_entry = {
2376 .attr = {.name = "slice_sync", .mode = S_IRUGO | S_IWUSR },
2377 .show = cfq_slice_sync_show,
2378 .store = cfq_slice_sync_store,
2379};
2380static struct elv_fs_entry cfq_slice_async_entry = {
2381 .attr = {.name = "slice_async", .mode = S_IRUGO | S_IWUSR },
2382 .show = cfq_slice_async_show,
2383 .store = cfq_slice_async_store,
2384};
2385static struct elv_fs_entry cfq_slice_async_rq_entry = {
2386 .attr = {.name = "slice_async_rq", .mode = S_IRUGO | S_IWUSR },
2387 .show = cfq_slice_async_rq_show,
2388 .store = cfq_slice_async_rq_store,
2389};
2390static struct elv_fs_entry cfq_slice_idle_entry = {
2391 .attr = {.name = "slice_idle", .mode = S_IRUGO | S_IWUSR },
2392 .show = cfq_slice_idle_show,
2393 .store = cfq_slice_idle_store,
2394};
2395static struct elv_fs_entry cfq_max_depth_entry = {
2396 .attr = {.name = "max_depth", .mode = S_IRUGO | S_IWUSR },
2397 .show = cfq_max_depth_show,
2398 .store = cfq_max_depth_store,
2399};
2400
2401static struct attribute *cfq_attrs[] = {
2402 &cfq_quantum_entry.attr,
2403 &cfq_queued_entry.attr,
2404 &cfq_fifo_expire_sync_entry.attr,
2405 &cfq_fifo_expire_async_entry.attr,
2406 &cfq_back_max_entry.attr,
2407 &cfq_back_penalty_entry.attr,
2408 &cfq_slice_sync_entry.attr,
2409 &cfq_slice_async_entry.attr,
2410 &cfq_slice_async_rq_entry.attr,
2411 &cfq_slice_idle_entry.attr,
2412 &cfq_max_depth_entry.attr,
2413 NULL,
2414}; 2361};
2415 2362
2416static struct elevator_type iosched_cfq = { 2363static struct elevator_type iosched_cfq = {
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}
722SHOW_FUNCTION(deadline_readexpire_show, dd->fifo_expire[READ], 1); 722SHOW_FUNCTION(deadline_read_expire_show, dd->fifo_expire[READ], 1);
723SHOW_FUNCTION(deadline_writeexpire_show, dd->fifo_expire[WRITE], 1); 723SHOW_FUNCTION(deadline_write_expire_show, dd->fifo_expire[WRITE], 1);
724SHOW_FUNCTION(deadline_writesstarved_show, dd->writes_starved, 0); 724SHOW_FUNCTION(deadline_writes_starved_show, dd->writes_starved, 0);
725SHOW_FUNCTION(deadline_frontmerges_show, dd->front_merges, 0); 725SHOW_FUNCTION(deadline_front_merges_show, dd->front_merges, 0);
726SHOW_FUNCTION(deadline_fifobatch_show, dd->fifo_batch, 0); 726SHOW_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}
745STORE_FUNCTION(deadline_readexpire_store, &dd->fifo_expire[READ], 0, INT_MAX, 1); 745STORE_FUNCTION(deadline_read_expire_store, &dd->fifo_expire[READ], 0, INT_MAX, 1);
746STORE_FUNCTION(deadline_writeexpire_store, &dd->fifo_expire[WRITE], 0, INT_MAX, 1); 746STORE_FUNCTION(deadline_write_expire_store, &dd->fifo_expire[WRITE], 0, INT_MAX, 1);
747STORE_FUNCTION(deadline_writesstarved_store, &dd->writes_starved, INT_MIN, INT_MAX, 0); 747STORE_FUNCTION(deadline_writes_starved_store, &dd->writes_starved, INT_MIN, INT_MAX, 0);
748STORE_FUNCTION(deadline_frontmerges_store, &dd->front_merges, 0, 1, 0); 748STORE_FUNCTION(deadline_front_merges_store, &dd->front_merges, 0, 1, 0);
749STORE_FUNCTION(deadline_fifobatch_store, &dd->fifo_batch, 0, INT_MAX, 0); 749STORE_FUNCTION(deadline_fifo_batch_store, &dd->fifo_batch, 0, INT_MAX, 0);
750#undef STORE_FUNCTION 750#undef STORE_FUNCTION
751 751
752static 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}; 756static struct elv_fs_entry deadline_attrs[] = {
757static 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),
762static 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};
767static 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};
772static 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
778static 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
787static struct elevator_type iosched_deadline = { 765static struct elevator_type iosched_deadline = {
diff --git a/block/elevator.c b/block/elevator.c
index 0d2db536c6a7..db3d0d8296a0 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -699,11 +699,12 @@ int elv_register_queue(struct request_queue *q)
699 699
700 error = kobject_add(&e->kobj); 700 error = kobject_add(&e->kobj);
701 if (!error) { 701 if (!error) {
702 struct attribute **attr = e->elevator_type->elevator_attrs; 702 struct elv_fs_entry *attr = e->elevator_type->elevator_attrs;
703 if (attr) { 703 if (attr) {
704 while (*attr) { 704 while (attr->attr.name) {
705 if (sysfs_create_file(&e->kobj,*attr++)) 705 if (sysfs_create_file(&e->kobj, &attr->attr))
706 break; 706 break;
707 attr++;
707 } 708 }
708 } 709 }
709 kobject_uevent(&e->kobj, KOBJ_ADD); 710 kobject_uevent(&e->kobj, KOBJ_ADD);