Revision 72cf2d4f hw/xen_disk.c
b/hw/xen_disk.c | ||
---|---|---|
77 | 77 |
int aio_errors; |
78 | 78 |
|
79 | 79 |
struct XenBlkDev *blkdev; |
80 |
LIST_ENTRY(ioreq) list; |
|
80 |
QLIST_ENTRY(ioreq) list;
|
|
81 | 81 |
}; |
82 | 82 |
|
83 | 83 |
struct XenBlkDev { |
... | ... | |
99 | 99 |
int cnt_map; |
100 | 100 |
|
101 | 101 |
/* request lists */ |
102 |
LIST_HEAD(inflight_head, ioreq) inflight; |
|
103 |
LIST_HEAD(finished_head, ioreq) finished; |
|
104 |
LIST_HEAD(freelist_head, ioreq) freelist; |
|
102 |
QLIST_HEAD(inflight_head, ioreq) inflight;
|
|
103 |
QLIST_HEAD(finished_head, ioreq) finished;
|
|
104 |
QLIST_HEAD(freelist_head, ioreq) freelist;
|
|
105 | 105 |
int requests_total; |
106 | 106 |
int requests_inflight; |
107 | 107 |
int requests_finished; |
... | ... | |
118 | 118 |
{ |
119 | 119 |
struct ioreq *ioreq = NULL; |
120 | 120 |
|
121 |
if (LIST_EMPTY(&blkdev->freelist)) { |
|
121 |
if (QLIST_EMPTY(&blkdev->freelist)) {
|
|
122 | 122 |
if (blkdev->requests_total >= max_requests) |
123 | 123 |
goto out; |
124 | 124 |
/* allocate new struct */ |
... | ... | |
128 | 128 |
qemu_iovec_init(&ioreq->v, BLKIF_MAX_SEGMENTS_PER_REQUEST); |
129 | 129 |
} else { |
130 | 130 |
/* get one from freelist */ |
131 |
ioreq = LIST_FIRST(&blkdev->freelist); |
|
132 |
LIST_REMOVE(ioreq, list); |
|
131 |
ioreq = QLIST_FIRST(&blkdev->freelist);
|
|
132 |
QLIST_REMOVE(ioreq, list);
|
|
133 | 133 |
qemu_iovec_reset(&ioreq->v); |
134 | 134 |
} |
135 |
LIST_INSERT_HEAD(&blkdev->inflight, ioreq, list); |
|
135 |
QLIST_INSERT_HEAD(&blkdev->inflight, ioreq, list);
|
|
136 | 136 |
blkdev->requests_inflight++; |
137 | 137 |
|
138 | 138 |
out: |
... | ... | |
143 | 143 |
{ |
144 | 144 |
struct XenBlkDev *blkdev = ioreq->blkdev; |
145 | 145 |
|
146 |
LIST_REMOVE(ioreq, list); |
|
147 |
LIST_INSERT_HEAD(&blkdev->finished, ioreq, list); |
|
146 |
QLIST_REMOVE(ioreq, list);
|
|
147 |
QLIST_INSERT_HEAD(&blkdev->finished, ioreq, list);
|
|
148 | 148 |
blkdev->requests_inflight--; |
149 | 149 |
blkdev->requests_finished++; |
150 | 150 |
} |
... | ... | |
153 | 153 |
{ |
154 | 154 |
struct XenBlkDev *blkdev = ioreq->blkdev; |
155 | 155 |
|
156 |
LIST_REMOVE(ioreq, list); |
|
156 |
QLIST_REMOVE(ioreq, list);
|
|
157 | 157 |
memset(ioreq, 0, sizeof(*ioreq)); |
158 | 158 |
ioreq->blkdev = blkdev; |
159 |
LIST_INSERT_HEAD(&blkdev->freelist, ioreq, list); |
|
159 |
QLIST_INSERT_HEAD(&blkdev->freelist, ioreq, list);
|
|
160 | 160 |
blkdev->requests_finished--; |
161 | 161 |
} |
162 | 162 |
|
... | ... | |
476 | 476 |
struct ioreq *ioreq; |
477 | 477 |
int send_notify = 0; |
478 | 478 |
|
479 |
while (!LIST_EMPTY(&blkdev->finished)) { |
|
480 |
ioreq = LIST_FIRST(&blkdev->finished); |
|
479 |
while (!QLIST_EMPTY(&blkdev->finished)) {
|
|
480 |
ioreq = QLIST_FIRST(&blkdev->finished);
|
|
481 | 481 |
send_notify += blk_send_response_one(ioreq); |
482 | 482 |
ioreq_release(ioreq); |
483 | 483 |
} |
... | ... | |
564 | 564 |
{ |
565 | 565 |
struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev); |
566 | 566 |
|
567 |
LIST_INIT(&blkdev->inflight); |
|
568 |
LIST_INIT(&blkdev->finished); |
|
569 |
LIST_INIT(&blkdev->freelist); |
|
567 |
QLIST_INIT(&blkdev->inflight);
|
|
568 |
QLIST_INIT(&blkdev->finished);
|
|
569 |
QLIST_INIT(&blkdev->freelist);
|
|
570 | 570 |
blkdev->bh = qemu_bh_new(blk_bh, blkdev); |
571 | 571 |
if (xen_mode != XEN_EMULATE) |
572 | 572 |
batch_maps = 1; |
... | ... | |
750 | 750 |
struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev); |
751 | 751 |
struct ioreq *ioreq; |
752 | 752 |
|
753 |
while (!LIST_EMPTY(&blkdev->freelist)) { |
|
754 |
ioreq = LIST_FIRST(&blkdev->freelist); |
|
755 |
LIST_REMOVE(ioreq, list); |
|
753 |
while (!QLIST_EMPTY(&blkdev->freelist)) {
|
|
754 |
ioreq = QLIST_FIRST(&blkdev->freelist);
|
|
755 |
QLIST_REMOVE(ioreq, list);
|
|
756 | 756 |
qemu_iovec_destroy(&ioreq->v); |
757 | 757 |
qemu_free(ioreq); |
758 | 758 |
} |
Also available in: Unified diff