mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-17 07:02:03 -06:00
xen: purge 'blk' and 'ioreq' from function names in dataplane/xen-block.c
This is a purely cosmetic patch that purges remaining use of 'blk' and 'ioreq' in local function names, and then makes sure all functions are prefixed with 'xen_block_'. 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:
parent
e7f5b5f841
commit
d4683cf952
1 changed files with 46 additions and 44 deletions
|
@ -67,7 +67,7 @@ struct XenBlockDataPlane {
|
||||||
AioContext *ctx;
|
AioContext *ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ioreq_reset(XenBlockRequest *request)
|
static void reset_request(XenBlockRequest *request)
|
||||||
{
|
{
|
||||||
memset(&request->req, 0, sizeof(request->req));
|
memset(&request->req, 0, sizeof(request->req));
|
||||||
request->status = 0;
|
request->status = 0;
|
||||||
|
@ -86,7 +86,7 @@ static void ioreq_reset(XenBlockRequest *request)
|
||||||
qemu_iovec_reset(&request->v);
|
qemu_iovec_reset(&request->v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static XenBlockRequest *ioreq_start(XenBlockDataPlane *dataplane)
|
static XenBlockRequest *xen_block_start_request(XenBlockDataPlane *dataplane)
|
||||||
{
|
{
|
||||||
XenBlockRequest *request = NULL;
|
XenBlockRequest *request = NULL;
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ out:
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ioreq_finish(XenBlockRequest *request)
|
static void xen_block_finish_request(XenBlockRequest *request)
|
||||||
{
|
{
|
||||||
XenBlockDataPlane *dataplane = request->dataplane;
|
XenBlockDataPlane *dataplane = request->dataplane;
|
||||||
|
|
||||||
|
@ -121,12 +121,12 @@ static void ioreq_finish(XenBlockRequest *request)
|
||||||
dataplane->requests_finished++;
|
dataplane->requests_finished++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ioreq_release(XenBlockRequest *request, bool finish)
|
static void xen_block_release_request(XenBlockRequest *request, bool finish)
|
||||||
{
|
{
|
||||||
XenBlockDataPlane *dataplane = request->dataplane;
|
XenBlockDataPlane *dataplane = request->dataplane;
|
||||||
|
|
||||||
QLIST_REMOVE(request, list);
|
QLIST_REMOVE(request, list);
|
||||||
ioreq_reset(request);
|
reset_request(request);
|
||||||
request->dataplane = dataplane;
|
request->dataplane = dataplane;
|
||||||
QLIST_INSERT_HEAD(&dataplane->freelist, request, list);
|
QLIST_INSERT_HEAD(&dataplane->freelist, request, list);
|
||||||
if (finish) {
|
if (finish) {
|
||||||
|
@ -140,7 +140,7 @@ static void ioreq_release(XenBlockRequest *request, 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(XenBlockRequest *request)
|
static int xen_block_parse_request(XenBlockRequest *request)
|
||||||
{
|
{
|
||||||
XenBlockDataPlane *dataplane = request->dataplane;
|
XenBlockDataPlane *dataplane = request->dataplane;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -201,7 +201,7 @@ err:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ioreq_grant_copy(XenBlockRequest *request)
|
static int xen_block_copy_request(XenBlockRequest *request)
|
||||||
{
|
{
|
||||||
XenBlockDataPlane *dataplane = request->dataplane;
|
XenBlockDataPlane *dataplane = request->dataplane;
|
||||||
XenDevice *xendev = dataplane->xendev;
|
XenDevice *xendev = dataplane->xendev;
|
||||||
|
@ -247,9 +247,9 @@ static int ioreq_grant_copy(XenBlockRequest *request)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ioreq_runio_qemu_aio(XenBlockRequest *request);
|
static int xen_block_do_aio(XenBlockRequest *request);
|
||||||
|
|
||||||
static void qemu_aio_complete(void *opaque, int ret)
|
static void xen_block_complete_aio(void *opaque, int ret)
|
||||||
{
|
{
|
||||||
XenBlockRequest *request = opaque;
|
XenBlockRequest *request = opaque;
|
||||||
XenBlockDataPlane *dataplane = request->dataplane;
|
XenBlockDataPlane *dataplane = request->dataplane;
|
||||||
|
@ -266,7 +266,7 @@ static void qemu_aio_complete(void *opaque, int ret)
|
||||||
request->aio_inflight--;
|
request->aio_inflight--;
|
||||||
if (request->presync) {
|
if (request->presync) {
|
||||||
request->presync = 0;
|
request->presync = 0;
|
||||||
ioreq_runio_qemu_aio(request);
|
xen_block_do_aio(request);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (request->aio_inflight > 0) {
|
if (request->aio_inflight > 0) {
|
||||||
|
@ -277,7 +277,7 @@ static void qemu_aio_complete(void *opaque, int ret)
|
||||||
case BLKIF_OP_READ:
|
case BLKIF_OP_READ:
|
||||||
/* in case of failure request->aio_errors is increased */
|
/* in case of failure request->aio_errors is increased */
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
ioreq_grant_copy(request);
|
xen_block_copy_request(request);
|
||||||
}
|
}
|
||||||
qemu_vfree(request->buf);
|
qemu_vfree(request->buf);
|
||||||
break;
|
break;
|
||||||
|
@ -293,7 +293,7 @@ static void qemu_aio_complete(void *opaque, int ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
request->status = request->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY;
|
request->status = request->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY;
|
||||||
ioreq_finish(request);
|
xen_block_finish_request(request);
|
||||||
|
|
||||||
switch (request->req.operation) {
|
switch (request->req.operation) {
|
||||||
case BLKIF_OP_WRITE:
|
case BLKIF_OP_WRITE:
|
||||||
|
@ -318,7 +318,7 @@ done:
|
||||||
aio_context_release(dataplane->ctx);
|
aio_context_release(dataplane->ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool blk_split_discard(XenBlockRequest *request,
|
static bool xen_block_split_discard(XenBlockRequest *request,
|
||||||
blkif_sector_t sector_number,
|
blkif_sector_t sector_number,
|
||||||
uint64_t nr_sectors)
|
uint64_t nr_sectors)
|
||||||
{
|
{
|
||||||
|
@ -343,7 +343,7 @@ static bool blk_split_discard(XenBlockRequest *request,
|
||||||
byte_chunk = byte_remaining > limit ? limit : byte_remaining;
|
byte_chunk = byte_remaining > limit ? limit : byte_remaining;
|
||||||
request->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, request);
|
xen_block_complete_aio, 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);
|
||||||
|
@ -351,7 +351,7 @@ static bool blk_split_discard(XenBlockRequest *request,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ioreq_runio_qemu_aio(XenBlockRequest *request)
|
static int xen_block_do_aio(XenBlockRequest *request)
|
||||||
{
|
{
|
||||||
XenBlockDataPlane *dataplane = request->dataplane;
|
XenBlockDataPlane *dataplane = request->dataplane;
|
||||||
|
|
||||||
|
@ -359,14 +359,15 @@ static int ioreq_runio_qemu_aio(XenBlockRequest *request)
|
||||||
if (request->req.nr_segments &&
|
if (request->req.nr_segments &&
|
||||||
(request->req.operation == BLKIF_OP_WRITE ||
|
(request->req.operation == BLKIF_OP_WRITE ||
|
||||||
request->req.operation == BLKIF_OP_FLUSH_DISKCACHE) &&
|
request->req.operation == BLKIF_OP_FLUSH_DISKCACHE) &&
|
||||||
ioreq_grant_copy(request)) {
|
xen_block_copy_request(request)) {
|
||||||
qemu_vfree(request->buf);
|
qemu_vfree(request->buf);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
request->aio_inflight++;
|
request->aio_inflight++;
|
||||||
if (request->presync) {
|
if (request->presync) {
|
||||||
blk_aio_flush(request->dataplane->blk, qemu_aio_complete, request);
|
blk_aio_flush(request->dataplane->blk, xen_block_complete_aio,
|
||||||
|
request);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +378,7 @@ static int ioreq_runio_qemu_aio(XenBlockRequest *request)
|
||||||
request->v.size, BLOCK_ACCT_READ);
|
request->v.size, BLOCK_ACCT_READ);
|
||||||
request->aio_inflight++;
|
request->aio_inflight++;
|
||||||
blk_aio_preadv(dataplane->blk, request->start, &request->v, 0,
|
blk_aio_preadv(dataplane->blk, request->start, &request->v, 0,
|
||||||
qemu_aio_complete, request);
|
xen_block_complete_aio, request);
|
||||||
break;
|
break;
|
||||||
case BLKIF_OP_WRITE:
|
case BLKIF_OP_WRITE:
|
||||||
case BLKIF_OP_FLUSH_DISKCACHE:
|
case BLKIF_OP_FLUSH_DISKCACHE:
|
||||||
|
@ -392,12 +393,13 @@ static int ioreq_runio_qemu_aio(XenBlockRequest *request)
|
||||||
BLOCK_ACCT_WRITE : BLOCK_ACCT_FLUSH);
|
BLOCK_ACCT_WRITE : BLOCK_ACCT_FLUSH);
|
||||||
request->aio_inflight++;
|
request->aio_inflight++;
|
||||||
blk_aio_pwritev(dataplane->blk, request->start, &request->v, 0,
|
blk_aio_pwritev(dataplane->blk, request->start, &request->v, 0,
|
||||||
qemu_aio_complete, request);
|
xen_block_complete_aio, request);
|
||||||
break;
|
break;
|
||||||
case BLKIF_OP_DISCARD:
|
case BLKIF_OP_DISCARD:
|
||||||
{
|
{
|
||||||
struct blkif_request_discard *req = (void *)&request->req;
|
struct blkif_request_discard *req = (void *)&request->req;
|
||||||
if (!blk_split_discard(request, req->sector_number, req->nr_sectors)) {
|
if (!xen_block_split_discard(request, req->sector_number,
|
||||||
|
req->nr_sectors)) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -407,17 +409,17 @@ static int ioreq_runio_qemu_aio(XenBlockRequest *request)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
qemu_aio_complete(request, 0);
|
xen_block_complete_aio(request, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
ioreq_finish(request);
|
xen_block_finish_request(request);
|
||||||
request->status = BLKIF_RSP_ERROR;
|
request->status = BLKIF_RSP_ERROR;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int blk_send_response_one(XenBlockRequest *request)
|
static int xen_block_send_response_one(XenBlockRequest *request)
|
||||||
{
|
{
|
||||||
XenBlockDataPlane *dataplane = request->dataplane;
|
XenBlockDataPlane *dataplane = request->dataplane;
|
||||||
int send_notify = 0;
|
int send_notify = 0;
|
||||||
|
@ -473,15 +475,15 @@ static int blk_send_response_one(XenBlockRequest *request)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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 xen_block_send_response_all(XenBlockDataPlane *dataplane)
|
||||||
{
|
{
|
||||||
XenBlockRequest *request;
|
XenBlockRequest *request;
|
||||||
int send_notify = 0;
|
int send_notify = 0;
|
||||||
|
|
||||||
while (!QLIST_EMPTY(&dataplane->finished)) {
|
while (!QLIST_EMPTY(&dataplane->finished)) {
|
||||||
request = QLIST_FIRST(&dataplane->finished);
|
request = QLIST_FIRST(&dataplane->finished);
|
||||||
send_notify += blk_send_response_one(request);
|
send_notify += xen_block_send_response_one(request);
|
||||||
ioreq_release(request, true);
|
xen_block_release_request(request, true);
|
||||||
}
|
}
|
||||||
if (send_notify) {
|
if (send_notify) {
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
|
@ -495,7 +497,7 @@ static void blk_send_response_all(XenBlockDataPlane *dataplane)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int blk_get_request(XenBlockDataPlane *dataplane,
|
static int xen_block_get_request(XenBlockDataPlane *dataplane,
|
||||||
XenBlockRequest *request, RING_IDX rc)
|
XenBlockRequest *request, RING_IDX rc)
|
||||||
{
|
{
|
||||||
switch (dataplane->protocol) {
|
switch (dataplane->protocol) {
|
||||||
|
@ -526,7 +528,7 @@ static int blk_get_request(XenBlockDataPlane *dataplane,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void blk_handle_requests(XenBlockDataPlane *dataplane)
|
static void xen_block_handle_requests(XenBlockDataPlane *dataplane)
|
||||||
{
|
{
|
||||||
RING_IDX rc, rp;
|
RING_IDX rc, rp;
|
||||||
XenBlockRequest *request;
|
XenBlockRequest *request;
|
||||||
|
@ -537,23 +539,22 @@ static void blk_handle_requests(XenBlockDataPlane *dataplane)
|
||||||
rp = dataplane->rings.common.sring->req_prod;
|
rp = dataplane->rings.common.sring->req_prod;
|
||||||
xen_rmb(); /* Ensure we see queued requests up to 'rp'. */
|
xen_rmb(); /* Ensure we see queued requests up to 'rp'. */
|
||||||
|
|
||||||
blk_send_response_all(dataplane);
|
xen_block_send_response_all(dataplane);
|
||||||
while (rc != rp) {
|
while (rc != rp) {
|
||||||
/* pull request from ring */
|
/* pull request from ring */
|
||||||
if (RING_REQUEST_CONS_OVERFLOW(&dataplane->rings.common, rc)) {
|
if (RING_REQUEST_CONS_OVERFLOW(&dataplane->rings.common, rc)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
request = ioreq_start(dataplane);
|
request = xen_block_start_request(dataplane);
|
||||||
if (request == NULL) {
|
if (request == NULL) {
|
||||||
dataplane->more_work++;
|
dataplane->more_work++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
blk_get_request(dataplane, request, rc);
|
xen_block_get_request(dataplane, request, rc);
|
||||||
dataplane->rings.common.req_cons = ++rc;
|
dataplane->rings.common.req_cons = ++rc;
|
||||||
|
|
||||||
/* parse them */
|
/* parse them */
|
||||||
if (ioreq_parse(request) != 0) {
|
if (xen_block_parse_request(request) != 0) {
|
||||||
|
|
||||||
switch (request->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),
|
||||||
|
@ -570,7 +571,7 @@ static void blk_handle_requests(XenBlockDataPlane *dataplane)
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (blk_send_response_one(request)) {
|
if (xen_block_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,
|
||||||
|
@ -580,11 +581,11 @@ static void blk_handle_requests(XenBlockDataPlane *dataplane)
|
||||||
error_report_err(local_err);
|
error_report_err(local_err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ioreq_release(request, false);
|
xen_block_release_request(request, false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ioreq_runio_qemu_aio(request);
|
xen_block_do_aio(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataplane->more_work &&
|
if (dataplane->more_work &&
|
||||||
|
@ -593,16 +594,16 @@ static void blk_handle_requests(XenBlockDataPlane *dataplane)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void blk_bh(void *opaque)
|
static void xen_block_dataplane_bh(void *opaque)
|
||||||
{
|
{
|
||||||
XenBlockDataPlane *dataplane = opaque;
|
XenBlockDataPlane *dataplane = opaque;
|
||||||
|
|
||||||
aio_context_acquire(dataplane->ctx);
|
aio_context_acquire(dataplane->ctx);
|
||||||
blk_handle_requests(dataplane);
|
xen_block_handle_requests(dataplane);
|
||||||
aio_context_release(dataplane->ctx);
|
aio_context_release(dataplane->ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void blk_event(void *opaque)
|
static void xen_block_dataplane_event(void *opaque)
|
||||||
{
|
{
|
||||||
XenBlockDataPlane *dataplane = opaque;
|
XenBlockDataPlane *dataplane = opaque;
|
||||||
|
|
||||||
|
@ -631,7 +632,8 @@ XenBlockDataPlane *xen_block_dataplane_create(XenDevice *xendev,
|
||||||
} else {
|
} else {
|
||||||
dataplane->ctx = qemu_get_aio_context();
|
dataplane->ctx = qemu_get_aio_context();
|
||||||
}
|
}
|
||||||
dataplane->bh = aio_bh_new(dataplane->ctx, blk_bh, dataplane);
|
dataplane->bh = aio_bh_new(dataplane->ctx, xen_block_dataplane_bh,
|
||||||
|
dataplane);
|
||||||
|
|
||||||
return dataplane;
|
return dataplane;
|
||||||
}
|
}
|
||||||
|
@ -789,7 +791,7 @@ void xen_block_dataplane_start(XenBlockDataPlane *dataplane,
|
||||||
|
|
||||||
dataplane->event_channel =
|
dataplane->event_channel =
|
||||||
xen_device_bind_event_channel(xendev, event_channel,
|
xen_device_bind_event_channel(xendev, event_channel,
|
||||||
blk_event, dataplane,
|
xen_block_dataplane_event, dataplane,
|
||||||
&local_err);
|
&local_err);
|
||||||
if (local_err) {
|
if (local_err) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue