From: hare@suse.de (Hannes Reinecke)
To: qemu-devel@nongnu.org
Cc: stefanha@gmail.com, nab@linux-iscsi.org, kraxel@redhat.com
Subject: [Qemu-devel] [PATCH 12/16] scsi-generic: use plain ioctl
Date: Thu, 18 Nov 2010 15:47:36 +0100 [thread overview]
Message-ID: <20101118144736.C183DF90AB@ochil.suse.de> (raw)
aio_ioctl is emulated anyway and currently broken.
So better use 'normal' ioctl here as there are no benefits
on using the emulated async I/O call.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
hw/scsi-generic.c | 21 +++++++--------------
1 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index de37d78..6250ce5 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -147,12 +147,8 @@ static void scsi_command_complete(void *opaque, int ret)
/* Cancel a pending data transfer. */
static void scsi_cancel_io(SCSIRequest *req)
{
- SCSIGenericReq *r = DO_UPCAST(SCSIGenericReq, req, req);
-
+ /* Nothing to do; cannot abort ioctls :-( */
DPRINTF("Cancel tag=0x%x\n", req->tag);
- if (r->req.aiocb)
- bdrv_aio_cancel(r->req.aiocb);
- r->req.aiocb = NULL;
}
static int execute_command(BlockDriverState *bdrv,
@@ -160,6 +156,7 @@ static int execute_command(BlockDriverState *bdrv,
BlockDriverCompletionFunc *complete)
{
SCSIGenericState *s = DO_UPCAST(SCSIGenericState, qdev, r->req.dev);
+ int ret;
r->io_header.interface_id = 'S';
r->io_header.dxfer_direction = direction;
@@ -173,13 +170,12 @@ static int execute_command(BlockDriverState *bdrv,
r->io_header.usr_ptr = r;
r->io_header.flags |= SG_FLAG_DIRECT_IO;
- r->req.aiocb = bdrv_aio_ioctl(bdrv, SG_IO, &r->io_header, complete, r);
- if (r->req.aiocb == NULL) {
- BADF("execute_command: read failed !\n");
- return -1;
- }
+ DPRINTF("SG_IO tag=0x%x dxfer=%d iov=%d\n", r->req.tag,
+ r->io_header.dxfer_len, r->io_header.iovec_count);
- return 0;
+ ret = bdrv_ioctl(bdrv, SG_IO, &r->io_header);
+ complete(r, ret);
+ return ret;
}
static void scsi_read_complete(void * opaque, int ret)
@@ -448,9 +444,6 @@ static void scsi_generic_purge_requests(SCSIGenericState *s)
while (!QTAILQ_EMPTY(&s->qdev.requests)) {
r = DO_UPCAST(SCSIGenericReq, req, QTAILQ_FIRST(&s->qdev.requests));
- if (r->req.aiocb) {
- bdrv_aio_cancel(r->req.aiocb);
- }
scsi_remove_request(&r->req);
}
}
--
1.7.1
next reply other threads:[~2010-11-18 14:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-18 14:47 Hannes Reinecke [this message]
2010-11-19 18:39 ` [Qemu-devel] [PATCH 12/16] scsi-generic: use plain ioctl Christoph Hellwig
2010-11-20 0:41 ` Nicholas A. Bellinger
2010-11-20 1:25 ` adq
2010-11-20 8:23 ` Nicholas A. Bellinger
2010-11-20 13:16 ` adq
2010-11-22 7:21 ` Hannes Reinecke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101118144736.C183DF90AB@ochil.suse.de \
--to=hare@suse.de \
--cc=kraxel@redhat.com \
--cc=nab@linux-iscsi.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.