From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IN5rq-00055B-7T for qemu-devel@nongnu.org; Mon, 20 Aug 2007 07:56:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IN5ro-00052j-FT for qemu-devel@nongnu.org; Mon, 20 Aug 2007 07:56:21 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IN5ro-00052Z-7J for qemu-devel@nongnu.org; Mon, 20 Aug 2007 07:56:20 -0400 Received: from dionis.simtreas.ru ([81.176.134.9]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IN5rl-0002N9-89 for qemu-devel@nongnu.org; Mon, 20 Aug 2007 07:56:17 -0400 Received: from [10.68.0.2] (dzo.ufk68.roskazna.local [10.68.0.2]) by dionis.simtreas.ru (8.12.11/8.12.11) with ESMTP id l7KBtvHa017091 for ; Mon, 20 Aug 2007 15:55:58 +0400 Message-ID: <46C981B7.9050705@simtreas.ru> Date: Mon, 20 Aug 2007 15:57:43 +0400 From: "Vladimir N. Oleynik" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030307010604020001080503" Subject: [Qemu-devel] last AIO patch Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------030307010604020001080503 Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Hi. A small last AIO patch for current qemu make async disk write for non-dma mode. This patch can use always, can install w2k without disk-full-problem and without use -w2k-hack option now for system with AIO support. --w vodz --------------030307010604020001080503 Content-Type: text/x-patch; name="last_aio.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="last_aio.patch" diff -rbu qemu.orig/hw/ide.c qemu/hw/ide.c --- qemu.orig/hw/ide.c 2007-07-12 02:48:58.000000000 +0400 +++ qemu/hw/ide.c 2007-08-20 15:33:44.000000000 +0400 @@ -863,10 +863,44 @@ 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 ret, n, n1; + 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; s->status = READY_STAT | SEEK_STAT; sector_num = ide_get_sector(s); @@ -876,7 +910,6 @@ 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 */ @@ -889,21 +922,8 @@ } ide_set_sector(s, sector_num + n); -#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 = bdrv_aio_write(s->bs, sector_num, s->io_buffer, n, + ide_sector_write_aio_cb, bm); } /* XXX: handle errors */ --------------030307010604020001080503--