direct-io.hg

changeset 4522:d56c3246d889

bitkeeper revision 1.1294 (425d9f852SL8ULzr5896Y6r81VmGmQ)

Manual merge
author iap10@tetris.cl.cam.ac.uk
date Wed Apr 13 22:39:01 2005 +0000 (2005-04-13)
parents 5e994310f44f ecf23e1373cc
children b0422f2ab81d 509c50be31b2
files BitKeeper/etc/logging_ok linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32 linux-2.6.11-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32 tools/libxc/xc_io.h tools/libxc/xc_linux_save.c tools/libxutil/file_stream.c tools/libxutil/gzip_stream.c tools/libxutil/iostream.h xen/arch/x86/setup.c xen/arch/x86/smpboot.c
line diff
     1.1 --- a/BitKeeper/etc/logging_ok	Wed Apr 13 10:40:06 2005 +0000
     1.2 +++ b/BitKeeper/etc/logging_ok	Wed Apr 13 22:39:01 2005 +0000
     1.3 @@ -14,6 +14,7 @@ br260@labyrinth.cl.cam.ac.uk
     1.4  br260@laudney.cl.cam.ac.uk
     1.5  bren@anvil.research
     1.6  bren@br260.wolfson.cam.ac.uk
     1.7 +ccoffing@novell.com
     1.8  cl349@arcadians.cl.cam.ac.uk
     1.9  cl349@firebug.cl.cam.ac.uk
    1.10  cl349@freefall.cl.cam.ac.uk
     2.1 --- a/linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32	Wed Apr 13 10:40:06 2005 +0000
     2.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32	Wed Apr 13 22:39:01 2005 +0000
     2.3 @@ -51,6 +51,7 @@ CONFIG_KOBJECT_UEVENT=y
     2.4  # CONFIG_IKCONFIG is not set
     2.5  # CONFIG_EMBEDDED is not set
     2.6  CONFIG_KALLSYMS=y
     2.7 +# CONFIG_KALLSYMS_ALL is not set
     2.8  # CONFIG_KALLSYMS_EXTRA_PASS is not set
     2.9  CONFIG_FUTEX=y
    2.10  CONFIG_EPOLL=y
    2.11 @@ -163,8 +164,15 @@ CONFIG_PCMCIA_PROBE=y
    2.12  #
    2.13  # Kernel hacking
    2.14  #
    2.15 -# CONFIG_DEBUG_KERNEL is not set
    2.16 +CONFIG_DEBUG_KERNEL=y
    2.17  CONFIG_EARLY_PRINTK=y
    2.18 +# CONFIG_DEBUG_STACKOVERFLOW is not set
    2.19 +# CONFIG_DEBUG_STACK_USAGE is not set
    2.20 +# CONFIG_DEBUG_SLAB is not set
    2.21 +CONFIG_MAGIC_SYSRQ=y
    2.22 +# CONFIG_DEBUG_SPINLOCK is not set
    2.23 +# CONFIG_DEBUG_PAGEALLOC is not set
    2.24 +# CONFIG_DEBUG_INFO is not set
    2.25  # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
    2.26  # CONFIG_FRAME_POINTER is not set
    2.27  # CONFIG_4KSTACKS is not set
    2.28 @@ -190,6 +198,7 @@ CONFIG_BINFMT_ELF=y
    2.29  # CONFIG_STANDALONE is not set
    2.30  CONFIG_PREVENT_FIRMWARE_BUILD=y
    2.31  # CONFIG_FW_LOADER is not set
    2.32 +# CONFIG_DEBUG_DRIVER is not set
    2.33  
    2.34  #
    2.35  # Memory Technology Devices (MTD)
    2.36 @@ -357,8 +366,8 @@ CONFIG_AIC79XX_REG_PRETTY_PRINT=y
    2.37  # CONFIG_SCSI_DPT_I2O is not set
    2.38  # CONFIG_SCSI_ADVANSYS is not set
    2.39  # CONFIG_SCSI_IN2000 is not set
    2.40 -# CONFIG_MEGARAID_NEWGEN is not set
    2.41 -# CONFIG_MEGARAID_LEGACY is not set
    2.42 +CONFIG_MEGARAID_NEWGEN=y
    2.43 +# CONFIG_MEGARAID_MM is not set
    2.44  CONFIG_SCSI_SATA=y
    2.45  # CONFIG_SCSI_SATA_AHCI is not set
    2.46  # CONFIG_SCSI_SATA_SVW is not set
    2.47 @@ -440,7 +449,9 @@ CONFIG_DM_MIRROR=y
    2.48  #
    2.49  # Fusion MPT device support
    2.50  #
    2.51 -# CONFIG_FUSION is not set
    2.52 +CONFIG_FUSION=y
    2.53 +CONFIG_FUSION_MAX_SGE=40
    2.54 +# CONFIG_FUSION_CTL is not set
    2.55  
    2.56  #
    2.57  # IEEE 1394 (FireWire) support
     3.1 --- a/linux-2.6.11-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32	Wed Apr 13 10:40:06 2005 +0000
     3.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32	Wed Apr 13 22:39:01 2005 +0000
     3.3 @@ -47,6 +47,7 @@ CONFIG_KOBJECT_UEVENT=y
     3.4  # CONFIG_IKCONFIG is not set
     3.5  # CONFIG_EMBEDDED is not set
     3.6  CONFIG_KALLSYMS=y
     3.7 +# CONFIG_KALLSYMS_ALL is not set
     3.8  # CONFIG_KALLSYMS_EXTRA_PASS is not set
     3.9  CONFIG_FUTEX=y
    3.10  CONFIG_EPOLL=y
    3.11 @@ -130,8 +131,15 @@ CONFIG_HAVE_DEC_LOCK=y
    3.12  #
    3.13  # Kernel hacking
    3.14  #
    3.15 -# CONFIG_DEBUG_KERNEL is not set
    3.16 +CONFIG_DEBUG_KERNEL=y
    3.17  CONFIG_EARLY_PRINTK=y
    3.18 +# CONFIG_DEBUG_STACKOVERFLOW is not set
    3.19 +# CONFIG_DEBUG_STACK_USAGE is not set
    3.20 +# CONFIG_DEBUG_SLAB is not set
    3.21 +CONFIG_MAGIC_SYSRQ=y
    3.22 +# CONFIG_DEBUG_SPINLOCK is not set
    3.23 +# CONFIG_DEBUG_PAGEALLOC is not set
    3.24 +# CONFIG_DEBUG_INFO is not set
    3.25  # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
    3.26  # CONFIG_FRAME_POINTER is not set
    3.27  # CONFIG_4KSTACKS is not set
    3.28 @@ -157,6 +165,7 @@ CONFIG_BINFMT_ELF=y
    3.29  CONFIG_STANDALONE=y
    3.30  CONFIG_PREVENT_FIRMWARE_BUILD=y
    3.31  # CONFIG_FW_LOADER is not set
    3.32 +# CONFIG_DEBUG_DRIVER is not set
    3.33  
    3.34  #
    3.35  # Block devices
     4.1 --- a/tools/libxc/xc_io.h	Wed Apr 13 10:40:06 2005 +0000
     4.2 +++ b/tools/libxc/xc_io.h	Wed Apr 13 22:39:01 2005 +0000
     4.3 @@ -45,14 +45,14 @@ static inline int xcio_read(XcIOContext 
     4.4      int rc;
     4.5  
     4.6      rc = IOStream_read(ctxt->io, buf, n);
     4.7 -    return (rc == n ? 0 : rc);
     4.8 +    return (rc == n ? 0 : -1);
     4.9  }
    4.10  
    4.11  static inline int xcio_write(XcIOContext *ctxt, void *buf, int n){
    4.12      int rc;
    4.13  
    4.14      rc = IOStream_write(ctxt->io, buf, n);
    4.15 -    return (rc == n ? 0 : rc);
    4.16 +    return (rc == n ? 0 : -1);
    4.17  }
    4.18  
    4.19  static inline int xcio_flush(XcIOContext *ctxt){
     5.1 --- a/tools/libxc/xc_linux_save.c	Wed Apr 13 10:40:06 2005 +0000
     5.2 +++ b/tools/libxc/xc_linux_save.c	Wed Apr 13 22:39:01 2005 +0000
     5.3 @@ -173,7 +173,6 @@ static int xcio_ratewrite(XcIOContext *i
     5.4      struct timeval now;
     5.5      struct timespec delay;
     5.6      long long delta;
     5.7 -    int rc;
     5.8  
     5.9      if (START_MBIT_RATE == 0)
    5.10  	return xcio_write(ioctxt, buf, n);
    5.11 @@ -213,8 +212,7 @@ static int xcio_ratewrite(XcIOContext *i
    5.12  	    }
    5.13  	}
    5.14      }
    5.15 -    rc = IOStream_write(ioctxt->io, buf, n);
    5.16 -    return (rc == n ? 0 : rc);
    5.17 +    return xcio_write(ioctxt, buf, n);
    5.18  }
    5.19  
    5.20  static int print_stats( int xc_handle, u32 domid, 
     6.1 --- a/tools/libxutil/file_stream.c	Wed Apr 13 10:40:06 2005 +0000
     6.2 +++ b/tools/libxutil/file_stream.c	Wed Apr 13 22:39:01 2005 +0000
     6.3 @@ -151,7 +151,12 @@ static int file_error(IOStream *s){
     6.4   * @return result of the close
     6.5   */
     6.6  static int file_close(IOStream *s){
     6.7 -    return fclose(get_file(s));
     6.8 +    int result = 0;
     6.9 +    if (s->data){
    6.10 +        result = fclose(get_file(s));
    6.11 +        s->data = (void*)0;
    6.12 +    }
    6.13 +    return result;
    6.14  }
    6.15  
    6.16  /** Free a file stream.
    6.17 @@ -159,7 +164,7 @@ static int file_close(IOStream *s){
    6.18   * @param s file stream
    6.19   */
    6.20  static void file_free(IOStream *s){
    6.21 -    // Do nothing - fclose does it all?
    6.22 +    file_close(s);
    6.23  }
    6.24  
    6.25  /** Create an IOStream for a stream.
    6.26 @@ -189,7 +194,6 @@ IOStream *file_stream_fopen(const char *
    6.27  	io = file_stream_new(fin);
    6.28  	if(!io){
    6.29  	    fclose(fin);
    6.30 -	    //free(fin); // fclose frees ?
    6.31  	}
    6.32      }
    6.33      return io;
    6.34 @@ -199,13 +203,16 @@ IOStream *file_stream_fopen(const char *
    6.35   *
    6.36   * @param fd file descriptor
    6.37   * @param flags giving the mode to open in (as for fdopen())
    6.38 - * @return new stream for the open file, or 0 if failed
    6.39 + * @return new stream for the open file, or 0 if failed.  Always takes
    6.40 + *         ownership of fd.
    6.41   */
    6.42  IOStream *file_stream_fdopen(int fd, const char *flags){
    6.43      IOStream *io = 0;
    6.44      FILE *fin = fdopen(fd, flags);
    6.45      if(fin){
    6.46 -	io = file_stream_new(fin);
    6.47 +        io = file_stream_new(fin);
    6.48 +        if(!io)
    6.49 +            fclose(fin);
    6.50      }
    6.51      return io;
    6.52  }
     7.1 --- a/tools/libxutil/gzip_stream.c	Wed Apr 13 10:40:06 2005 +0000
     7.2 +++ b/tools/libxutil/gzip_stream.c	Wed Apr 13 22:39:01 2005 +0000
     7.3 @@ -107,7 +107,12 @@ static int gzip_error(IOStream *s){
     7.4   * @return result of the close
     7.5   */
     7.6  static int gzip_close(IOStream *s){
     7.7 -    return gzclose(get_gzfile(s));
     7.8 +    int result = 0;
     7.9 +    if (s->data){
    7.10 +        result = gzclose(get_gzfile(s));
    7.11 +        s->data = (void*)0;
    7.12 +    }
    7.13 +    return result;
    7.14  }
    7.15  
    7.16  /** Free a gzip stream.
    7.17 @@ -115,7 +120,7 @@ static int gzip_close(IOStream *s){
    7.18   * @param s gzip stream
    7.19   */
    7.20  static void gzip_free(IOStream *s){
    7.21 -    // Do nothing - fclose does it all?
    7.22 +    gzip_close(s);
    7.23  }
    7.24  
    7.25  /** Create an IOStream for a gzip stream.
    7.26 @@ -143,11 +148,10 @@ IOStream *gzip_stream_fopen(const char *
    7.27      gzFile *fgz;
    7.28      fgz = gzopen(file, flags);
    7.29      if(fgz){
    7.30 -	io = gzip_stream_new(fgz);
    7.31 -	if(!io){
    7.32 -	    gzclose(fgz);
    7.33 -	    //free(fgz); // gzclose frees ?
    7.34 -	}
    7.35 +        io = gzip_stream_new(fgz);
    7.36 +        if(!io){
    7.37 +            gzclose(fgz);
    7.38 +        }
    7.39      }
    7.40      return io;
    7.41  }
    7.42 @@ -156,14 +160,17 @@ IOStream *gzip_stream_fopen(const char *
    7.43   *
    7.44   * @param fd file descriptor
    7.45   * @param flags giving the mode to open in (as for fdopen())
    7.46 - * @return new stream for the open file, or NULL if failed
    7.47 + * @return new stream for the open file, or NULL if failed.  Always takes
    7.48 + *         ownership of fd.
    7.49   */
    7.50  IOStream *gzip_stream_fdopen(int fd, const char *flags){
    7.51      IOStream *io = NULL;
    7.52      gzFile *fgz;
    7.53      fgz = gzdopen(fd, flags);
    7.54      if(fgz){
    7.55 -	io = gzip_stream_new(fgz);
    7.56 +        io = gzip_stream_new(fgz);
    7.57 +        if(!io)
    7.58 +            gzclose(fgz);
    7.59      }
    7.60      return io;
    7.61  }
     8.1 --- a/tools/libxutil/iostream.h	Wed Apr 13 10:40:06 2005 +0000
     8.2 +++ b/tools/libxutil/iostream.h	Wed Apr 13 22:39:01 2005 +0000
     8.3 @@ -105,8 +105,11 @@ extern int IOStream_vprint(IOStream *io,
     8.4   * @return if ok, number of bytes read, otherwise negative error code
     8.5   */
     8.6  static inline int IOStream_read(IOStream *stream, void *buf, size_t n){
     8.7 -    int result = 0;
     8.8 -    if(stream->closed) goto exit;
     8.9 +    int result;
    8.10 +    if(stream->closed){
    8.11 +        result = IOSTREAM_EOF;
    8.12 +        goto exit;
    8.13 +    }
    8.14      if(!stream->methods || !stream->methods->read){
    8.15          result = -EINVAL;
    8.16          goto exit;
    8.17 @@ -124,11 +127,14 @@ static inline int IOStream_read(IOStream
    8.18   * @param stream input
    8.19   * @param buf where to put input
    8.20   * @param n number of bytes to write
    8.21 - * @return if ok, number of bytes read, otherwise negative error code
    8.22 + * @return if ok, number of bytes written, otherwise negative error code
    8.23   */
    8.24  static inline int IOStream_write(IOStream *stream, const void *buf, size_t n){
    8.25 -    int result = 0;
    8.26 -    if(stream->closed) goto exit;
    8.27 +    int result;
    8.28 +    if(stream->closed){
    8.29 +        result = IOSTREAM_EOF;
    8.30 +        goto exit;
    8.31 +    }
    8.32      if(!stream->methods || !stream->methods->write){
    8.33          result = -EINVAL;
    8.34          goto exit;
    8.35 @@ -179,6 +185,7 @@ static inline int IOStream_close(IOStrea
    8.36      int err = 1;
    8.37      if(stream->methods && stream->methods->close){
    8.38          err = stream->methods->close(stream);
    8.39 +        stream->closed = 1;
    8.40      }
    8.41      return err;
    8.42  }
    8.43 @@ -189,7 +196,7 @@ static inline int IOStream_close(IOStrea
    8.44   * @return 1 if closed, 0 otherwise
    8.45   */
    8.46  static inline int IOStream_is_closed(IOStream *stream){
    8.47 -  return stream->closed;
    8.48 +    return stream->closed;
    8.49  }
    8.50  
    8.51  /** Free the memory used by the stream.
    8.52 @@ -197,11 +204,14 @@ static inline int IOStream_is_closed(IOS
    8.53   * @param stream to free
    8.54   */
    8.55  static inline void IOStream_free(IOStream *stream){
    8.56 -  if(stream->methods && stream->methods->free){
    8.57 -    stream->methods->free(stream);
    8.58 -  }
    8.59 -  *stream = (IOStream){};
    8.60 -  deallocate(stream);
    8.61 +    if(!stream->closed && stream->methods && stream->methods->close){
    8.62 +        stream->methods->close(stream);
    8.63 +    }
    8.64 +    if(stream->methods && stream->methods->free){
    8.65 +        stream->methods->free(stream);
    8.66 +    }
    8.67 +    *stream = (IOStream){};
    8.68 +    deallocate(stream);
    8.69  }
    8.70  
    8.71  
    10.1 --- a/xen/arch/x86/smpboot.c	Wed Apr 13 10:40:06 2005 +0000
    10.2 +++ b/xen/arch/x86/smpboot.c	Wed Apr 13 22:39:01 2005 +0000
    10.3 @@ -51,8 +51,10 @@
    10.4  
    10.5  #ifdef CONFIG_SMP
    10.6  
    10.7 -/* Setup configured maximum number of CPUs to activate */
    10.8 +/* Cconfigured maximum number of CPUs to activate. We name the parameter 
    10.9 +"maxcpus" rather than max_cpus to be compatible with Linux */
   10.10  static int max_cpus = -1;
   10.11 +integer_param("maxcpus", max_cpus); 
   10.12  
   10.13  /* Total count of live CPUs */
   10.14  int smp_num_cpus = 1;