mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
scsi: track per-SCSIRequest AioContext
Until now, a SCSIDevice's I/O requests have run in a single AioContext. In order to support multiple IOThreads it will be necessary to move to the concept of a per-SCSIRequest AioContext. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20250311132616.1049687-4-stefanha@redhat.com> Tested-by: Peter Krempa <pkrempa@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
a89c3c9b2c
commit
7eecba3778
3 changed files with 8 additions and 11 deletions
|
@ -868,6 +868,7 @@ invalid_opcode:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
req->ctx = qemu_get_current_aio_context();
|
||||||
req->cmd = cmd;
|
req->cmd = cmd;
|
||||||
req->residual = req->cmd.xfer;
|
req->residual = req->cmd.xfer;
|
||||||
|
|
||||||
|
|
|
@ -328,9 +328,8 @@ static void scsi_aio_complete(void *opaque, int ret)
|
||||||
SCSIDiskReq *r = (SCSIDiskReq *)opaque;
|
SCSIDiskReq *r = (SCSIDiskReq *)opaque;
|
||||||
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
|
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
|
||||||
|
|
||||||
/* The request must only run in the BlockBackend's AioContext */
|
/* The request must run in its AioContext */
|
||||||
assert(blk_get_aio_context(s->qdev.conf.blk) ==
|
assert(r->req.ctx == qemu_get_current_aio_context());
|
||||||
qemu_get_current_aio_context());
|
|
||||||
|
|
||||||
assert(r->req.aiocb != NULL);
|
assert(r->req.aiocb != NULL);
|
||||||
r->req.aiocb = NULL;
|
r->req.aiocb = NULL;
|
||||||
|
@ -430,12 +429,10 @@ static void scsi_dma_complete(void *opaque, int ret)
|
||||||
|
|
||||||
static void scsi_read_complete_noio(SCSIDiskReq *r, int ret)
|
static void scsi_read_complete_noio(SCSIDiskReq *r, int ret)
|
||||||
{
|
{
|
||||||
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
|
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
|
|
||||||
/* The request must only run in the BlockBackend's AioContext */
|
/* The request must run in its AioContext */
|
||||||
assert(blk_get_aio_context(s->qdev.conf.blk) ==
|
assert(r->req.ctx == qemu_get_current_aio_context());
|
||||||
qemu_get_current_aio_context());
|
|
||||||
|
|
||||||
assert(r->req.aiocb == NULL);
|
assert(r->req.aiocb == NULL);
|
||||||
if (scsi_disk_req_check_error(r, ret, ret > 0)) {
|
if (scsi_disk_req_check_error(r, ret, ret > 0)) {
|
||||||
|
@ -562,12 +559,10 @@ static void scsi_read_data(SCSIRequest *req)
|
||||||
|
|
||||||
static void scsi_write_complete_noio(SCSIDiskReq *r, int ret)
|
static void scsi_write_complete_noio(SCSIDiskReq *r, int ret)
|
||||||
{
|
{
|
||||||
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
|
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
|
|
||||||
/* The request must only run in the BlockBackend's AioContext */
|
/* The request must run in its AioContext */
|
||||||
assert(blk_get_aio_context(s->qdev.conf.blk) ==
|
assert(r->req.ctx == qemu_get_current_aio_context());
|
||||||
qemu_get_current_aio_context());
|
|
||||||
|
|
||||||
assert (r->req.aiocb == NULL);
|
assert (r->req.aiocb == NULL);
|
||||||
if (scsi_disk_req_check_error(r, ret, ret > 0)) {
|
if (scsi_disk_req_check_error(r, ret, ret > 0)) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ struct SCSIRequest {
|
||||||
SCSIBus *bus;
|
SCSIBus *bus;
|
||||||
SCSIDevice *dev;
|
SCSIDevice *dev;
|
||||||
const SCSIReqOps *ops;
|
const SCSIReqOps *ops;
|
||||||
|
AioContext *ctx;
|
||||||
uint32_t refcount;
|
uint32_t refcount;
|
||||||
uint32_t tag;
|
uint32_t tag;
|
||||||
uint32_t lun;
|
uint32_t lun;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue