1. 07 11月, 2013 1 次提交
  2. 29 10月, 2013 1 次提交
    • K
      block: Avoid unecessary drv->bdrv_getlength() calls · b94a2610
      Kevin Wolf 提交于
      The block layer generally keeps the size of an image cached in
      bs->total_sectors so that it doesn't have to perform expensive
      operations to get the size whenever it needs it.
      
      This doesn't work however when using a backend that can change its size
      without qemu being aware of it, i.e. passthrough of removable media like
      CD-ROMs or floppy disks. For this reason, the caching is disabled when a
      removable device is used.
      
      It is obvious that checking whether the _guest_ device has removable
      media isn't the right thing to do when we want to know whether the size
      of the host backend can change. To make things worse, non-top-level
      BlockDriverStates never have any device attached, which makes qemu
      assume they are removable, so drv->bdrv_getlength() is always called on
      the protocol layer. In the case of raw-posix, this causes unnecessary
      lseek() system calls, which turned out to be rather expensive.
      
      This patch completely changes the logic and disables bs->total_sectors
      caching only for certain block driver types, for which a size change is
      expected: host_cdrom and host_floppy on POSIX, host_device on win32; also
      the raw format in case it sits on top of one of these protocols, but in
      the common case the nested bdrv_getlength() call on the protocol driver
      will use the cache again and avoid an expensive drv->bdrv_getlength()
      call.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      b94a2610
  3. 11 10月, 2013 1 次提交
  4. 25 9月, 2013 1 次提交
  5. 12 9月, 2013 2 次提交
  6. 06 9月, 2013 3 次提交
  7. 28 6月, 2013 2 次提交
    • P
      block: change default of .has_zero_init to 0 · 3ac21627
      Peter Lieven 提交于
      .has_zero_init defaults to 1 for all formats and protocols.
      
      this is a dangerous default since this means that all
      new added drivers need to manually overwrite it to 0 if
      they do not ensure that a device is zero initialized
      after bdrv_create().
      
      if a driver needs to explicitly set this value to
      1 its easier to verify the correctness in the review process.
      
      during review of the existing drivers it turned out
      that ssh and gluster had a wrong default of 1.
      both protocols support host_devices as backend
      which are not by default zero initialized. this
      wrong assumption will lead to possible corruption
      if qemu-img convert is used to write to such a backend.
      
      vpc and vmdk also defaulted to 1 altough they support
      fixed respectively flat extends. this has to be addresses
      in separate patches. both formats as well as the mentioned
      ssh and gluster are turned to the default of 0 with this
      patch for safety.
      
      a similar problem with the wrong default existed for
      iscsi most likely because the driver developer did
      oversee the default value of 1.
      Signed-off-by: NPeter Lieven <pl@kamp.de>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      3ac21627
    • K
      raw-posix: Fix /dev/cdrom magic on OS X · a5c5ea3f
      Kevin Wolf 提交于
      The raw-posix driver has code to provide a /dev/cdrom on OS X even
      though it doesn't really exist. However, since commit c66a6157 the real
      filename is dismissed after finding it, so opening /dev/cdrom fails.
      Put the filename back into the options QDict to make this work again.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      a5c5ea3f
  8. 22 4月, 2013 2 次提交
  9. 23 3月, 2013 1 次提交
  10. 15 3月, 2013 1 次提交
    • S
      threadpool: drop global thread pool · c4d9d196
      Stefan Hajnoczi 提交于
      Now that each AioContext has a ThreadPool and the main loop AioContext
      can be fetched with bdrv_get_aio_context(), we can eliminate the concept
      of a global thread pool from thread-pool.c.
      
      The submit functions must take a ThreadPool* argument.
      
      block/raw-posix.c and block/raw-win32.c use
      aio_get_thread_pool(bdrv_get_aio_context(bs)) to fetch the main loop's
      ThreadPool.
      
      tests/test-thread-pool.c must be updated to reflect the new
      thread_pool_submit() function prototypes.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      c4d9d196
  11. 12 2月, 2013 1 次提交
  12. 01 2月, 2013 1 次提交
  13. 19 1月, 2013 1 次提交
  14. 15 1月, 2013 4 次提交
  15. 14 1月, 2013 2 次提交
    • S
      block: make qiov_is_aligned() public · c53b1c51
      Stefan Hajnoczi 提交于
      The qiov_is_aligned() function checks whether a QEMUIOVector meets a
      BlockDriverState's alignment requirements.  This is needed by
      virtio-blk-data-plane so:
      
      1. Move the function from block/raw-posix.c to block/block.c.
      2. Make it public in block/block.h.
      3. Rename to bdrv_qiov_is_aligned().
      4. Change return type from int to bool.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      c53b1c51
    • P
      raw-posix: fix bdrv_aio_ioctl · b608c8dc
      Paolo Bonzini 提交于
      When the raw-posix aio=thread code was moved from posix-aio-compat.c
      to block/raw-posix.c, there was an unintended change to the ioctl code.
      The code used to return the ioctl command, which posix_aio_read()
      would later morph into a zero.  This hack is not necessary anymore,
      and in fact breaks scsi-generic (which expects a zero return code).
      Remove it.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      b608c8dc
  16. 02 1月, 2013 1 次提交
    • S
      raw-posix: add raw_get_aio_fd() for virtio-blk-data-plane · 4065742a
      Stefan Hajnoczi 提交于
      The raw_get_aio_fd() function allows virtio-blk-data-plane to get the
      file descriptor of a raw image file with Linux AIO enabled.  This
      interface is really a layering violation that can be resolved once the
      block layer is able to run outside the global mutex - at that point
      virtio-blk-data-plane will switch from custom Linux AIO code to using
      the block layer.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      4065742a
  17. 19 12月, 2012 3 次提交
  18. 11 12月, 2012 1 次提交
  19. 21 11月, 2012 1 次提交
  20. 31 10月, 2012 3 次提交
  21. 24 9月, 2012 6 次提交
  22. 15 8月, 2012 1 次提交