1. 03 5月, 2010 7 次提交
    • S
      block: Cache total_sectors to reduce bdrv_getlength calls · 51762288
      Stefan Hajnoczi 提交于
      The BlockDriver bdrv_getlength function is called from the I/O code path
      when checking that the request falls within the device.  Unfortunately
      this involves an lseek system call in the raw protocol; every read or
      write request will incur this lseek cost.
      
      Jan Kiszka <jan.kiszka@siemens.com> identified this issue and its
      latency overhead.  This patch caches device length in the existing
      total_sectors variable so lseek calls can be avoided for fixed size
      devices.
      
      Growable devices fall back to the full bdrv_getlength code path because
      I have not added logic to detect extending the size of the device in a
      write.
      Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      51762288
    • S
      block: Set backing_hd to NULL after deleting it · 557df6ac
      Stefan Hajnoczi 提交于
      It is safer to set backing_hd to NULL after deleting it so that any use
      after deletion is obvious during development.  Happy segfaulting!
      
      This patch should be applied after Kevin Wolf's "vmdk: Convert to
      bdrv_open" so that vmdk does not segfault on close.
      Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      557df6ac
    • K
      block: bdrv_has_zero_init · f2feebbd
      Kevin Wolf 提交于
      This fixes the problem that qemu-img's use of no_zero_init only considered the
      no_zero_init flag of the format driver, but not of the underlying protocols.
      
      Between the raw/file split and this fix, converting to host devices is broken.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      f2feebbd
    • 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
    • K
      block: Avoid forward declaration of bdrv_open_common · 57915332
      Kevin Wolf 提交于
      Move bdrv_open_common so it's defined before its callers and remove the forward
      declaration.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      57915332
    • K
      block: Split bdrv_open · b6ce07aa
      Kevin Wolf 提交于
      bdrv_open contains quite some code that is only useful for opening images (as
      opposed to opening files by a protocol), for example snapshots.
      
      This patch splits the code so that we have bdrv_open_file() for files (uses
      protocols), bdrv_open() for images (uses format drivers) and bdrv_open_common()
      for the code common for opening both images and files.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      b6ce07aa
    • 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 7 次提交
  3. 10 4月, 2010 3 次提交
  4. 17 3月, 2010 1 次提交
  5. 20 2月, 2010 1 次提交
  6. 11 2月, 2010 3 次提交
  7. 10 2月, 2010 1 次提交
  8. 27 1月, 2010 5 次提交
  9. 21 1月, 2010 1 次提交
  10. 20 1月, 2010 4 次提交
  11. 14 1月, 2010 3 次提交
  12. 26 12月, 2009 1 次提交
  13. 12 12月, 2009 2 次提交
  14. 04 12月, 2009 1 次提交