1. 03 5月, 2010 3 次提交
    • S
      raw-posix: Use pread/pwrite instead of lseek+read/write · 4899d10d
      Stefan Hajnoczi 提交于
      This patch combines the lseek+read/write calls to use pread/pwrite
      instead.  This will result in fewer system calls and is already used by
      AIO.
      
      Thanks to Jan Kiszka <jan.kiszka@siemens.com> for identifying excessive
      lseek and Christoph Hellwig <hch@lst.de> for confirming that this
      approach should work.
      Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      4899d10d
    • K
      block: Open the underlying image file in generic code · 66f82cee
      Kevin Wolf 提交于
      Format drivers shouldn't need to bother with things like file names, but rather
      just get an open BlockDriverState for the underlying protocol. This patch
      introduces this behaviour for bdrv_open implementation. For protocols which
      need to access the filename to open their file/device/connection/... a new
      callback bdrv_file_open is introduced which doesn't get an underlying file
      opened.
      
      For now, also some of the more obscure formats use bdrv_file_open because they
      open() the file themselves instead of using the block.c functions. They need to
      be fixed in later patches.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      66f82cee
    • C
      block: separate raw images from the file protocol · 84a12e66
      Christoph Hellwig 提交于
      We're running into various problems because the "raw" file access, which
      is used internally by the various image formats is entangled with the
      "raw" image format, which maps the VM view 1:1 to a file system.
      
      This patch renames the raw file backends to the file protocol which
      is treated like other protocols (e.g. nbd and http) and adds a new
      "raw" image format which is just a wrapper around calls to the underlying
      protocol.
      
      The patch is surprisingly simple, besides changing the probing logical
      in block.c to only look for image formats when using bdrv_open and
      renaming of the old raw protocols to file there's almost nothing in there.
      
      For creating images, a new bdrv_create_file is introduced which guesses the
      protocol to use. This allows using qemu-img create -f raw (or just using the
      default) for both files and host devices. Converting the other format drivers
      to use this function to create their images is left for later patches.
      
      The only issues still open are in the handling of the host devices.
      Firstly in current qemu we can specifiy the host* format names
      on various command line acceping images, but the new code can't
      do that without adding some translation.  Second the layering breaks
      the no_zero_init flag in the BlockDriver used by qemu-img.  I'm not
      happy how this is done per-driver instead of per-state so I'll
      prepare a separate patch to clean this up.
      
      There's some more cleanup opportunity after this patch, e.g. using
      separate lists and registration functions for image formats vs
      protocols and maybe even host drivers, but this can be done at a
      later stage.
      
      Also there's a check for protocol in bdrv_open for the BDRV_O_SNAPSHOT
      case that I don't quite understand, but which I fear won't work as
      expected - possibly even before this patch.
      
      Note that this patch requires various recent block patches from Kevin
      and me, which should all be in his block queue.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      84a12e66
  2. 23 4月, 2010 1 次提交
  3. 10 4月, 2010 1 次提交
  4. 27 3月, 2010 1 次提交
  5. 27 1月, 2010 3 次提交
  6. 20 1月, 2010 3 次提交
  7. 04 12月, 2009 2 次提交
  8. 30 11月, 2009 1 次提交
  9. 30 10月, 2009 1 次提交
  10. 28 10月, 2009 1 次提交
    • K
      raw/linux-aio: Also initialize POSIX AIO · d2e46345
      Kevin Wolf 提交于
      When using Linux AIO raw still falls back to POSIX AIO sometimes, so we should
      initialize it.
      
      Not initializing it happens to work if POSIX AIO is used by another drive, or
      if the format is not specified (probing the format uses POSIX AIO) or by pure
      luck (e.g. it doesn't seem to happen any more with qcow2 since we have re-added
      synchronous qcow2 functions).
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      d2e46345
  11. 06 10月, 2009 1 次提交
  12. 11 9月, 2009 2 次提交
  13. 28 8月, 2009 3 次提交
    • S
      Don't compile aio code if CONFIG_LINUX_AIO is undefined · e44bd6fc
      Stefan Weil 提交于
      This patch fixes linker errors when building QEMU without Linux AIO support.
      
      It is based on suggestions from malc and Kevin Wolf.
      Signed-off-by: NStefan Weil <weil@mail.berlios.de>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      e44bd6fc
    • C
      raw-posix: add Linux native AIO support · 5c6c3a6c
      Christoph Hellwig 提交于
      Now that do have a nicer interface to work against we can add Linux native
      AIO support.  It's an extremly thing layer just setting up an iocb for
      the io_submit system call in the submission path, and registering an
      eventfd with the qemu poll handler to do complete the iocbs directly
      from there.
      
      This started out based on Anthony's earlier AIO patch, but after
      estimated 42,000 rewrites and just as many build system changes
      there's not much left of it.
      
      To enable native kernel aio use the aio=native sub-command on the
      drive command line.  I have also added an option to qemu-io to
      test the aio support without needing a guest.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      5c6c3a6c
    • C
      raw-posix: refactor AIO support · 9ef91a67
      Christoph Hellwig 提交于
      Currently the raw-posix.c code contains a lot of knowledge about the
      asynchronous I/O scheme that is mostly implemented in posix-aio-compat.c.
      All this code does not really belong here and is getting a bit in the
      way of implementing native AIO on Linux.
      
      So instead move all the guts of the AIO implementation into
      posix-aio-compat.c (which might need a better name, btw).
      
      There's now a very small interface between the AIO providers and raw-posix.c:
      
       - an init routine is called from raw_open_common to return an AIO context
         for this drive.  An AIO implementation may either re-use one context
         for all drives, or use a different one for each as the Linux native
         AIO support will do.
       - an submit routine is called from the aio_reav/writev methods to submit
         an AIO request
      
      There are no indirect calls involved in this interface as we need to
      decide which one to call manually.  We will only call the Linux AIO native
      init function if we were requested to by vl.c, and we will only call
      the native submit function if we are asked to and the request is properly
      aligned.  That's also the reason why the alignment check actually does
      the inverse move and now goes into raw-posix.c.
      
      The old posix-aio-compat.h headers is removed now that most of it's
      content is private to posix-aio-compat.c, and instead we add a new
      block/raw-posix-aio.h headers is created containing only the tiny interface
      between raw-posix.c and the AIO implementation.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      9ef91a67
  14. 24 8月, 2009 1 次提交
  15. 28 7月, 2009 1 次提交
  16. 21 7月, 2009 1 次提交
  17. 17 7月, 2009 1 次提交
  18. 10 7月, 2009 2 次提交
  19. 30 6月, 2009 2 次提交
    • K
      block-raw: Allow pread beyond the end of growable images · 22afa7b5
      Kevin Wolf 提交于
      When using O_DIRECT, qcow2 snapshots didn't work any more for me. In the
      process of creating the snapshot, qcow2 tries to pwrite some new information
      (e.g. new L1 table) which will often end up being after the old end of the
      image file. Now pwrite tries to align things and reads the old contents of the
      file, read returns 0 because there is nothing to read after the end of file and
      pwrite is stuck in an endless loop.
      
      This patch allows to pread beyond the end of an image file. Whenever the
      given offset is after the end of the image file, the read succeeds and fills
      the buffer with zeros.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      22afa7b5
    • R
      support colon in filenames · 707c0dbc
      Ram Pai 提交于
      Problem: It is impossible to feed filenames with the character colon because
      qemu interprets such names as a protocol. For example filename scsi:0, is
      interpreted as a protocol by name "scsi".
      
      This patch allows user to espace colon characters. For example the above
      filename can now be expressed either as 'scsi\:0' or as file:scsi:0
      
      anything following the "file:" tag is interpreted verbatin. However if "file:"
      tag is omitted then any colon characters in the string must be escaped using
      backslash.
      
      Here are couple of examples:
      
      scsi\:0\:abc is a local file scsi:0:abc
      http\://myweb is a local file by name http://myweb
      file:scsi:0:abc is a local file scsi:0:abc
      file:http://myweb is a local file by name http://mywebSigned-off-by: NRam Pai <linuxram@us.ibm.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      707c0dbc
  20. 17 6月, 2009 3 次提交
  21. 15 6月, 2009 5 次提交
    • C
      raw-posix: cleanup ioctl methods · 63ec93db
      Christoph Hellwig 提交于
      Rename raw_ioctl and raw_aio_ioctl to hdev_ioctl and hdev_aio_ioctl as they
      are only used for the host device.  Also only add them to the method table
      for the cases where we need them (generic hdev if linux and linux CDROM)
      instead of declaring stubs and always add them.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      63ec93db
    • C
      block: add bdrv_probe_device method · 508c7cb3
      Christoph Hellwig 提交于
      Add a bdrv_probe_device method to all BlockDriver instances implementing
      host devices to move matching of host device types into the actual drivers.
      For now we keep exacly the old matching behaviour based on the devices names,
      although we really should have better detetion methods based on device
      information in the future.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      508c7cb3
    • C
      raw-posix: split hdev drivers · f3a5d3f8
      Christoph Hellwig 提交于
      Instead of declaring one BlockDriver for all host devices declared one
      for each type:  a generic one for normal disk devices, a Linux floppy
      driver and a CDROM driver for Linux and FreeBSD.  This gets rid of a lot
      of messy ifdefs and switching based on the type in the various removal
      device methods.
      
      block.c grows a new method to find the correct host device driver based
      on OS-sepcific criteria, which will later into the actual drivers in a
      later patch in this series.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      f3a5d3f8
    • C
      raw-posix: add a raw_open_common helper · 90babde0
      Christoph Hellwig 提交于
      raw_open and hdev_open contain the same basic logic.  Add a new
      raw_open_common helper containing the guts of the open routine
      and call it from raw_open and hdev_open.
      
      We use the new open_flags field in BDRVRawState to allow passing
      additional open flags to raw_open_common from both.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      90babde0
    • C
      raw-posix: always store open flags · 0e1d8f4c
      Christoph Hellwig 提交于
      Both the Linux floppy and the FreeBSD CDROM host device need to store
      the open flags so that they can re-open the device later.  Store the
      open flags unconditionally to remove the ifdef mess and simply the
      calling conventions for the later patches in the series.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      0e1d8f4c
  22. 06 6月, 2009 1 次提交