From: Marcelo Tosatti <mtosatti@redhat.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>,
Paul Brook <paul@codesourcery.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [patch 2/3] scsi-disk aio_flush
Date: Wed, 02 Apr 2008 15:16:01 -0300 [thread overview]
Message-ID: <20080402182831.083248256@localhost.localdomain> (raw)
In-Reply-To: 20080402181559.286859712@localhost.localdomain
[-- Attachment #1: scsi-disk-flush --]
[-- Type: text/plain, Size: 1361 bytes --]
On top of Ian's bdrv_flush error / bdrv_aio_patches.
This is similar to his recent patch, but uses the new scsi_command_complete()
arguments.
Index: kvm-userspace.io/qemu/hw/scsi-disk.c
===================================================================
--- kvm-userspace.io.orig/qemu/hw/scsi-disk.c
+++ kvm-userspace.io/qemu/hw/scsi-disk.c
@@ -273,6 +273,16 @@ static int scsi_write_data(SCSIDevice *d
return 0;
}
+static void scsi_flush_complete(void *opaque, int ret)
+{
+ SCSIRequest *r = (SCSIRequest *)opaque;
+
+ if (ret)
+ scsi_command_complete(r, SCSI_CHECK_COND, SENSE_HARDWARE_ERROR);
+ else
+ scsi_command_complete(r, SCSI_OK, SENSE_NO_SENSE);
+}
+
/* Return a pointer to the data buffer. */
static uint8_t *scsi_get_buf(SCSIDevice *d, uint32_t tag)
{
@@ -632,13 +642,8 @@ static int32_t scsi_send_command(SCSIDev
break;
case 0x35:
DPRINTF("Syncronise cache (sector %d, count %d)\n", lba, len);
- ret = bdrv_flush(s->bdrv);
- if (ret) {
- DPRINTF("IO error on bdrv_flush\n");
- scsi_command_complete(r, SCSI_CHECK_COND, SENSE_HARDWARE_ERROR);
- return 0;
- }
- break;
+ bdrv_aio_flush(s->bdrv, scsi_flush_complete, r);
+ return 0;
case 0x43:
{
int start_track, format, msf, toclen;
--
next prev parent reply other threads:[~2008-04-02 18:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-02 18:15 [Qemu-devel] [patch 0/3] properly report SCSI status codes Marcelo Tosatti
2008-04-02 18:16 ` [Qemu-devel] [patch 1/3] Fix scsi-disk sense-key/status confusion Marcelo Tosatti
2008-04-02 18:16 ` Marcelo Tosatti [this message]
2008-04-02 18:16 ` [Qemu-devel] [patch 3/3] LSI rename sense variable Marcelo Tosatti
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=20080402182831.083248256@localhost.localdomain \
--to=mtosatti@redhat.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
/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 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).