mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 03:59:52 +00:00
scsi: Drop scsi_req_abort
The only user of this function is spapr_vscsi.c. We can convert to scsi_req_cancel plus adding a check in vscsi_request_cancelled. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> [Drop prototype. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
9786b592a9
commit
eda470e41a
@ -1736,21 +1736,6 @@ void scsi_req_cancel(SCSIRequest *req)
|
||||
scsi_req_unref(req);
|
||||
}
|
||||
|
||||
void scsi_req_abort(SCSIRequest *req, int status)
|
||||
{
|
||||
if (!req->enqueued) {
|
||||
return;
|
||||
}
|
||||
scsi_req_ref(req);
|
||||
scsi_req_dequeue(req);
|
||||
req->io_canceled = true;
|
||||
if (req->ops->cancel_io) {
|
||||
req->ops->cancel_io(req);
|
||||
}
|
||||
scsi_req_complete(req, status);
|
||||
scsi_req_unref(req);
|
||||
}
|
||||
|
||||
static int scsi_ua_precedence(SCSISense sense)
|
||||
{
|
||||
if (sense.key != UNIT_ATTENTION) {
|
||||
|
@ -77,8 +77,9 @@ typedef struct vscsi_req {
|
||||
SCSIRequest *sreq;
|
||||
uint32_t qtag; /* qemu tag != srp tag */
|
||||
bool active;
|
||||
uint32_t data_len;
|
||||
bool writing;
|
||||
bool dma_error;
|
||||
uint32_t data_len;
|
||||
uint32_t senselen;
|
||||
uint8_t sense[SCSI_SENSE_BUF_SIZE];
|
||||
|
||||
@ -536,8 +537,8 @@ static void vscsi_transfer_data(SCSIRequest *sreq, uint32_t len)
|
||||
}
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "VSCSI: RDMA error rc=%d!\n", rc);
|
||||
vscsi_makeup_sense(s, req, HARDWARE_ERROR, 0, 0);
|
||||
scsi_req_abort(req->sreq, CHECK_CONDITION);
|
||||
req->dma_error = true;
|
||||
scsi_req_cancel(req->sreq);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -591,6 +592,12 @@ static void vscsi_request_cancelled(SCSIRequest *sreq)
|
||||
{
|
||||
vscsi_req *req = sreq->hba_private;
|
||||
|
||||
if (req->dma_error) {
|
||||
VSCSIState *s = VIO_SPAPR_VSCSI_DEVICE(sreq->bus->qbus.parent);
|
||||
|
||||
vscsi_makeup_sense(s, req, HARDWARE_ERROR, 0, 0);
|
||||
vscsi_send_rsp(s, req, CHECK_CONDITION, 0, 0);
|
||||
}
|
||||
vscsi_put_req(req);
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,6 @@ void scsi_req_data(SCSIRequest *req, int len);
|
||||
void scsi_req_complete(SCSIRequest *req, int status);
|
||||
uint8_t *scsi_req_get_buf(SCSIRequest *req);
|
||||
int scsi_req_get_sense(SCSIRequest *req, uint8_t *buf, int len);
|
||||
void scsi_req_abort(SCSIRequest *req, int status);
|
||||
void scsi_req_cancel(SCSIRequest *req);
|
||||
void scsi_req_retry(SCSIRequest *req);
|
||||
void scsi_device_purge_requests(SCSIDevice *sdev, SCSISense sense);
|
||||
|
Loading…
Reference in New Issue
Block a user