xen: remove 'ioreq' struct/varable/field names from dataplane/xen-block.c

This is a purely cosmetic patch that purges the name 'ioreq' from struct,
variable and field names. (This name has been problematic for a long time
as 'ioreq' is the name used for generic I/O requests coming from Xen).
The patch replaces 'struct ioreq' with a new 'XenBlockRequest' type and
'ioreq' field/variable names with 'request', and then does necessary
fix-up to adhere to coding style.

Function names are not modified by this patch. They will be dealt with in
a subsequent patch.

No functional change.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
This commit is contained in:
Paul Durrant 2019-01-08 14:48:57 +00:00 committed by Anthony PERARD
parent f3b604e31d
commit e7f5b5f841

View file

@ -28,7 +28,7 @@
#include "sysemu/iothread.h" #include "sysemu/iothread.h"
#include "xen-block.h" #include "xen-block.h"
struct ioreq { typedef struct XenBlockRequest {
blkif_request_t req; blkif_request_t req;
int16_t status; int16_t status;
off_t start; off_t start;
@ -39,9 +39,9 @@ struct ioreq {
int aio_inflight; int aio_inflight;
int aio_errors; int aio_errors;
XenBlockDataPlane *dataplane; XenBlockDataPlane *dataplane;
QLIST_ENTRY(ioreq) list; QLIST_ENTRY(XenBlockRequest) list;
BlockAcctCookie acct; BlockAcctCookie acct;
}; } XenBlockRequest;
struct XenBlockDataPlane { struct XenBlockDataPlane {
XenDevice *xendev; XenDevice *xendev;
@ -54,9 +54,9 @@ struct XenBlockDataPlane {
int protocol; int protocol;
blkif_back_rings_t rings; blkif_back_rings_t rings;
int more_work; int more_work;
QLIST_HEAD(inflight_head, ioreq) inflight; QLIST_HEAD(inflight_head, XenBlockRequest) inflight;
QLIST_HEAD(finished_head, ioreq) finished; QLIST_HEAD(finished_head, XenBlockRequest) finished;
QLIST_HEAD(freelist_head, ioreq) freelist; QLIST_HEAD(freelist_head, XenBlockRequest) freelist;
int requests_total; int requests_total;
int requests_inflight; int requests_inflight;
int requests_finished; int requests_finished;
@ -67,68 +67,68 @@ struct XenBlockDataPlane {
AioContext *ctx; AioContext *ctx;
}; };
static void ioreq_reset(struct ioreq *ioreq) static void ioreq_reset(XenBlockRequest *request)
{ {
memset(&ioreq->req, 0, sizeof(ioreq->req)); memset(&request->req, 0, sizeof(request->req));
ioreq->status = 0; request->status = 0;
ioreq->start = 0; request->start = 0;
ioreq->buf = NULL; request->buf = NULL;
ioreq->size = 0; request->size = 0;
ioreq->presync = 0; request->presync = 0;
ioreq->aio_inflight = 0; request->aio_inflight = 0;
ioreq->aio_errors = 0; request->aio_errors = 0;
ioreq->dataplane = NULL; request->dataplane = NULL;
memset(&ioreq->list, 0, sizeof(ioreq->list)); memset(&request->list, 0, sizeof(request->list));
memset(&ioreq->acct, 0, sizeof(ioreq->acct)); memset(&request->acct, 0, sizeof(request->acct));
qemu_iovec_reset(&ioreq->v); qemu_iovec_reset(&request->v);
} }
static struct ioreq *ioreq_start(XenBlockDataPlane *dataplane) static XenBlockRequest *ioreq_start(XenBlockDataPlane *dataplane)
{ {
struct ioreq *ioreq = NULL; XenBlockRequest *request = NULL;
if (QLIST_EMPTY(&dataplane->freelist)) { if (QLIST_EMPTY(&dataplane->freelist)) {
if (dataplane->requests_total >= dataplane->max_requests) { if (dataplane->requests_total >= dataplane->max_requests) {
goto out; goto out;
} }
/* allocate new struct */ /* allocate new struct */
ioreq = g_malloc0(sizeof(*ioreq)); request = g_malloc0(sizeof(*request));
ioreq->dataplane = dataplane; request->dataplane = dataplane;
dataplane->requests_total++; dataplane->requests_total++;
qemu_iovec_init(&ioreq->v, 1); qemu_iovec_init(&request->v, 1);
} else { } else {
/* get one from freelist */ /* get one from freelist */
ioreq = QLIST_FIRST(&dataplane->freelist); request = QLIST_FIRST(&dataplane->freelist);
QLIST_REMOVE(ioreq, list); QLIST_REMOVE(request, list);
} }
QLIST_INSERT_HEAD(&dataplane->inflight, ioreq, list); QLIST_INSERT_HEAD(&dataplane->inflight, request, list);
dataplane->requests_inflight++; dataplane->requests_inflight++;
out: out:
return ioreq; return request;
} }
static void ioreq_finish(struct ioreq *ioreq) static void ioreq_finish(XenBlockRequest *request)
{ {
XenBlockDataPlane *dataplane = ioreq->dataplane; XenBlockDataPlane *dataplane = request->dataplane;
QLIST_REMOVE(ioreq, list); QLIST_REMOVE(request, list);
QLIST_INSERT_HEAD(&dataplane->finished, ioreq, list); QLIST_INSERT_HEAD(&dataplane->finished, request, list);
dataplane->requests_inflight--; dataplane->requests_inflight--;
dataplane->requests_finished++; dataplane->requests_finished++;
} }
static void ioreq_release(struct ioreq *ioreq, bool finish) static void ioreq_release(XenBlockRequest *request, bool finish)
{ {
XenBlockDataPlane *dataplane = ioreq->dataplane; XenBlockDataPlane *dataplane = request->dataplane;
QLIST_REMOVE(ioreq, list); QLIST_REMOVE(request, list);
ioreq_reset(ioreq); ioreq_reset(request);
ioreq->dataplane = dataplane; request->dataplane = dataplane;
QLIST_INSERT_HEAD(&dataplane->freelist, ioreq, list); QLIST_INSERT_HEAD(&dataplane->freelist, request, list);
if (finish) { if (finish) {
dataplane->requests_finished--; dataplane->requests_finished--;
} else { } else {
@ -140,18 +140,18 @@ static void ioreq_release(struct ioreq *ioreq, bool finish)
* translate request into iovec + start offset * translate request into iovec + start offset
* do sanity checks along the way * do sanity checks along the way
*/ */
static int ioreq_parse(struct ioreq *ioreq) static int ioreq_parse(XenBlockRequest *request)
{ {
XenBlockDataPlane *dataplane = ioreq->dataplane; XenBlockDataPlane *dataplane = request->dataplane;
size_t len; size_t len;
int i; int i;
switch (ioreq->req.operation) { switch (request->req.operation) {
case BLKIF_OP_READ: case BLKIF_OP_READ:
break; break;
case BLKIF_OP_FLUSH_DISKCACHE: case BLKIF_OP_FLUSH_DISKCACHE:
ioreq->presync = 1; request->presync = 1;
if (!ioreq->req.nr_segments) { if (!request->req.nr_segments) {
return 0; return 0;
} }
/* fall through */ /* fall through */
@ -160,77 +160,78 @@ static int ioreq_parse(struct ioreq *ioreq)
case BLKIF_OP_DISCARD: case BLKIF_OP_DISCARD:
return 0; return 0;
default: default:
error_report("error: unknown operation (%d)", ioreq->req.operation); error_report("error: unknown operation (%d)", request->req.operation);
goto err; goto err;
}; };
if (ioreq->req.operation != BLKIF_OP_READ && if (request->req.operation != BLKIF_OP_READ &&
blk_is_read_only(dataplane->blk)) { blk_is_read_only(dataplane->blk)) {
error_report("error: write req for ro device"); error_report("error: write req for ro device");
goto err; goto err;
} }
ioreq->start = ioreq->req.sector_number * dataplane->file_blk; request->start = request->req.sector_number * dataplane->file_blk;
for (i = 0; i < ioreq->req.nr_segments; i++) { for (i = 0; i < request->req.nr_segments; i++) {
if (i == BLKIF_MAX_SEGMENTS_PER_REQUEST) { if (i == BLKIF_MAX_SEGMENTS_PER_REQUEST) {
error_report("error: nr_segments too big"); error_report("error: nr_segments too big");
goto err; goto err;
} }
if (ioreq->req.seg[i].first_sect > ioreq->req.seg[i].last_sect) { if (request->req.seg[i].first_sect > request->req.seg[i].last_sect) {
error_report("error: first > last sector"); error_report("error: first > last sector");
goto err; goto err;
} }
if (ioreq->req.seg[i].last_sect * dataplane->file_blk >= XC_PAGE_SIZE) { if (request->req.seg[i].last_sect * dataplane->file_blk >=
XC_PAGE_SIZE) {
error_report("error: page crossing"); error_report("error: page crossing");
goto err; goto err;
} }
len = (ioreq->req.seg[i].last_sect - len = (request->req.seg[i].last_sect -
ioreq->req.seg[i].first_sect + 1) * dataplane->file_blk; request->req.seg[i].first_sect + 1) * dataplane->file_blk;
ioreq->size += len; request->size += len;
} }
if (ioreq->start + ioreq->size > dataplane->file_size) { if (request->start + request->size > dataplane->file_size) {
error_report("error: access beyond end of file"); error_report("error: access beyond end of file");
goto err; goto err;
} }
return 0; return 0;
err: err:
ioreq->status = BLKIF_RSP_ERROR; request->status = BLKIF_RSP_ERROR;
return -1; return -1;
} }
static int ioreq_grant_copy(struct ioreq *ioreq) static int ioreq_grant_copy(XenBlockRequest *request)
{ {
XenBlockDataPlane *dataplane = ioreq->dataplane; XenBlockDataPlane *dataplane = request->dataplane;
XenDevice *xendev = dataplane->xendev; XenDevice *xendev = dataplane->xendev;
XenDeviceGrantCopySegment segs[BLKIF_MAX_SEGMENTS_PER_REQUEST]; XenDeviceGrantCopySegment segs[BLKIF_MAX_SEGMENTS_PER_REQUEST];
int i, count; int i, count;
int64_t file_blk = dataplane->file_blk; int64_t file_blk = dataplane->file_blk;
bool to_domain = (ioreq->req.operation == BLKIF_OP_READ); bool to_domain = (request->req.operation == BLKIF_OP_READ);
void *virt = ioreq->buf; void *virt = request->buf;
Error *local_err = NULL; Error *local_err = NULL;
if (ioreq->req.nr_segments == 0) { if (request->req.nr_segments == 0) {
return 0; return 0;
} }
count = ioreq->req.nr_segments; count = request->req.nr_segments;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (to_domain) { if (to_domain) {
segs[i].dest.foreign.ref = ioreq->req.seg[i].gref; segs[i].dest.foreign.ref = request->req.seg[i].gref;
segs[i].dest.foreign.offset = ioreq->req.seg[i].first_sect * segs[i].dest.foreign.offset = request->req.seg[i].first_sect *
file_blk; file_blk;
segs[i].source.virt = virt; segs[i].source.virt = virt;
} else { } else {
segs[i].source.foreign.ref = ioreq->req.seg[i].gref; segs[i].source.foreign.ref = request->req.seg[i].gref;
segs[i].source.foreign.offset = ioreq->req.seg[i].first_sect * segs[i].source.foreign.offset = request->req.seg[i].first_sect *
file_blk; file_blk;
segs[i].dest.virt = virt; segs[i].dest.virt = virt;
} }
segs[i].len = (ioreq->req.seg[i].last_sect - segs[i].len = (request->req.seg[i].last_sect -
ioreq->req.seg[i].first_sect + 1) * file_blk; request->req.seg[i].first_sect + 1) * file_blk;
virt += segs[i].len; virt += segs[i].len;
} }
@ -239,72 +240,72 @@ static int ioreq_grant_copy(struct ioreq *ioreq)
if (local_err) { if (local_err) {
error_reportf_err(local_err, "failed to copy data: "); error_reportf_err(local_err, "failed to copy data: ");
ioreq->aio_errors++; request->aio_errors++;
return -1; return -1;
} }
return 0; return 0;
} }
static int ioreq_runio_qemu_aio(struct ioreq *ioreq); static int ioreq_runio_qemu_aio(XenBlockRequest *request);
static void qemu_aio_complete(void *opaque, int ret) static void qemu_aio_complete(void *opaque, int ret)
{ {
struct ioreq *ioreq = opaque; XenBlockRequest *request = opaque;
XenBlockDataPlane *dataplane = ioreq->dataplane; XenBlockDataPlane *dataplane = request->dataplane;
aio_context_acquire(dataplane->ctx); aio_context_acquire(dataplane->ctx);
if (ret != 0) { if (ret != 0) {
error_report("%s I/O error", error_report("%s I/O error",
ioreq->req.operation == BLKIF_OP_READ ? request->req.operation == BLKIF_OP_READ ?
"read" : "write"); "read" : "write");
ioreq->aio_errors++; request->aio_errors++;
} }
ioreq->aio_inflight--; request->aio_inflight--;
if (ioreq->presync) { if (request->presync) {
ioreq->presync = 0; request->presync = 0;
ioreq_runio_qemu_aio(ioreq); ioreq_runio_qemu_aio(request);
goto done; goto done;
} }
if (ioreq->aio_inflight > 0) { if (request->aio_inflight > 0) {
goto done; goto done;
} }
switch (ioreq->req.operation) { switch (request->req.operation) {
case BLKIF_OP_READ: case BLKIF_OP_READ:
/* in case of failure ioreq->aio_errors is increased */ /* in case of failure request->aio_errors is increased */
if (ret == 0) { if (ret == 0) {
ioreq_grant_copy(ioreq); ioreq_grant_copy(request);
} }
qemu_vfree(ioreq->buf); qemu_vfree(request->buf);
break; break;
case BLKIF_OP_WRITE: case BLKIF_OP_WRITE:
case BLKIF_OP_FLUSH_DISKCACHE: case BLKIF_OP_FLUSH_DISKCACHE:
if (!ioreq->req.nr_segments) { if (!request->req.nr_segments) {
break; break;
} }
qemu_vfree(ioreq->buf); qemu_vfree(request->buf);
break; break;
default: default:
break; break;
} }
ioreq->status = ioreq->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY; request->status = request->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY;
ioreq_finish(ioreq); ioreq_finish(request);
switch (ioreq->req.operation) { switch (request->req.operation) {
case BLKIF_OP_WRITE: case BLKIF_OP_WRITE:
case BLKIF_OP_FLUSH_DISKCACHE: case BLKIF_OP_FLUSH_DISKCACHE:
if (!ioreq->req.nr_segments) { if (!request->req.nr_segments) {
break; break;
} }
case BLKIF_OP_READ: case BLKIF_OP_READ:
if (ioreq->status == BLKIF_RSP_OKAY) { if (request->status == BLKIF_RSP_OKAY) {
block_acct_done(blk_get_stats(dataplane->blk), &ioreq->acct); block_acct_done(blk_get_stats(dataplane->blk), &request->acct);
} else { } else {
block_acct_failed(blk_get_stats(dataplane->blk), &ioreq->acct); block_acct_failed(blk_get_stats(dataplane->blk), &request->acct);
} }
break; break;
case BLKIF_OP_DISCARD: case BLKIF_OP_DISCARD:
@ -317,10 +318,11 @@ done:
aio_context_release(dataplane->ctx); aio_context_release(dataplane->ctx);
} }
static bool blk_split_discard(struct ioreq *ioreq, blkif_sector_t sector_number, static bool blk_split_discard(XenBlockRequest *request,
blkif_sector_t sector_number,
uint64_t nr_sectors) uint64_t nr_sectors)
{ {
XenBlockDataPlane *dataplane = ioreq->dataplane; XenBlockDataPlane *dataplane = request->dataplane;
int64_t byte_offset; int64_t byte_offset;
int byte_chunk; int byte_chunk;
uint64_t byte_remaining, limit; uint64_t byte_remaining, limit;
@ -339,9 +341,9 @@ static bool blk_split_discard(struct ioreq *ioreq, blkif_sector_t sector_number,
do { do {
byte_chunk = byte_remaining > limit ? limit : byte_remaining; byte_chunk = byte_remaining > limit ? limit : byte_remaining;
ioreq->aio_inflight++; request->aio_inflight++;
blk_aio_pdiscard(dataplane->blk, byte_offset, byte_chunk, blk_aio_pdiscard(dataplane->blk, byte_offset, byte_chunk,
qemu_aio_complete, ioreq); qemu_aio_complete, request);
byte_remaining -= byte_chunk; byte_remaining -= byte_chunk;
byte_offset += byte_chunk; byte_offset += byte_chunk;
} while (byte_remaining > 0); } while (byte_remaining > 0);
@ -349,53 +351,53 @@ static bool blk_split_discard(struct ioreq *ioreq, blkif_sector_t sector_number,
return true; return true;
} }
static int ioreq_runio_qemu_aio(struct ioreq *ioreq) static int ioreq_runio_qemu_aio(XenBlockRequest *request)
{ {
XenBlockDataPlane *dataplane = ioreq->dataplane; XenBlockDataPlane *dataplane = request->dataplane;
ioreq->buf = qemu_memalign(XC_PAGE_SIZE, ioreq->size); request->buf = qemu_memalign(XC_PAGE_SIZE, request->size);
if (ioreq->req.nr_segments && if (request->req.nr_segments &&
(ioreq->req.operation == BLKIF_OP_WRITE || (request->req.operation == BLKIF_OP_WRITE ||
ioreq->req.operation == BLKIF_OP_FLUSH_DISKCACHE) && request->req.operation == BLKIF_OP_FLUSH_DISKCACHE) &&
ioreq_grant_copy(ioreq)) { ioreq_grant_copy(request)) {
qemu_vfree(ioreq->buf); qemu_vfree(request->buf);
goto err; goto err;
} }
ioreq->aio_inflight++; request->aio_inflight++;
if (ioreq->presync) { if (request->presync) {
blk_aio_flush(ioreq->dataplane->blk, qemu_aio_complete, ioreq); blk_aio_flush(request->dataplane->blk, qemu_aio_complete, request);
return 0; return 0;
} }
switch (ioreq->req.operation) { switch (request->req.operation) {
case BLKIF_OP_READ: case BLKIF_OP_READ:
qemu_iovec_add(&ioreq->v, ioreq->buf, ioreq->size); qemu_iovec_add(&request->v, request->buf, request->size);
block_acct_start(blk_get_stats(dataplane->blk), &ioreq->acct, block_acct_start(blk_get_stats(dataplane->blk), &request->acct,
ioreq->v.size, BLOCK_ACCT_READ); request->v.size, BLOCK_ACCT_READ);
ioreq->aio_inflight++; request->aio_inflight++;
blk_aio_preadv(dataplane->blk, ioreq->start, &ioreq->v, 0, blk_aio_preadv(dataplane->blk, request->start, &request->v, 0,
qemu_aio_complete, ioreq); qemu_aio_complete, request);
break; break;
case BLKIF_OP_WRITE: case BLKIF_OP_WRITE:
case BLKIF_OP_FLUSH_DISKCACHE: case BLKIF_OP_FLUSH_DISKCACHE:
if (!ioreq->req.nr_segments) { if (!request->req.nr_segments) {
break; break;
} }
qemu_iovec_add(&ioreq->v, ioreq->buf, ioreq->size); qemu_iovec_add(&request->v, request->buf, request->size);
block_acct_start(blk_get_stats(dataplane->blk), &ioreq->acct, block_acct_start(blk_get_stats(dataplane->blk), &request->acct,
ioreq->v.size, request->v.size,
ioreq->req.operation == BLKIF_OP_WRITE ? request->req.operation == BLKIF_OP_WRITE ?
BLOCK_ACCT_WRITE : BLOCK_ACCT_FLUSH); BLOCK_ACCT_WRITE : BLOCK_ACCT_FLUSH);
ioreq->aio_inflight++; request->aio_inflight++;
blk_aio_pwritev(dataplane->blk, ioreq->start, &ioreq->v, 0, blk_aio_pwritev(dataplane->blk, request->start, &request->v, 0,
qemu_aio_complete, ioreq); qemu_aio_complete, request);
break; break;
case BLKIF_OP_DISCARD: case BLKIF_OP_DISCARD:
{ {
struct blkif_request_discard *req = (void *)&ioreq->req; struct blkif_request_discard *req = (void *)&request->req;
if (!blk_split_discard(ioreq, req->sector_number, req->nr_sectors)) { if (!blk_split_discard(request, req->sector_number, req->nr_sectors)) {
goto err; goto err;
} }
break; break;
@ -405,19 +407,19 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq)
goto err; goto err;
} }
qemu_aio_complete(ioreq, 0); qemu_aio_complete(request, 0);
return 0; return 0;
err: err:
ioreq_finish(ioreq); ioreq_finish(request);
ioreq->status = BLKIF_RSP_ERROR; request->status = BLKIF_RSP_ERROR;
return -1; return -1;
} }
static int blk_send_response_one(struct ioreq *ioreq) static int blk_send_response_one(XenBlockRequest *request)
{ {
XenBlockDataPlane *dataplane = ioreq->dataplane; XenBlockDataPlane *dataplane = request->dataplane;
int send_notify = 0; int send_notify = 0;
int have_requests = 0; int have_requests = 0;
blkif_response_t *resp; blkif_response_t *resp;
@ -443,9 +445,9 @@ static int blk_send_response_one(struct ioreq *ioreq)
return 0; return 0;
} }
resp->id = ioreq->req.id; resp->id = request->req.id;
resp->operation = ioreq->req.operation; resp->operation = request->req.operation;
resp->status = ioreq->status; resp->status = request->status;
dataplane->rings.common.rsp_prod_pvt++; dataplane->rings.common.rsp_prod_pvt++;
@ -473,13 +475,13 @@ static int blk_send_response_one(struct ioreq *ioreq)
/* walk finished list, send outstanding responses, free requests */ /* walk finished list, send outstanding responses, free requests */
static void blk_send_response_all(XenBlockDataPlane *dataplane) static void blk_send_response_all(XenBlockDataPlane *dataplane)
{ {
struct ioreq *ioreq; XenBlockRequest *request;
int send_notify = 0; int send_notify = 0;
while (!QLIST_EMPTY(&dataplane->finished)) { while (!QLIST_EMPTY(&dataplane->finished)) {
ioreq = QLIST_FIRST(&dataplane->finished); request = QLIST_FIRST(&dataplane->finished);
send_notify += blk_send_response_one(ioreq); send_notify += blk_send_response_one(request);
ioreq_release(ioreq, true); ioreq_release(request, true);
} }
if (send_notify) { if (send_notify) {
Error *local_err = NULL; Error *local_err = NULL;
@ -493,29 +495,29 @@ static void blk_send_response_all(XenBlockDataPlane *dataplane)
} }
} }
static int blk_get_request(XenBlockDataPlane *dataplane, struct ioreq *ioreq, static int blk_get_request(XenBlockDataPlane *dataplane,
RING_IDX rc) XenBlockRequest *request, RING_IDX rc)
{ {
switch (dataplane->protocol) { switch (dataplane->protocol) {
case BLKIF_PROTOCOL_NATIVE: { case BLKIF_PROTOCOL_NATIVE: {
blkif_request_t *req = blkif_request_t *req =
RING_GET_REQUEST(&dataplane->rings.native, rc); RING_GET_REQUEST(&dataplane->rings.native, rc);
memcpy(&ioreq->req, req, sizeof(ioreq->req)); memcpy(&request->req, req, sizeof(request->req));
break; break;
} }
case BLKIF_PROTOCOL_X86_32: { case BLKIF_PROTOCOL_X86_32: {
blkif_x86_32_request_t *req = blkif_x86_32_request_t *req =
RING_GET_REQUEST(&dataplane->rings.x86_32_part, rc); RING_GET_REQUEST(&dataplane->rings.x86_32_part, rc);
blkif_get_x86_32_req(&ioreq->req, req); blkif_get_x86_32_req(&request->req, req);
break; break;
} }
case BLKIF_PROTOCOL_X86_64: { case BLKIF_PROTOCOL_X86_64: {
blkif_x86_64_request_t *req = blkif_x86_64_request_t *req =
RING_GET_REQUEST(&dataplane->rings.x86_64_part, rc); RING_GET_REQUEST(&dataplane->rings.x86_64_part, rc);
blkif_get_x86_64_req(&ioreq->req, req); blkif_get_x86_64_req(&request->req, req);
break; break;
} }
} }
@ -527,7 +529,7 @@ static int blk_get_request(XenBlockDataPlane *dataplane, struct ioreq *ioreq,
static void blk_handle_requests(XenBlockDataPlane *dataplane) static void blk_handle_requests(XenBlockDataPlane *dataplane)
{ {
RING_IDX rc, rp; RING_IDX rc, rp;
struct ioreq *ioreq; XenBlockRequest *request;
dataplane->more_work = 0; dataplane->more_work = 0;
@ -541,18 +543,18 @@ static void blk_handle_requests(XenBlockDataPlane *dataplane)
if (RING_REQUEST_CONS_OVERFLOW(&dataplane->rings.common, rc)) { if (RING_REQUEST_CONS_OVERFLOW(&dataplane->rings.common, rc)) {
break; break;
} }
ioreq = ioreq_start(dataplane); request = ioreq_start(dataplane);
if (ioreq == NULL) { if (request == NULL) {
dataplane->more_work++; dataplane->more_work++;
break; break;
} }
blk_get_request(dataplane, ioreq, rc); blk_get_request(dataplane, request, rc);
dataplane->rings.common.req_cons = ++rc; dataplane->rings.common.req_cons = ++rc;
/* parse them */ /* parse them */
if (ioreq_parse(ioreq) != 0) { if (ioreq_parse(request) != 0) {
switch (ioreq->req.operation) { switch (request->req.operation) {
case BLKIF_OP_READ: case BLKIF_OP_READ:
block_acct_invalid(blk_get_stats(dataplane->blk), block_acct_invalid(blk_get_stats(dataplane->blk),
BLOCK_ACCT_READ); BLOCK_ACCT_READ);
@ -568,7 +570,7 @@ static void blk_handle_requests(XenBlockDataPlane *dataplane)
break; break;
}; };
if (blk_send_response_one(ioreq)) { if (blk_send_response_one(request)) {
Error *local_err = NULL; Error *local_err = NULL;
xen_device_notify_event_channel(dataplane->xendev, xen_device_notify_event_channel(dataplane->xendev,
@ -578,11 +580,11 @@ static void blk_handle_requests(XenBlockDataPlane *dataplane)
error_report_err(local_err); error_report_err(local_err);
} }
} }
ioreq_release(ioreq, false); ioreq_release(request, false);
continue; continue;
} }
ioreq_runio_qemu_aio(ioreq); ioreq_runio_qemu_aio(request);
} }
if (dataplane->more_work && if (dataplane->more_work &&
@ -636,17 +638,17 @@ XenBlockDataPlane *xen_block_dataplane_create(XenDevice *xendev,
void xen_block_dataplane_destroy(XenBlockDataPlane *dataplane) void xen_block_dataplane_destroy(XenBlockDataPlane *dataplane)
{ {
struct ioreq *ioreq; XenBlockRequest *request;
if (!dataplane) { if (!dataplane) {
return; return;
} }
while (!QLIST_EMPTY(&dataplane->freelist)) { while (!QLIST_EMPTY(&dataplane->freelist)) {
ioreq = QLIST_FIRST(&dataplane->freelist); request = QLIST_FIRST(&dataplane->freelist);
QLIST_REMOVE(ioreq, list); QLIST_REMOVE(request, list);
qemu_iovec_destroy(&ioreq->v); qemu_iovec_destroy(&request->v);
g_free(ioreq); g_free(request);
} }
qemu_bh_delete(dataplane->bh); qemu_bh_delete(dataplane->bh);