qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 12/16] scsi-generic: use plain ioctl
@ 2010-11-18 14:47 Hannes Reinecke
  2010-11-19 18:39 ` Christoph Hellwig
  0 siblings, 1 reply; 7+ messages in thread
From: Hannes Reinecke @ 2010-11-18 14:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, nab, kraxel


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-11-22  7:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-18 14:47 [Qemu-devel] [PATCH 12/16] scsi-generic: use plain ioctl Hannes Reinecke
2010-11-19 18:39 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).