direct-io.hg

changeset 11210:a61b92fc2966

[qemu patches] Update patches for changeset 11209:9bb6c1c1890a.

Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
author Christian Limpach <Christian.Limpach@xensource.com>
date Mon Aug 21 00:01:11 2006 +0100 (2006-08-21)
parents 9bb6c1c1890a
children 4d8ab492bdee
files tools/ioemu/patches/qemu-fix-write-to-disk-synchronous tools/ioemu/patches/qemu-tunable-ide-write-cache tools/ioemu/patches/series
line diff
     1.1 --- a/tools/ioemu/patches/qemu-fix-write-to-disk-synchronous	Sun Aug 20 23:59:34 2006 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,78 +0,0 @@
     1.4 -Index: ioemu/block-vmdk.c
     1.5 -===================================================================
     1.6 ---- ioemu.orig/block-vmdk.c	2006-08-17 19:37:35.737593169 +0100
     1.7 -+++ ioemu/block-vmdk.c	2006-08-17 19:50:28.884943317 +0100
     1.8 -@@ -96,7 +96,7 @@
     1.9 -     uint32_t magic;
    1.10 -     int l1_size;
    1.11 - 
    1.12 --    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
    1.13 -+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
    1.14 -     if (fd < 0) {
    1.15 -         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
    1.16 -         if (fd < 0)
    1.17 -Index: ioemu/block-qcow.c
    1.18 -===================================================================
    1.19 ---- ioemu.orig/block-qcow.c	2006-08-17 19:37:35.737593169 +0100
    1.20 -+++ ioemu/block-qcow.c	2006-08-17 19:50:28.885943206 +0100
    1.21 -@@ -95,7 +95,7 @@
    1.22 -     int fd, len, i, shift;
    1.23 -     QCowHeader header;
    1.24 -     
    1.25 --    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
    1.26 -+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
    1.27 -     if (fd < 0) {
    1.28 -         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
    1.29 -         if (fd < 0)
    1.30 -Index: ioemu/block-bochs.c
    1.31 -===================================================================
    1.32 ---- ioemu.orig/block-bochs.c	2006-08-17 19:37:35.737593169 +0100
    1.33 -+++ ioemu/block-bochs.c	2006-08-17 19:50:28.885943206 +0100
    1.34 -@@ -91,7 +91,7 @@
    1.35 -     int fd, i;
    1.36 -     struct bochs_header bochs;
    1.37 - 
    1.38 --    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
    1.39 -+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
    1.40 -     if (fd < 0) {
    1.41 -         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
    1.42 -         if (fd < 0)
    1.43 -Index: ioemu/block.c
    1.44 -===================================================================
    1.45 ---- ioemu.orig/block.c	2006-08-17 19:50:18.872050063 +0100
    1.46 -+++ ioemu/block.c	2006-08-17 19:50:28.885943206 +0100
    1.47 -@@ -685,7 +685,7 @@
    1.48 -     int rv;
    1.49 - #endif
    1.50 - 
    1.51 --    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
    1.52 -+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
    1.53 -     if (fd < 0) {
    1.54 -         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
    1.55 -         if (fd < 0)
    1.56 -Index: ioemu/block-cow.c
    1.57 -===================================================================
    1.58 ---- ioemu.orig/block-cow.c	2006-08-17 19:37:35.738593058 +0100
    1.59 -+++ ioemu/block-cow.c	2006-08-17 19:50:28.886943095 +0100
    1.60 -@@ -69,7 +69,7 @@
    1.61 -     struct cow_header_v2 cow_header;
    1.62 -     int64_t size;
    1.63 - 
    1.64 --    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
    1.65 -+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
    1.66 -     if (fd < 0) {
    1.67 -         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
    1.68 -         if (fd < 0)
    1.69 -Index: ioemu/block-cloop.c
    1.70 -===================================================================
    1.71 ---- ioemu.orig/block-cloop.c	2006-08-17 19:37:35.737593169 +0100
    1.72 -+++ ioemu/block-cloop.c	2006-08-17 19:50:28.886943095 +0100
    1.73 -@@ -55,7 +55,7 @@
    1.74 -     BDRVCloopState *s = bs->opaque;
    1.75 -     uint32_t offsets_size,max_compressed_block_size=1,i;
    1.76 - 
    1.77 --    s->fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
    1.78 -+    s->fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE | O_SYNC);
    1.79 -     if (s->fd < 0)
    1.80 -         return -1;
    1.81 -     bs->read_only = 1;
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/ioemu/patches/qemu-tunable-ide-write-cache	Mon Aug 21 00:01:11 2006 +0100
     2.3 @@ -0,0 +1,57 @@
     2.4 +Index: ioemu/hw/ide.c
     2.5 +===================================================================
     2.6 +--- ioemu.orig/hw/ide.c	2006-08-20 22:22:36.000000000 +0100
     2.7 ++++ ioemu/hw/ide.c	2006-08-20 23:56:13.000000000 +0100
     2.8 +@@ -305,6 +305,7 @@
     2.9 +     PCIDevice *pci_dev;
    2.10 +     struct BMDMAState *bmdma;
    2.11 +     int drive_serial;
    2.12 ++    int write_cache;
    2.13 +     /* ide regs */
    2.14 +     uint8_t feature;
    2.15 +     uint8_t error;
    2.16 +@@ -789,6 +790,9 @@
    2.17 +     }
    2.18 +     ide_set_sector(s, sector_num + n);
    2.19 +     
    2.20 ++    if (!s->write_cache)
    2.21 ++        bdrv_flush(s->bs);
    2.22 ++    
    2.23 + #ifdef TARGET_I386
    2.24 +     if (win2k_install_hack && ((++s->irq_count % 16) == 0)) {
    2.25 +         /* It seems there is a bug in the Windows 2000 installer HDD
    2.26 +@@ -863,6 +867,10 @@
    2.27 +         transfer_size -= len;
    2.28 +         phys_addr += len;
    2.29 +     }
    2.30 ++    /* Ensure the data hit disk before telling the guest OS so. */
    2.31 ++    if (!s->write_cache)
    2.32 ++        bdrv_flush(s->bs);
    2.33 ++
    2.34 +     return transfer_size1 - transfer_size;
    2.35 + }
    2.36 + 
    2.37 +@@ -1672,7 +1680,15 @@
    2.38 +             /* XXX: valid for CDROM ? */
    2.39 +             switch(s->feature) {
    2.40 +             case 0x02: /* write cache enable */
    2.41 ++                s->write_cache = 1;
    2.42 ++                s->status = READY_STAT | SEEK_STAT;
    2.43 ++                ide_set_irq(s);
    2.44 ++                break;
    2.45 +             case 0x82: /* write cache disable */
    2.46 ++                s->write_cache = 0;
    2.47 ++                s->status = READY_STAT | SEEK_STAT;
    2.48 ++                ide_set_irq(s);
    2.49 ++                break;
    2.50 +             case 0xaa: /* read look-ahead enable */
    2.51 +             case 0x55: /* read look-ahead disable */
    2.52 +                 s->status = READY_STAT | SEEK_STAT;
    2.53 +@@ -2090,6 +2106,7 @@
    2.54 +         s->irq = irq;
    2.55 +         s->sector_write_timer = qemu_new_timer(vm_clock, 
    2.56 +                                                ide_sector_write_timer_cb, s);
    2.57 ++        s->write_cache = 0;
    2.58 +         ide_reset(s);
    2.59 +     }
    2.60 + }
     3.1 --- a/tools/ioemu/patches/series	Sun Aug 20 23:59:34 2006 +0100
     3.2 +++ b/tools/ioemu/patches/series	Mon Aug 21 00:01:11 2006 +0100
     3.3 @@ -39,8 +39,8 @@ xenstore-block-device-config
     3.4  xenstore-write-vnc-port
     3.5  qemu-allow-disable-sdl
     3.6  qemu-fix-memset-args
     3.7 -qemu-fix-write-to-disk-synchronous
     3.8  xen-support-buffered-ioreqs
     3.9  qemu-daemonize
    3.10  xen-platform-device
    3.11  qemu-bootorder
    3.12 +qemu-tunable-ide-write-cache