WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [qemu] hdparm tunable IDE write cache for

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [qemu] hdparm tunable IDE write cache for HVM
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 Aug 2006 01:40:12 +0000
Delivery-date: Sun, 20 Aug 2006 18:40:30 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
# Node ID 9bb6c1c1890a07885265bbc59f4dbb660312974e
# Parent  78673ba510ed06e02edc8175828d302addd7a0fd
[qemu] hdparm tunable IDE write cache for HVM
qemu 0.8.2 has a flush callback to the storage backends, so now it is
possible to implement hdparm tunable IDE write cache enable/disable for
guest domains, allowing people to pick speed or data consistency on a
case by case basis.

As an added benefit, really large LBA48 IOs will now no longer be broken
up into smaller IOs on the host side.

From: Rik van Riel <riel@xxxxxxxxxx>
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
---
 tools/ioemu/block-bochs.c |    2 +-
 tools/ioemu/block-cloop.c |    2 +-
 tools/ioemu/block-cow.c   |    2 +-
 tools/ioemu/block-qcow.c  |    2 +-
 tools/ioemu/block-vmdk.c  |    2 +-
 tools/ioemu/block.c       |    2 +-
 tools/ioemu/hw/ide.c      |   17 +++++++++++++++++
 7 files changed, 23 insertions(+), 6 deletions(-)

diff -r 78673ba510ed -r 9bb6c1c1890a tools/ioemu/block-bochs.c
--- a/tools/ioemu/block-bochs.c Sun Aug 20 23:52:39 2006 +0100
+++ b/tools/ioemu/block-bochs.c Sun Aug 20 23:59:34 2006 +0100
@@ -91,7 +91,7 @@ static int bochs_open(BlockDriverState *
     int fd, i;
     struct bochs_header bochs;
 
-    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
     if (fd < 0) {
         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
         if (fd < 0)
diff -r 78673ba510ed -r 9bb6c1c1890a tools/ioemu/block-cloop.c
--- a/tools/ioemu/block-cloop.c Sun Aug 20 23:52:39 2006 +0100
+++ b/tools/ioemu/block-cloop.c Sun Aug 20 23:59:34 2006 +0100
@@ -55,7 +55,7 @@ static int cloop_open(BlockDriverState *
     BDRVCloopState *s = bs->opaque;
     uint32_t offsets_size,max_compressed_block_size=1,i;
 
-    s->fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE | O_SYNC);
+    s->fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
     if (s->fd < 0)
         return -1;
     bs->read_only = 1;
diff -r 78673ba510ed -r 9bb6c1c1890a tools/ioemu/block-cow.c
--- a/tools/ioemu/block-cow.c   Sun Aug 20 23:52:39 2006 +0100
+++ b/tools/ioemu/block-cow.c   Sun Aug 20 23:59:34 2006 +0100
@@ -69,7 +69,7 @@ static int cow_open(BlockDriverState *bs
     struct cow_header_v2 cow_header;
     int64_t size;
 
-    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
     if (fd < 0) {
         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
         if (fd < 0)
diff -r 78673ba510ed -r 9bb6c1c1890a tools/ioemu/block-qcow.c
--- a/tools/ioemu/block-qcow.c  Sun Aug 20 23:52:39 2006 +0100
+++ b/tools/ioemu/block-qcow.c  Sun Aug 20 23:59:34 2006 +0100
@@ -95,7 +95,7 @@ static int qcow_open(BlockDriverState *b
     int fd, len, i, shift;
     QCowHeader header;
     
-    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
     if (fd < 0) {
         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
         if (fd < 0)
diff -r 78673ba510ed -r 9bb6c1c1890a tools/ioemu/block-vmdk.c
--- a/tools/ioemu/block-vmdk.c  Sun Aug 20 23:52:39 2006 +0100
+++ b/tools/ioemu/block-vmdk.c  Sun Aug 20 23:59:34 2006 +0100
@@ -96,7 +96,7 @@ static int vmdk_open(BlockDriverState *b
     uint32_t magic;
     int l1_size;
 
-    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
     if (fd < 0) {
         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
         if (fd < 0)
diff -r 78673ba510ed -r 9bb6c1c1890a tools/ioemu/block.c
--- a/tools/ioemu/block.c       Sun Aug 20 23:52:39 2006 +0100
+++ b/tools/ioemu/block.c       Sun Aug 20 23:59:34 2006 +0100
@@ -685,7 +685,7 @@ static int raw_open(BlockDriverState *bs
     int rv;
 #endif
 
-    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
     if (fd < 0) {
         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
         if (fd < 0)
diff -r 78673ba510ed -r 9bb6c1c1890a tools/ioemu/hw/ide.c
--- a/tools/ioemu/hw/ide.c      Sun Aug 20 23:52:39 2006 +0100
+++ b/tools/ioemu/hw/ide.c      Sun Aug 20 23:59:34 2006 +0100
@@ -305,6 +305,7 @@ typedef struct IDEState {
     PCIDevice *pci_dev;
     struct BMDMAState *bmdma;
     int drive_serial;
+    int write_cache;
     /* ide regs */
     uint8_t feature;
     uint8_t error;
@@ -789,6 +790,9 @@ static void ide_sector_write(IDEState *s
     }
     ide_set_sector(s, sector_num + n);
     
+    if (!s->write_cache)
+        bdrv_flush(s->bs);
+    
 #ifdef TARGET_I386
     if (win2k_install_hack && ((++s->irq_count % 16) == 0)) {
         /* It seems there is a bug in the Windows 2000 installer HDD
@@ -863,6 +867,10 @@ static int ide_write_dma_cb(IDEState *s,
         transfer_size -= len;
         phys_addr += len;
     }
+    /* Ensure the data hit disk before telling the guest OS so. */
+    if (!s->write_cache)
+        bdrv_flush(s->bs);
+
     return transfer_size1 - transfer_size;
 }
 
@@ -1672,7 +1680,15 @@ static void ide_ioport_write(void *opaqu
             /* XXX: valid for CDROM ? */
             switch(s->feature) {
             case 0x02: /* write cache enable */
+                s->write_cache = 1;
+                s->status = READY_STAT | SEEK_STAT;
+                ide_set_irq(s);
+                break;
             case 0x82: /* write cache disable */
+                s->write_cache = 0;
+                s->status = READY_STAT | SEEK_STAT;
+                ide_set_irq(s);
+                break;
             case 0xaa: /* read look-ahead enable */
             case 0x55: /* read look-ahead disable */
                 s->status = READY_STAT | SEEK_STAT;
@@ -2090,6 +2106,7 @@ static void ide_init2(IDEState *ide_stat
         s->irq = irq;
         s->sector_write_timer = qemu_new_timer(vm_clock, 
                                                ide_sector_write_timer_cb, s);
+        s->write_cache = 0;
         ide_reset(s);
     }
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [qemu] hdparm tunable IDE write cache for HVM, Xen patchbot-unstable <=