public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Carlo Marcelo Arenas Belon <carenas-kLeDWSohozoJb6fo7hG9ng@public.gmane.org>
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [PATCH 2/5] qemu: revert ide sector write operation not to use AIO
Date: Wed, 28 Nov 2007 12:21:14 -0600	[thread overview]
Message-ID: <20071128182114.GB3757@tapir> (raw)
In-Reply-To: <20071128180630.GA351@tapir>

This patch revert "Last AIO Patch" as requested by Fabrice, it is incomplete
and breaks other (non-Windows) systems.

originally from qemu CVS :

  cvs -q diff -r1.69 -r1.70 hw/ide.c

Data corruption resulting in kernel panics and unbootable images is experienced
frequently with FreeBSD and OpenSolaris guests unless committed

Signed-off-by: Carlo Marcelo Arenas Belon <carenas-kLeDWSohozoJb6fo7hG9ng@public.gmane.org>
---
 qemu/hw/ide.c |   56 ++++++++++++++++++--------------------------------------
 1 files changed, 18 insertions(+), 38 deletions(-)

diff --git a/qemu/hw/ide.c b/qemu/hw/ide.c
index 29fc7a9..a8d4339 100644
--- a/qemu/hw/ide.c
+++ b/qemu/hw/ide.c
@@ -358,7 +358,7 @@ typedef struct IDEState {
     uint8_t *data_ptr;
     uint8_t *data_end;
     uint8_t io_buffer[MAX_MULT_SECTORS*512 + 4];
-    QEMUTimer *sector_write_timer; /* only used for win2k instal hack */
+    QEMUTimer *sector_write_timer; /* only used for win2k install hack */
     uint32_t irq_count; /* counts IRQs when using win2k install hack */
     /* CF-ATA extended error */
     uint8_t ext_error;
@@ -865,44 +865,10 @@ static void ide_sector_write_timer_cb(void *opaque)
     ide_set_irq(s);
 }
 
-static void ide_sector_write_aio_cb(void *opaque, int ret)
-{
-    BMDMAState *bm = opaque;
-    IDEState *s = bm->ide_if;
-
-#ifdef TARGET_I386
-    if (win2k_install_hack && ((++s->irq_count % 16) == 0)) {
-	/* It seems there is a bug in the Windows 2000 installer HDD
-	   IDE driver which fills the disk with empty logs when the
-	   IDE write IRQ comes too early. This hack tries to correct
-	   that at the expense of slower write performances. Use this
-	   option _only_ to install Windows 2000. You must disable it
-	   for normal use. */
-	qemu_mod_timer(s->sector_write_timer,
-		       qemu_get_clock(vm_clock) + (ticks_per_sec / 1000));
-    } else
-#endif
-    {
-	ide_set_irq(s);
-    }
-    bm->aiocb = NULL;
-}
-
 static void ide_sector_write(IDEState *s)
 {
-    BMDMAState *bm;
     int64_t sector_num;
-    int n, n1;
-
-    s->io_buffer_index = 0;
-    s->io_buffer_size = 0;
-    bm = s->bmdma;
-    if(bm == NULL) {
-	bm = qemu_mallocz(sizeof(BMDMAState));
-	s->bmdma = bm;
-    }
-    bm->ide_if = s;
-    bm->dma_cb = ide_sector_write_aio_cb;
+    int ret, n, n1;
 
     s->status = READY_STAT | SEEK_STAT;
     sector_num = ide_get_sector(s);
@@ -912,6 +878,7 @@ static void ide_sector_write(IDEState *s)
     n = s->nsector;
     if (n > s->req_nb_sectors)
         n = s->req_nb_sectors;
+    ret = bdrv_write(s->bs, sector_num, s->io_buffer, n);
     s->nsector -= n;
     if (s->nsector == 0) {
         /* no more sectors to write */
@@ -924,8 +891,21 @@ static void ide_sector_write(IDEState *s)
     }
     ide_set_sector(s, sector_num + n);
 
-    bm->aiocb = bdrv_aio_write(s->bs, sector_num, s->io_buffer, n,
-			       ide_sector_write_aio_cb, bm);
+#ifdef TARGET_I386
+    if (win2k_install_hack && ((++s->irq_count % 16) == 0)) {
+        /* It seems there is a bug in the Windows 2000 installer HDD
+           IDE driver which fills the disk with empty logs when the
+           IDE write IRQ comes too early. This hack tries to correct
+           that at the expense of slower write performances. Use this
+           option _only_ to install Windows 2000. You must disable it
+           for normal use. */
+        qemu_mod_timer(s->sector_write_timer, 
+                       qemu_get_clock(vm_clock) + (ticks_per_sec / 1000));
+    } else 
+#endif
+    {
+        ide_set_irq(s);
+    }
 }
 
 /* XXX: handle errors */
-- 
1.5.2.5


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

  parent reply	other threads:[~2007-11-28 18:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-28 18:06 [PATCH 0/5] qemu: IDE/ATAPI emulation reliability fixes Carlo Marcelo Arenas Belon
2007-11-28 18:15 ` [PATCH 1/5] qemu: GET_CONFIGURATION fixes for MMC-6 DVD-ROM implementation Carlo Marcelo Arenas Belon
2007-11-28 18:21 ` Carlo Marcelo Arenas Belon [this message]
2007-11-28 18:24 ` [PATCH 3/5] qemu: piix_pci enable ACPI interrupts Carlo Marcelo Arenas Belon
2007-11-28 18:28 ` [PATCH 4/5] qemu: ide INQUIRY and IDENTIFY DEVICE report DVD-ROM model Carlo Marcelo Arenas Belon
2007-11-28 18:33 ` [PATCH 5/5] qemu: piix_pci: remove 82371FB support Carlo Marcelo Arenas Belon
2007-11-30  7:15 ` [PATCH 0/5] qemu: IDE/ATAPI emulation reliability fixes Avi Kivity
     [not found]   ` <474FB8AB.70601-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-11-30 13:25     ` Carlo Marcelo Arenas Belon
2007-11-30 14:53       ` Avi Kivity

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=20071128182114.GB3757@tapir \
    --to=carenas-kledwsohozojb6fo7hg9ng@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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