ia64/linux-2.6.18-xen.hg

view block/noop-iosched.c @ 890:2e94884f0e8d

Dom0 PCI: fix a regression introduced by the SR-IOV change

The device class may be changed during the early fixup. So need to
re-read the device class from pci_dev after the fixup.

The patch "PCI: centralize device setup code" (c/s 825) wrongly
cleaned up the device class re-read. This patch reverts that change.

Signed-off-by: Yu Zhao <yu.zhao@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jun 03 11:21:52 2009 +0100 (2009-06-03)
parents 831230e53067
children
line source
1 /*
2 * elevator noop
3 */
4 #include <linux/blkdev.h>
5 #include <linux/elevator.h>
6 #include <linux/bio.h>
7 #include <linux/module.h>
8 #include <linux/init.h>
10 struct noop_data {
11 struct list_head queue;
12 };
14 static void noop_merged_requests(request_queue_t *q, struct request *rq,
15 struct request *next)
16 {
17 list_del_init(&next->queuelist);
18 }
20 static int noop_dispatch(request_queue_t *q, int force)
21 {
22 struct noop_data *nd = q->elevator->elevator_data;
24 if (!list_empty(&nd->queue)) {
25 struct request *rq;
26 rq = list_entry(nd->queue.next, struct request, queuelist);
27 list_del_init(&rq->queuelist);
28 elv_dispatch_sort(q, rq);
29 return 1;
30 }
31 return 0;
32 }
34 static void noop_add_request(request_queue_t *q, struct request *rq)
35 {
36 struct noop_data *nd = q->elevator->elevator_data;
38 list_add_tail(&rq->queuelist, &nd->queue);
39 }
41 static int noop_queue_empty(request_queue_t *q)
42 {
43 struct noop_data *nd = q->elevator->elevator_data;
45 return list_empty(&nd->queue);
46 }
48 static struct request *
49 noop_former_request(request_queue_t *q, struct request *rq)
50 {
51 struct noop_data *nd = q->elevator->elevator_data;
53 if (rq->queuelist.prev == &nd->queue)
54 return NULL;
55 return list_entry(rq->queuelist.prev, struct request, queuelist);
56 }
58 static struct request *
59 noop_latter_request(request_queue_t *q, struct request *rq)
60 {
61 struct noop_data *nd = q->elevator->elevator_data;
63 if (rq->queuelist.next == &nd->queue)
64 return NULL;
65 return list_entry(rq->queuelist.next, struct request, queuelist);
66 }
68 static void *noop_init_queue(request_queue_t *q, elevator_t *e)
69 {
70 struct noop_data *nd;
72 nd = kmalloc(sizeof(*nd), GFP_KERNEL);
73 if (!nd)
74 return NULL;
75 INIT_LIST_HEAD(&nd->queue);
76 return nd;
77 }
79 static void noop_exit_queue(elevator_t *e)
80 {
81 struct noop_data *nd = e->elevator_data;
83 BUG_ON(!list_empty(&nd->queue));
84 kfree(nd);
85 }
87 static struct elevator_type elevator_noop = {
88 .ops = {
89 .elevator_merge_req_fn = noop_merged_requests,
90 .elevator_dispatch_fn = noop_dispatch,
91 .elevator_add_req_fn = noop_add_request,
92 .elevator_queue_empty_fn = noop_queue_empty,
93 .elevator_former_req_fn = noop_former_request,
94 .elevator_latter_req_fn = noop_latter_request,
95 .elevator_init_fn = noop_init_queue,
96 .elevator_exit_fn = noop_exit_queue,
97 },
98 .elevator_name = "noop",
99 .elevator_owner = THIS_MODULE,
100 };
102 static int __init noop_init(void)
103 {
104 return elv_register(&elevator_noop);
105 }
107 static void __exit noop_exit(void)
108 {
109 elv_unregister(&elevator_noop);
110 }
112 module_init(noop_init);
113 module_exit(noop_exit);
116 MODULE_AUTHOR("Jens Axboe");
117 MODULE_LICENSE("GPL");
118 MODULE_DESCRIPTION("No-op IO scheduler");