aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/as-iosched.c8
-rw-r--r--block/cfq-iosched.c6
-rw-r--r--block/deadline-iosched.c6
-rw-r--r--block/elevator.c55
-rw-r--r--block/noop-iosched.c2
5 files changed, 40 insertions, 37 deletions
diff --git a/block/as-iosched.c b/block/as-iosched.c
index 802b5d0d8536..631f6f44460a 100644
--- a/block/as-iosched.c
+++ b/block/as-iosched.c
@@ -1339,7 +1339,7 @@ static int as_may_queue(struct request_queue *q, int rw)
1339 return ret; 1339 return ret;
1340} 1340}
1341 1341
1342static void as_exit_queue(elevator_t *e) 1342static void as_exit_queue(struct elevator_queue *e)
1343{ 1343{
1344 struct as_data *ad = e->elevator_data; 1344 struct as_data *ad = e->elevator_data;
1345 1345
@@ -1409,7 +1409,7 @@ as_var_store(unsigned long *var, const char *page, size_t count)
1409 return count; 1409 return count;
1410} 1410}
1411 1411
1412static ssize_t est_time_show(elevator_t *e, char *page) 1412static ssize_t est_time_show(struct elevator_queue *e, char *page)
1413{ 1413{
1414 struct as_data *ad = e->elevator_data; 1414 struct as_data *ad = e->elevator_data;
1415 int pos = 0; 1415 int pos = 0;
@@ -1427,7 +1427,7 @@ static ssize_t est_time_show(elevator_t *e, char *page)
1427} 1427}
1428 1428
1429#define SHOW_FUNCTION(__FUNC, __VAR) \ 1429#define SHOW_FUNCTION(__FUNC, __VAR) \
1430static ssize_t __FUNC(elevator_t *e, char *page) \ 1430static ssize_t __FUNC(struct elevator_queue *e, char *page) \
1431{ \ 1431{ \
1432 struct as_data *ad = e->elevator_data; \ 1432 struct as_data *ad = e->elevator_data; \
1433 return as_var_show(jiffies_to_msecs((__VAR)), (page)); \ 1433 return as_var_show(jiffies_to_msecs((__VAR)), (page)); \
@@ -1440,7 +1440,7 @@ SHOW_FUNCTION(as_write_batch_expire_show, ad->batch_expire[REQ_ASYNC]);
1440#undef SHOW_FUNCTION 1440#undef SHOW_FUNCTION
1441 1441
1442#define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX) \ 1442#define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX) \
1443static ssize_t __FUNC(elevator_t *e, const char *page, size_t count) \ 1443static ssize_t __FUNC(struct elevator_queue *e, const char *page, size_t count) \
1444{ \ 1444{ \
1445 struct as_data *ad = e->elevator_data; \ 1445 struct as_data *ad = e->elevator_data; \
1446 int ret = as_var_store(__PTR, (page), count); \ 1446 int ret = as_var_store(__PTR, (page), count); \
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index a2bfec7d6b36..adaf93a9d19d 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -2178,7 +2178,7 @@ static void cfq_put_async_queues(struct cfq_data *cfqd)
2178 cfq_put_queue(cfqd->async_idle_cfqq); 2178 cfq_put_queue(cfqd->async_idle_cfqq);
2179} 2179}
2180 2180
2181static void cfq_exit_queue(elevator_t *e) 2181static void cfq_exit_queue(struct elevator_queue *e)
2182{ 2182{
2183 struct cfq_data *cfqd = e->elevator_data; 2183 struct cfq_data *cfqd = e->elevator_data;
2184 struct request_queue *q = cfqd->queue; 2184 struct request_queue *q = cfqd->queue;
@@ -2288,7 +2288,7 @@ cfq_var_store(unsigned int *var, const char *page, size_t count)
2288} 2288}
2289 2289
2290#define SHOW_FUNCTION(__FUNC, __VAR, __CONV) \ 2290#define SHOW_FUNCTION(__FUNC, __VAR, __CONV) \
2291static ssize_t __FUNC(elevator_t *e, char *page) \ 2291static ssize_t __FUNC(struct elevator_queue *e, char *page) \
2292{ \ 2292{ \
2293 struct cfq_data *cfqd = e->elevator_data; \ 2293 struct cfq_data *cfqd = e->elevator_data; \
2294 unsigned int __data = __VAR; \ 2294 unsigned int __data = __VAR; \
@@ -2308,7 +2308,7 @@ SHOW_FUNCTION(cfq_slice_async_rq_show, cfqd->cfq_slice_async_rq, 0);
2308#undef SHOW_FUNCTION 2308#undef SHOW_FUNCTION
2309 2309
2310#define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX, __CONV) \ 2310#define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX, __CONV) \
2311static ssize_t __FUNC(elevator_t *e, const char *page, size_t count) \ 2311static ssize_t __FUNC(struct elevator_queue *e, const char *page, size_t count) \
2312{ \ 2312{ \
2313 struct cfq_data *cfqd = e->elevator_data; \ 2313 struct cfq_data *cfqd = e->elevator_data; \
2314 unsigned int __data; \ 2314 unsigned int __data; \
diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c
index fd311179f44c..c4d991d4adef 100644
--- a/block/deadline-iosched.c
+++ b/block/deadline-iosched.c
@@ -334,7 +334,7 @@ static int deadline_queue_empty(struct request_queue *q)
334 && list_empty(&dd->fifo_list[READ]); 334 && list_empty(&dd->fifo_list[READ]);
335} 335}
336 336
337static void deadline_exit_queue(elevator_t *e) 337static void deadline_exit_queue(struct elevator_queue *e)
338{ 338{
339 struct deadline_data *dd = e->elevator_data; 339 struct deadline_data *dd = e->elevator_data;
340 340
@@ -387,7 +387,7 @@ deadline_var_store(int *var, const char *page, size_t count)
387} 387}
388 388
389#define SHOW_FUNCTION(__FUNC, __VAR, __CONV) \ 389#define SHOW_FUNCTION(__FUNC, __VAR, __CONV) \
390static ssize_t __FUNC(elevator_t *e, char *page) \ 390static ssize_t __FUNC(struct elevator_queue *e, char *page) \
391{ \ 391{ \
392 struct deadline_data *dd = e->elevator_data; \ 392 struct deadline_data *dd = e->elevator_data; \
393 int __data = __VAR; \ 393 int __data = __VAR; \
@@ -403,7 +403,7 @@ SHOW_FUNCTION(deadline_fifo_batch_show, dd->fifo_batch, 0);
403#undef SHOW_FUNCTION 403#undef SHOW_FUNCTION
404 404
405#define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX, __CONV) \ 405#define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX, __CONV) \
406static ssize_t __FUNC(elevator_t *e, const char *page, size_t count) \ 406static ssize_t __FUNC(struct elevator_queue *e, const char *page, size_t count) \
407{ \ 407{ \
408 struct deadline_data *dd = e->elevator_data; \ 408 struct deadline_data *dd = e->elevator_data; \
409 int __data; \ 409 int __data; \
diff --git a/block/elevator.c b/block/elevator.c
index ff60177a3bab..98259eda0ef6 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -65,7 +65,7 @@ DEFINE_TRACE(block_rq_issue);
65static int elv_iosched_allow_merge(struct request *rq, struct bio *bio) 65static int elv_iosched_allow_merge(struct request *rq, struct bio *bio)
66{ 66{
67 struct request_queue *q = rq->q; 67 struct request_queue *q = rq->q;
68 elevator_t *e = q->elevator; 68 struct elevator_queue *e = q->elevator;
69 69
70 if (e->ops->elevator_allow_merge_fn) 70 if (e->ops->elevator_allow_merge_fn)
71 return e->ops->elevator_allow_merge_fn(q, rq, bio); 71 return e->ops->elevator_allow_merge_fn(q, rq, bio);
@@ -208,13 +208,13 @@ __setup("elevator=", elevator_setup);
208 208
209static struct kobj_type elv_ktype; 209static struct kobj_type elv_ktype;
210 210
211static elevator_t *elevator_alloc(struct request_queue *q, 211static struct elevator_queue *elevator_alloc(struct request_queue *q,
212 struct elevator_type *e) 212 struct elevator_type *e)
213{ 213{
214 elevator_t *eq; 214 struct elevator_queue *eq;
215 int i; 215 int i;
216 216
217 eq = kmalloc_node(sizeof(elevator_t), GFP_KERNEL | __GFP_ZERO, q->node); 217 eq = kmalloc_node(sizeof(*eq), GFP_KERNEL | __GFP_ZERO, q->node);
218 if (unlikely(!eq)) 218 if (unlikely(!eq))
219 goto err; 219 goto err;
220 220
@@ -240,8 +240,9 @@ err:
240 240
241static void elevator_release(struct kobject *kobj) 241static void elevator_release(struct kobject *kobj)
242{ 242{
243 elevator_t *e = container_of(kobj, elevator_t, kobj); 243 struct elevator_queue *e;
244 244
245 e = container_of(kobj, struct elevator_queue, kobj);
245 elevator_put(e->elevator_type); 246 elevator_put(e->elevator_type);
246 kfree(e->hash); 247 kfree(e->hash);
247 kfree(e); 248 kfree(e);
@@ -297,7 +298,7 @@ int elevator_init(struct request_queue *q, char *name)
297} 298}
298EXPORT_SYMBOL(elevator_init); 299EXPORT_SYMBOL(elevator_init);
299 300
300void elevator_exit(elevator_t *e) 301void elevator_exit(struct elevator_queue *e)
301{ 302{
302 mutex_lock(&e->sysfs_lock); 303 mutex_lock(&e->sysfs_lock);
303 if (e->ops->elevator_exit_fn) 304 if (e->ops->elevator_exit_fn)
@@ -311,7 +312,7 @@ EXPORT_SYMBOL(elevator_exit);
311 312
312static void elv_activate_rq(struct request_queue *q, struct request *rq) 313static void elv_activate_rq(struct request_queue *q, struct request *rq)
313{ 314{
314 elevator_t *e = q->elevator; 315 struct elevator_queue *e = q->elevator;
315 316
316 if (e->ops->elevator_activate_req_fn) 317 if (e->ops->elevator_activate_req_fn)
317 e->ops->elevator_activate_req_fn(q, rq); 318 e->ops->elevator_activate_req_fn(q, rq);
@@ -319,7 +320,7 @@ static void elv_activate_rq(struct request_queue *q, struct request *rq)
319 320
320static void elv_deactivate_rq(struct request_queue *q, struct request *rq) 321static void elv_deactivate_rq(struct request_queue *q, struct request *rq)
321{ 322{
322 elevator_t *e = q->elevator; 323 struct elevator_queue *e = q->elevator;
323 324
324 if (e->ops->elevator_deactivate_req_fn) 325 if (e->ops->elevator_deactivate_req_fn)
325 e->ops->elevator_deactivate_req_fn(q, rq); 326 e->ops->elevator_deactivate_req_fn(q, rq);
@@ -338,7 +339,7 @@ static void elv_rqhash_del(struct request_queue *q, struct request *rq)
338 339
339static void elv_rqhash_add(struct request_queue *q, struct request *rq) 340static void elv_rqhash_add(struct request_queue *q, struct request *rq)
340{ 341{
341 elevator_t *e = q->elevator; 342 struct elevator_queue *e = q->elevator;
342 343
343 BUG_ON(ELV_ON_HASH(rq)); 344 BUG_ON(ELV_ON_HASH(rq));
344 hlist_add_head(&rq->hash, &e->hash[ELV_HASH_FN(rq_hash_key(rq))]); 345 hlist_add_head(&rq->hash, &e->hash[ELV_HASH_FN(rq_hash_key(rq))]);
@@ -352,7 +353,7 @@ static void elv_rqhash_reposition(struct request_queue *q, struct request *rq)
352 353
353static struct request *elv_rqhash_find(struct request_queue *q, sector_t offset) 354static struct request *elv_rqhash_find(struct request_queue *q, sector_t offset)
354{ 355{
355 elevator_t *e = q->elevator; 356 struct elevator_queue *e = q->elevator;
356 struct hlist_head *hash_list = &e->hash[ELV_HASH_FN(offset)]; 357 struct hlist_head *hash_list = &e->hash[ELV_HASH_FN(offset)];
357 struct hlist_node *entry, *next; 358 struct hlist_node *entry, *next;
358 struct request *rq; 359 struct request *rq;
@@ -494,7 +495,7 @@ EXPORT_SYMBOL(elv_dispatch_add_tail);
494 495
495int elv_merge(struct request_queue *q, struct request **req, struct bio *bio) 496int elv_merge(struct request_queue *q, struct request **req, struct bio *bio)
496{ 497{
497 elevator_t *e = q->elevator; 498 struct elevator_queue *e = q->elevator;
498 struct request *__rq; 499 struct request *__rq;
499 int ret; 500 int ret;
500 501
@@ -529,7 +530,7 @@ int elv_merge(struct request_queue *q, struct request **req, struct bio *bio)
529 530
530void elv_merged_request(struct request_queue *q, struct request *rq, int type) 531void elv_merged_request(struct request_queue *q, struct request *rq, int type)
531{ 532{
532 elevator_t *e = q->elevator; 533 struct elevator_queue *e = q->elevator;
533 534
534 if (e->ops->elevator_merged_fn) 535 if (e->ops->elevator_merged_fn)
535 e->ops->elevator_merged_fn(q, rq, type); 536 e->ops->elevator_merged_fn(q, rq, type);
@@ -543,7 +544,7 @@ void elv_merged_request(struct request_queue *q, struct request *rq, int type)
543void elv_merge_requests(struct request_queue *q, struct request *rq, 544void elv_merge_requests(struct request_queue *q, struct request *rq,
544 struct request *next) 545 struct request *next)
545{ 546{
546 elevator_t *e = q->elevator; 547 struct elevator_queue *e = q->elevator;
547 548
548 if (e->ops->elevator_merge_req_fn) 549 if (e->ops->elevator_merge_req_fn)
549 e->ops->elevator_merge_req_fn(q, rq, next); 550 e->ops->elevator_merge_req_fn(q, rq, next);
@@ -846,7 +847,7 @@ void elv_dequeue_request(struct request_queue *q, struct request *rq)
846 847
847int elv_queue_empty(struct request_queue *q) 848int elv_queue_empty(struct request_queue *q)
848{ 849{
849 elevator_t *e = q->elevator; 850 struct elevator_queue *e = q->elevator;
850 851
851 if (!list_empty(&q->queue_head)) 852 if (!list_empty(&q->queue_head))
852 return 0; 853 return 0;
@@ -860,7 +861,7 @@ EXPORT_SYMBOL(elv_queue_empty);
860 861
861struct request *elv_latter_request(struct request_queue *q, struct request *rq) 862struct request *elv_latter_request(struct request_queue *q, struct request *rq)
862{ 863{
863 elevator_t *e = q->elevator; 864 struct elevator_queue *e = q->elevator;
864 865
865 if (e->ops->elevator_latter_req_fn) 866 if (e->ops->elevator_latter_req_fn)
866 return e->ops->elevator_latter_req_fn(q, rq); 867 return e->ops->elevator_latter_req_fn(q, rq);
@@ -869,7 +870,7 @@ struct request *elv_latter_request(struct request_queue *q, struct request *rq)
869 870
870struct request *elv_former_request(struct request_queue *q, struct request *rq) 871struct request *elv_former_request(struct request_queue *q, struct request *rq)
871{ 872{
872 elevator_t *e = q->elevator; 873 struct elevator_queue *e = q->elevator;
873 874
874 if (e->ops->elevator_former_req_fn) 875 if (e->ops->elevator_former_req_fn)
875 return e->ops->elevator_former_req_fn(q, rq); 876 return e->ops->elevator_former_req_fn(q, rq);
@@ -878,7 +879,7 @@ struct request *elv_former_request(struct request_queue *q, struct request *rq)
878 879
879int elv_set_request(struct request_queue *q, struct request *rq, gfp_t gfp_mask) 880int elv_set_request(struct request_queue *q, struct request *rq, gfp_t gfp_mask)
880{ 881{
881 elevator_t *e = q->elevator; 882 struct elevator_queue *e = q->elevator;
882 883
883 if (e->ops->elevator_set_req_fn) 884 if (e->ops->elevator_set_req_fn)
884 return e->ops->elevator_set_req_fn(q, rq, gfp_mask); 885 return e->ops->elevator_set_req_fn(q, rq, gfp_mask);
@@ -889,7 +890,7 @@ int elv_set_request(struct request_queue *q, struct request *rq, gfp_t gfp_mask)
889 890
890void elv_put_request(struct request_queue *q, struct request *rq) 891void elv_put_request(struct request_queue *q, struct request *rq)
891{ 892{
892 elevator_t *e = q->elevator; 893 struct elevator_queue *e = q->elevator;
893 894
894 if (e->ops->elevator_put_req_fn) 895 if (e->ops->elevator_put_req_fn)
895 e->ops->elevator_put_req_fn(rq); 896 e->ops->elevator_put_req_fn(rq);
@@ -897,7 +898,7 @@ void elv_put_request(struct request_queue *q, struct request *rq)
897 898
898int elv_may_queue(struct request_queue *q, int rw) 899int elv_may_queue(struct request_queue *q, int rw)
899{ 900{
900 elevator_t *e = q->elevator; 901 struct elevator_queue *e = q->elevator;
901 902
902 if (e->ops->elevator_may_queue_fn) 903 if (e->ops->elevator_may_queue_fn)
903 return e->ops->elevator_may_queue_fn(q, rw); 904 return e->ops->elevator_may_queue_fn(q, rw);
@@ -920,7 +921,7 @@ EXPORT_SYMBOL(elv_abort_queue);
920 921
921void elv_completed_request(struct request_queue *q, struct request *rq) 922void elv_completed_request(struct request_queue *q, struct request *rq)
922{ 923{
923 elevator_t *e = q->elevator; 924 struct elevator_queue *e = q->elevator;
924 925
925 /* 926 /*
926 * request is released from the driver, io must be done 927 * request is released from the driver, io must be done
@@ -955,13 +956,14 @@ void elv_completed_request(struct request_queue *q, struct request *rq)
955static ssize_t 956static ssize_t
956elv_attr_show(struct kobject *kobj, struct attribute *attr, char *page) 957elv_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
957{ 958{
958 elevator_t *e = container_of(kobj, elevator_t, kobj);
959 struct elv_fs_entry *entry = to_elv(attr); 959 struct elv_fs_entry *entry = to_elv(attr);
960 struct elevator_queue *e;
960 ssize_t error; 961 ssize_t error;
961 962
962 if (!entry->show) 963 if (!entry->show)
963 return -EIO; 964 return -EIO;
964 965
966 e = container_of(kobj, struct elevator_queue, kobj);
965 mutex_lock(&e->sysfs_lock); 967 mutex_lock(&e->sysfs_lock);
966 error = e->ops ? entry->show(e, page) : -ENOENT; 968 error = e->ops ? entry->show(e, page) : -ENOENT;
967 mutex_unlock(&e->sysfs_lock); 969 mutex_unlock(&e->sysfs_lock);
@@ -972,13 +974,14 @@ static ssize_t
972elv_attr_store(struct kobject *kobj, struct attribute *attr, 974elv_attr_store(struct kobject *kobj, struct attribute *attr,
973 const char *page, size_t length) 975 const char *page, size_t length)
974{ 976{
975 elevator_t *e = container_of(kobj, elevator_t, kobj);
976 struct elv_fs_entry *entry = to_elv(attr); 977 struct elv_fs_entry *entry = to_elv(attr);
978 struct elevator_queue *e;
977 ssize_t error; 979 ssize_t error;
978 980
979 if (!entry->store) 981 if (!entry->store)
980 return -EIO; 982 return -EIO;
981 983
984 e = container_of(kobj, struct elevator_queue, kobj);
982 mutex_lock(&e->sysfs_lock); 985 mutex_lock(&e->sysfs_lock);
983 error = e->ops ? entry->store(e, page, length) : -ENOENT; 986 error = e->ops ? entry->store(e, page, length) : -ENOENT;
984 mutex_unlock(&e->sysfs_lock); 987 mutex_unlock(&e->sysfs_lock);
@@ -997,7 +1000,7 @@ static struct kobj_type elv_ktype = {
997 1000
998int elv_register_queue(struct request_queue *q) 1001int elv_register_queue(struct request_queue *q)
999{ 1002{
1000 elevator_t *e = q->elevator; 1003 struct elevator_queue *e = q->elevator;
1001 int error; 1004 int error;
1002 1005
1003 error = kobject_add(&e->kobj, &q->kobj, "%s", "iosched"); 1006 error = kobject_add(&e->kobj, &q->kobj, "%s", "iosched");
@@ -1015,7 +1018,7 @@ int elv_register_queue(struct request_queue *q)
1015 return error; 1018 return error;
1016} 1019}
1017 1020
1018static void __elv_unregister_queue(elevator_t *e) 1021static void __elv_unregister_queue(struct elevator_queue *e)
1019{ 1022{
1020 kobject_uevent(&e->kobj, KOBJ_REMOVE); 1023 kobject_uevent(&e->kobj, KOBJ_REMOVE);
1021 kobject_del(&e->kobj); 1024 kobject_del(&e->kobj);
@@ -1078,7 +1081,7 @@ EXPORT_SYMBOL_GPL(elv_unregister);
1078 */ 1081 */
1079static int elevator_switch(struct request_queue *q, struct elevator_type *new_e) 1082static int elevator_switch(struct request_queue *q, struct elevator_type *new_e)
1080{ 1083{
1081 elevator_t *old_elevator, *e; 1084 struct elevator_queue *old_elevator, *e;
1082 void *data; 1085 void *data;
1083 1086
1084 /* 1087 /*
@@ -1184,7 +1187,7 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name,
1184 1187
1185ssize_t elv_iosched_show(struct request_queue *q, char *name) 1188ssize_t elv_iosched_show(struct request_queue *q, char *name)
1186{ 1189{
1187 elevator_t *e = q->elevator; 1190 struct elevator_queue *e = q->elevator;
1188 struct elevator_type *elv = e->elevator_type; 1191 struct elevator_type *elv = e->elevator_type;
1189 struct elevator_type *__e; 1192 struct elevator_type *__e;
1190 int len = 0; 1193 int len = 0;
diff --git a/block/noop-iosched.c b/block/noop-iosched.c
index c23e02969650..3a0d369d08c7 100644
--- a/block/noop-iosched.c
+++ b/block/noop-iosched.c
@@ -76,7 +76,7 @@ static void *noop_init_queue(struct request_queue *q)
76 return nd; 76 return nd;
77} 77}
78 78
79static void noop_exit_queue(elevator_t *e) 79static void noop_exit_queue(struct elevator_queue *e)
80{ 80{
81 struct noop_data *nd = e->elevator_data; 81 struct noop_data *nd = e->elevator_data;
82 82