xen: purge 'blk' and 'ioreq' from function names in dataplane/xen-block.c
[qemu/ar7.git] / hw / block / dataplane / xen-block.c
blob8e3965e171eb792cad65ffd97f10c7e31b9d1a71
1 /*
2 * Copyright (c) 2018 Citrix Systems Inc.
3 * (c) Gerd Hoffmann <kraxel@redhat.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; under version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, see <http://www.gnu.org/licenses/>.
17 * Contributions after 2012-01-13 are licensed under the terms of the
18 * GNU GPL, version 2 or (at your option) any later version.
21 #include "qemu/osdep.h"
22 #include "qemu/error-report.h"
23 #include "qapi/error.h"
24 #include "hw/hw.h"
25 #include "hw/xen/xen_common.h"
26 #include "hw/block/xen_blkif.h"
27 #include "sysemu/block-backend.h"
28 #include "sysemu/iothread.h"
29 #include "xen-block.h"
31 typedef struct XenBlockRequest {
32 blkif_request_t req;
33 int16_t status;
34 off_t start;
35 QEMUIOVector v;
36 void *buf;
37 size_t size;
38 int presync;
39 int aio_inflight;
40 int aio_errors;
41 XenBlockDataPlane *dataplane;
42 QLIST_ENTRY(XenBlockRequest) list;
43 BlockAcctCookie acct;
44 } XenBlockRequest;
46 struct XenBlockDataPlane {
47 XenDevice *xendev;
48 XenEventChannel *event_channel;
49 unsigned int *ring_ref;
50 unsigned int nr_ring_ref;
51 void *sring;
52 int64_t file_blk;
53 int64_t file_size;
54 int protocol;
55 blkif_back_rings_t rings;
56 int more_work;
57 QLIST_HEAD(inflight_head, XenBlockRequest) inflight;
58 QLIST_HEAD(finished_head, XenBlockRequest) finished;
59 QLIST_HEAD(freelist_head, XenBlockRequest) freelist;
60 int requests_total;
61 int requests_inflight;
62 int requests_finished;
63 unsigned int max_requests;
64 BlockBackend *blk;
65 QEMUBH *bh;
66 IOThread *iothread;
67 AioContext *ctx;
70 static void reset_request(XenBlockRequest *request)
72 memset(&request->req, 0, sizeof(request->req));
73 request->status = 0;
74 request->start = 0;
75 request->buf = NULL;
76 request->size = 0;
77 request->presync = 0;
79 request->aio_inflight = 0;
80 request->aio_errors = 0;
82 request->dataplane = NULL;
83 memset(&request->list, 0, sizeof(request->list));
84 memset(&request->acct, 0, sizeof(request->acct));
86 qemu_iovec_reset(&request->v);
89 static XenBlockRequest *xen_block_start_request(XenBlockDataPlane *dataplane)
91 XenBlockRequest *request = NULL;
93 if (QLIST_EMPTY(&dataplane->freelist)) {
94 if (dataplane->requests_total >= dataplane->max_requests) {
95 goto out;
97 /* allocate new struct */
98 request = g_malloc0(sizeof(*request));
99 request->dataplane = dataplane;
100 dataplane->requests_total++;
101 qemu_iovec_init(&request->v, 1);
102 } else {
103 /* get one from freelist */
104 request = QLIST_FIRST(&dataplane->freelist);
105 QLIST_REMOVE(request, list);
107 QLIST_INSERT_HEAD(&dataplane->inflight, request, list);
108 dataplane->requests_inflight++;
110 out:
111 return request;
114 static void xen_block_finish_request(XenBlockRequest *request)
116 XenBlockDataPlane *dataplane = request->dataplane;
118 QLIST_REMOVE(request, list);
119 QLIST_INSERT_HEAD(&dataplane->finished, request, list);
120 dataplane->requests_inflight--;
121 dataplane->requests_finished++;
124 static void xen_block_release_request(XenBlockRequest *request, bool finish)
126 XenBlockDataPlane *dataplane = request->dataplane;
128 QLIST_REMOVE(request, list);
129 reset_request(request);
130 request->dataplane = dataplane;
131 QLIST_INSERT_HEAD(&dataplane->freelist, request, list);
132 if (finish) {
133 dataplane->requests_finished--;
134 } else {
135 dataplane->requests_inflight--;
140 * translate request into iovec + start offset
141 * do sanity checks along the way
143 static int xen_block_parse_request(XenBlockRequest *request)
145 XenBlockDataPlane *dataplane = request->dataplane;
146 size_t len;
147 int i;
149 switch (request->req.operation) {
150 case BLKIF_OP_READ:
151 break;
152 case BLKIF_OP_FLUSH_DISKCACHE:
153 request->presync = 1;
154 if (!request->req.nr_segments) {
155 return 0;
157 /* fall through */
158 case BLKIF_OP_WRITE:
159 break;
160 case BLKIF_OP_DISCARD:
161 return 0;
162 default:
163 error_report("error: unknown operation (%d)", request->req.operation);
164 goto err;
167 if (request->req.operation != BLKIF_OP_READ &&
168 blk_is_read_only(dataplane->blk)) {
169 error_report("error: write req for ro device");
170 goto err;
173 request->start = request->req.sector_number * dataplane->file_blk;
174 for (i = 0; i < request->req.nr_segments; i++) {
175 if (i == BLKIF_MAX_SEGMENTS_PER_REQUEST) {
176 error_report("error: nr_segments too big");
177 goto err;
179 if (request->req.seg[i].first_sect > request->req.seg[i].last_sect) {
180 error_report("error: first > last sector");
181 goto err;
183 if (request->req.seg[i].last_sect * dataplane->file_blk >=
184 XC_PAGE_SIZE) {
185 error_report("error: page crossing");
186 goto err;
189 len = (request->req.seg[i].last_sect -
190 request->req.seg[i].first_sect + 1) * dataplane->file_blk;
191 request->size += len;
193 if (request->start + request->size > dataplane->file_size) {
194 error_report("error: access beyond end of file");
195 goto err;
197 return 0;
199 err:
200 request->status = BLKIF_RSP_ERROR;
201 return -1;
204 static int xen_block_copy_request(XenBlockRequest *request)
206 XenBlockDataPlane *dataplane = request->dataplane;
207 XenDevice *xendev = dataplane->xendev;
208 XenDeviceGrantCopySegment segs[BLKIF_MAX_SEGMENTS_PER_REQUEST];
209 int i, count;
210 int64_t file_blk = dataplane->file_blk;
211 bool to_domain = (request->req.operation == BLKIF_OP_READ);
212 void *virt = request->buf;
213 Error *local_err = NULL;
215 if (request->req.nr_segments == 0) {
216 return 0;
219 count = request->req.nr_segments;
221 for (i = 0; i < count; i++) {
222 if (to_domain) {
223 segs[i].dest.foreign.ref = request->req.seg[i].gref;
224 segs[i].dest.foreign.offset = request->req.seg[i].first_sect *
225 file_blk;
226 segs[i].source.virt = virt;
227 } else {
228 segs[i].source.foreign.ref = request->req.seg[i].gref;
229 segs[i].source.foreign.offset = request->req.seg[i].first_sect *
230 file_blk;
231 segs[i].dest.virt = virt;
233 segs[i].len = (request->req.seg[i].last_sect -
234 request->req.seg[i].first_sect + 1) * file_blk;
235 virt += segs[i].len;
238 xen_device_copy_grant_refs(xendev, to_domain, segs, count, &local_err);
240 if (local_err) {
241 error_reportf_err(local_err, "failed to copy data: ");
243 request->aio_errors++;
244 return -1;
247 return 0;
250 static int xen_block_do_aio(XenBlockRequest *request);
252 static void xen_block_complete_aio(void *opaque, int ret)
254 XenBlockRequest *request = opaque;
255 XenBlockDataPlane *dataplane = request->dataplane;
257 aio_context_acquire(dataplane->ctx);
259 if (ret != 0) {
260 error_report("%s I/O error",
261 request->req.operation == BLKIF_OP_READ ?
262 "read" : "write");
263 request->aio_errors++;
266 request->aio_inflight--;
267 if (request->presync) {
268 request->presync = 0;
269 xen_block_do_aio(request);
270 goto done;
272 if (request->aio_inflight > 0) {
273 goto done;
276 switch (request->req.operation) {
277 case BLKIF_OP_READ:
278 /* in case of failure request->aio_errors is increased */
279 if (ret == 0) {
280 xen_block_copy_request(request);
282 qemu_vfree(request->buf);
283 break;
284 case BLKIF_OP_WRITE:
285 case BLKIF_OP_FLUSH_DISKCACHE:
286 if (!request->req.nr_segments) {
287 break;
289 qemu_vfree(request->buf);
290 break;
291 default:
292 break;
295 request->status = request->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY;
296 xen_block_finish_request(request);
298 switch (request->req.operation) {
299 case BLKIF_OP_WRITE:
300 case BLKIF_OP_FLUSH_DISKCACHE:
301 if (!request->req.nr_segments) {
302 break;
304 case BLKIF_OP_READ:
305 if (request->status == BLKIF_RSP_OKAY) {
306 block_acct_done(blk_get_stats(dataplane->blk), &request->acct);
307 } else {
308 block_acct_failed(blk_get_stats(dataplane->blk), &request->acct);
310 break;
311 case BLKIF_OP_DISCARD:
312 default:
313 break;
315 qemu_bh_schedule(dataplane->bh);
317 done:
318 aio_context_release(dataplane->ctx);
321 static bool xen_block_split_discard(XenBlockRequest *request,
322 blkif_sector_t sector_number,
323 uint64_t nr_sectors)
325 XenBlockDataPlane *dataplane = request->dataplane;
326 int64_t byte_offset;
327 int byte_chunk;
328 uint64_t byte_remaining, limit;
329 uint64_t sec_start = sector_number;
330 uint64_t sec_count = nr_sectors;
332 /* Wrap around, or overflowing byte limit? */
333 if (sec_start + sec_count < sec_count ||
334 sec_start + sec_count > INT64_MAX / dataplane->file_blk) {
335 return false;
338 limit = BDRV_REQUEST_MAX_SECTORS * dataplane->file_blk;
339 byte_offset = sec_start * dataplane->file_blk;
340 byte_remaining = sec_count * dataplane->file_blk;
342 do {
343 byte_chunk = byte_remaining > limit ? limit : byte_remaining;
344 request->aio_inflight++;
345 blk_aio_pdiscard(dataplane->blk, byte_offset, byte_chunk,
346 xen_block_complete_aio, request);
347 byte_remaining -= byte_chunk;
348 byte_offset += byte_chunk;
349 } while (byte_remaining > 0);
351 return true;
354 static int xen_block_do_aio(XenBlockRequest *request)
356 XenBlockDataPlane *dataplane = request->dataplane;
358 request->buf = qemu_memalign(XC_PAGE_SIZE, request->size);
359 if (request->req.nr_segments &&
360 (request->req.operation == BLKIF_OP_WRITE ||
361 request->req.operation == BLKIF_OP_FLUSH_DISKCACHE) &&
362 xen_block_copy_request(request)) {
363 qemu_vfree(request->buf);
364 goto err;
367 request->aio_inflight++;
368 if (request->presync) {
369 blk_aio_flush(request->dataplane->blk, xen_block_complete_aio,
370 request);
371 return 0;
374 switch (request->req.operation) {
375 case BLKIF_OP_READ:
376 qemu_iovec_add(&request->v, request->buf, request->size);
377 block_acct_start(blk_get_stats(dataplane->blk), &request->acct,
378 request->v.size, BLOCK_ACCT_READ);
379 request->aio_inflight++;
380 blk_aio_preadv(dataplane->blk, request->start, &request->v, 0,
381 xen_block_complete_aio, request);
382 break;
383 case BLKIF_OP_WRITE:
384 case BLKIF_OP_FLUSH_DISKCACHE:
385 if (!request->req.nr_segments) {
386 break;
389 qemu_iovec_add(&request->v, request->buf, request->size);
390 block_acct_start(blk_get_stats(dataplane->blk), &request->acct,
391 request->v.size,
392 request->req.operation == BLKIF_OP_WRITE ?
393 BLOCK_ACCT_WRITE : BLOCK_ACCT_FLUSH);
394 request->aio_inflight++;
395 blk_aio_pwritev(dataplane->blk, request->start, &request->v, 0,
396 xen_block_complete_aio, request);
397 break;
398 case BLKIF_OP_DISCARD:
400 struct blkif_request_discard *req = (void *)&request->req;
401 if (!xen_block_split_discard(request, req->sector_number,
402 req->nr_sectors)) {
403 goto err;
405 break;
407 default:
408 /* unknown operation (shouldn't happen -- parse catches this) */
409 goto err;
412 xen_block_complete_aio(request, 0);
414 return 0;
416 err:
417 xen_block_finish_request(request);
418 request->status = BLKIF_RSP_ERROR;
419 return -1;
422 static int xen_block_send_response_one(XenBlockRequest *request)
424 XenBlockDataPlane *dataplane = request->dataplane;
425 int send_notify = 0;
426 int have_requests = 0;
427 blkif_response_t *resp;
429 /* Place on the response ring for the relevant domain. */
430 switch (dataplane->protocol) {
431 case BLKIF_PROTOCOL_NATIVE:
432 resp = (blkif_response_t *)RING_GET_RESPONSE(
433 &dataplane->rings.native,
434 dataplane->rings.native.rsp_prod_pvt);
435 break;
436 case BLKIF_PROTOCOL_X86_32:
437 resp = (blkif_response_t *)RING_GET_RESPONSE(
438 &dataplane->rings.x86_32_part,
439 dataplane->rings.x86_32_part.rsp_prod_pvt);
440 break;
441 case BLKIF_PROTOCOL_X86_64:
442 resp = (blkif_response_t *)RING_GET_RESPONSE(
443 &dataplane->rings.x86_64_part,
444 dataplane->rings.x86_64_part.rsp_prod_pvt);
445 break;
446 default:
447 return 0;
450 resp->id = request->req.id;
451 resp->operation = request->req.operation;
452 resp->status = request->status;
454 dataplane->rings.common.rsp_prod_pvt++;
456 RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&dataplane->rings.common,
457 send_notify);
458 if (dataplane->rings.common.rsp_prod_pvt ==
459 dataplane->rings.common.req_cons) {
461 * Tail check for pending requests. Allows frontend to avoid
462 * notifications if requests are already in flight (lower
463 * overheads and promotes batching).
465 RING_FINAL_CHECK_FOR_REQUESTS(&dataplane->rings.common,
466 have_requests);
467 } else if (RING_HAS_UNCONSUMED_REQUESTS(&dataplane->rings.common)) {
468 have_requests = 1;
471 if (have_requests) {
472 dataplane->more_work++;
474 return send_notify;
477 /* walk finished list, send outstanding responses, free requests */
478 static void xen_block_send_response_all(XenBlockDataPlane *dataplane)
480 XenBlockRequest *request;
481 int send_notify = 0;
483 while (!QLIST_EMPTY(&dataplane->finished)) {
484 request = QLIST_FIRST(&dataplane->finished);
485 send_notify += xen_block_send_response_one(request);
486 xen_block_release_request(request, true);
488 if (send_notify) {
489 Error *local_err = NULL;
491 xen_device_notify_event_channel(dataplane->xendev,
492 dataplane->event_channel,
493 &local_err);
494 if (local_err) {
495 error_report_err(local_err);
500 static int xen_block_get_request(XenBlockDataPlane *dataplane,
501 XenBlockRequest *request, RING_IDX rc)
503 switch (dataplane->protocol) {
504 case BLKIF_PROTOCOL_NATIVE: {
505 blkif_request_t *req =
506 RING_GET_REQUEST(&dataplane->rings.native, rc);
508 memcpy(&request->req, req, sizeof(request->req));
509 break;
511 case BLKIF_PROTOCOL_X86_32: {
512 blkif_x86_32_request_t *req =
513 RING_GET_REQUEST(&dataplane->rings.x86_32_part, rc);
515 blkif_get_x86_32_req(&request->req, req);
516 break;
518 case BLKIF_PROTOCOL_X86_64: {
519 blkif_x86_64_request_t *req =
520 RING_GET_REQUEST(&dataplane->rings.x86_64_part, rc);
522 blkif_get_x86_64_req(&request->req, req);
523 break;
526 /* Prevent the compiler from accessing the on-ring fields instead. */
527 barrier();
528 return 0;
531 static void xen_block_handle_requests(XenBlockDataPlane *dataplane)
533 RING_IDX rc, rp;
534 XenBlockRequest *request;
536 dataplane->more_work = 0;
538 rc = dataplane->rings.common.req_cons;
539 rp = dataplane->rings.common.sring->req_prod;
540 xen_rmb(); /* Ensure we see queued requests up to 'rp'. */
542 xen_block_send_response_all(dataplane);
543 while (rc != rp) {
544 /* pull request from ring */
545 if (RING_REQUEST_CONS_OVERFLOW(&dataplane->rings.common, rc)) {
546 break;
548 request = xen_block_start_request(dataplane);
549 if (request == NULL) {
550 dataplane->more_work++;
551 break;
553 xen_block_get_request(dataplane, request, rc);
554 dataplane->rings.common.req_cons = ++rc;
556 /* parse them */
557 if (xen_block_parse_request(request) != 0) {
558 switch (request->req.operation) {
559 case BLKIF_OP_READ:
560 block_acct_invalid(blk_get_stats(dataplane->blk),
561 BLOCK_ACCT_READ);
562 break;
563 case BLKIF_OP_WRITE:
564 block_acct_invalid(blk_get_stats(dataplane->blk),
565 BLOCK_ACCT_WRITE);
566 break;
567 case BLKIF_OP_FLUSH_DISKCACHE:
568 block_acct_invalid(blk_get_stats(dataplane->blk),
569 BLOCK_ACCT_FLUSH);
570 default:
571 break;
574 if (xen_block_send_response_one(request)) {
575 Error *local_err = NULL;
577 xen_device_notify_event_channel(dataplane->xendev,
578 dataplane->event_channel,
579 &local_err);
580 if (local_err) {
581 error_report_err(local_err);
584 xen_block_release_request(request, false);
585 continue;
588 xen_block_do_aio(request);
591 if (dataplane->more_work &&
592 dataplane->requests_inflight < dataplane->max_requests) {
593 qemu_bh_schedule(dataplane->bh);
597 static void xen_block_dataplane_bh(void *opaque)
599 XenBlockDataPlane *dataplane = opaque;
601 aio_context_acquire(dataplane->ctx);
602 xen_block_handle_requests(dataplane);
603 aio_context_release(dataplane->ctx);
606 static void xen_block_dataplane_event(void *opaque)
608 XenBlockDataPlane *dataplane = opaque;
610 qemu_bh_schedule(dataplane->bh);
613 XenBlockDataPlane *xen_block_dataplane_create(XenDevice *xendev,
614 BlockConf *conf,
615 IOThread *iothread)
617 XenBlockDataPlane *dataplane = g_new0(XenBlockDataPlane, 1);
619 dataplane->xendev = xendev;
620 dataplane->file_blk = conf->logical_block_size;
621 dataplane->blk = conf->blk;
622 dataplane->file_size = blk_getlength(dataplane->blk);
624 QLIST_INIT(&dataplane->inflight);
625 QLIST_INIT(&dataplane->finished);
626 QLIST_INIT(&dataplane->freelist);
628 if (iothread) {
629 dataplane->iothread = iothread;
630 object_ref(OBJECT(dataplane->iothread));
631 dataplane->ctx = iothread_get_aio_context(dataplane->iothread);
632 } else {
633 dataplane->ctx = qemu_get_aio_context();
635 dataplane->bh = aio_bh_new(dataplane->ctx, xen_block_dataplane_bh,
636 dataplane);
638 return dataplane;
641 void xen_block_dataplane_destroy(XenBlockDataPlane *dataplane)
643 XenBlockRequest *request;
645 if (!dataplane) {
646 return;
649 while (!QLIST_EMPTY(&dataplane->freelist)) {
650 request = QLIST_FIRST(&dataplane->freelist);
651 QLIST_REMOVE(request, list);
652 qemu_iovec_destroy(&request->v);
653 g_free(request);
656 qemu_bh_delete(dataplane->bh);
657 if (dataplane->iothread) {
658 object_unref(OBJECT(dataplane->iothread));
661 g_free(dataplane);
664 void xen_block_dataplane_stop(XenBlockDataPlane *dataplane)
666 XenDevice *xendev;
668 if (!dataplane) {
669 return;
672 aio_context_acquire(dataplane->ctx);
673 blk_set_aio_context(dataplane->blk, qemu_get_aio_context());
674 aio_context_release(dataplane->ctx);
676 xendev = dataplane->xendev;
678 if (dataplane->event_channel) {
679 Error *local_err = NULL;
681 xen_device_unbind_event_channel(xendev, dataplane->event_channel,
682 &local_err);
683 dataplane->event_channel = NULL;
685 if (local_err) {
686 error_report_err(local_err);
690 if (dataplane->sring) {
691 Error *local_err = NULL;
693 xen_device_unmap_grant_refs(xendev, dataplane->sring,
694 dataplane->nr_ring_ref, &local_err);
695 dataplane->sring = NULL;
697 if (local_err) {
698 error_report_err(local_err);
702 g_free(dataplane->ring_ref);
703 dataplane->ring_ref = NULL;
706 void xen_block_dataplane_start(XenBlockDataPlane *dataplane,
707 const unsigned int ring_ref[],
708 unsigned int nr_ring_ref,
709 unsigned int event_channel,
710 unsigned int protocol,
711 Error **errp)
713 XenDevice *xendev = dataplane->xendev;
714 Error *local_err = NULL;
715 unsigned int ring_size;
716 unsigned int i;
718 dataplane->nr_ring_ref = nr_ring_ref;
719 dataplane->ring_ref = g_new(unsigned int, nr_ring_ref);
721 for (i = 0; i < nr_ring_ref; i++) {
722 dataplane->ring_ref[i] = ring_ref[i];
725 dataplane->protocol = protocol;
727 ring_size = XC_PAGE_SIZE * dataplane->nr_ring_ref;
728 switch (dataplane->protocol) {
729 case BLKIF_PROTOCOL_NATIVE:
731 dataplane->max_requests = __CONST_RING_SIZE(blkif, ring_size);
732 break;
734 case BLKIF_PROTOCOL_X86_32:
736 dataplane->max_requests = __CONST_RING_SIZE(blkif_x86_32, ring_size);
737 break;
739 case BLKIF_PROTOCOL_X86_64:
741 dataplane->max_requests = __CONST_RING_SIZE(blkif_x86_64, ring_size);
742 break;
744 default:
745 error_setg(errp, "unknown protocol %u", dataplane->protocol);
746 return;
749 xen_device_set_max_grant_refs(xendev, dataplane->nr_ring_ref,
750 &local_err);
751 if (local_err) {
752 error_propagate(errp, local_err);
753 goto stop;
756 dataplane->sring = xen_device_map_grant_refs(xendev,
757 dataplane->ring_ref,
758 dataplane->nr_ring_ref,
759 PROT_READ | PROT_WRITE,
760 &local_err);
761 if (local_err) {
762 error_propagate(errp, local_err);
763 goto stop;
766 switch (dataplane->protocol) {
767 case BLKIF_PROTOCOL_NATIVE:
769 blkif_sring_t *sring_native = dataplane->sring;
771 BACK_RING_INIT(&dataplane->rings.native, sring_native, ring_size);
772 break;
774 case BLKIF_PROTOCOL_X86_32:
776 blkif_x86_32_sring_t *sring_x86_32 = dataplane->sring;
778 BACK_RING_INIT(&dataplane->rings.x86_32_part, sring_x86_32,
779 ring_size);
780 break;
782 case BLKIF_PROTOCOL_X86_64:
784 blkif_x86_64_sring_t *sring_x86_64 = dataplane->sring;
786 BACK_RING_INIT(&dataplane->rings.x86_64_part, sring_x86_64,
787 ring_size);
788 break;
792 dataplane->event_channel =
793 xen_device_bind_event_channel(xendev, event_channel,
794 xen_block_dataplane_event, dataplane,
795 &local_err);
796 if (local_err) {
797 error_propagate(errp, local_err);
798 goto stop;
801 aio_context_acquire(dataplane->ctx);
802 blk_set_aio_context(dataplane->blk, dataplane->ctx);
803 aio_context_release(dataplane->ctx);
804 return;
806 stop:
807 xen_block_dataplane_stop(dataplane);