Skip to content
Snippets Groups Projects
  1. May 03, 2010
    • Kevin Wolf's avatar
      block: Add wr_highest_sector blockstat · 294cc35f
      Kevin Wolf authored
      
      This adds the wr_highest_sector blockstat which implements what is generally
      known as the high watermark. It is the highest offset of a sector written to
      the respective BlockDriverState since it has been opened.
      
      The query-blockstat QMP command is extended to add this value to the result,
      and also to add the statistics of the underlying protocol in a new "parent"
      field. Note that to get the "high watermark" of a qcow2 image, you need to look
      into the wr_highest_sector field of the parent (which can be a file, a
      host_device, ...). The wr_highest_sector of the qcow2 BlockDriverState itself
      is the highest offset on the _virtual_ disk that the guest has written to.
      
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      294cc35f
    • Kevin Wolf's avatar
      block: Open the underlying image file in generic code · 66f82cee
      Kevin Wolf authored
      
      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: default avatarKevin Wolf <kwolf@redhat.com>
      66f82cee
  2. Apr 23, 2010
  3. Mar 17, 2010
    • Christoph Hellwig's avatar
      block: add logical_block_size property · 8cfacf07
      Christoph Hellwig authored
      
      Add a logical block size attribute as various guest side tools only
      increase the filesystem sector size based on it, not the advisory
      physical block size.
      
      For scsi we already have support for a different logical block size
      in place for CDROMs that we can built upon.  Only my recent block
      device characteristics VPD page needs some fixups.  Note that we
      leave the logial block size for CDROMs hardcoded as the 2k value
      is expected for it in general.
      
      For virtio-blk we already have a feature flag claiming to support
      a variable logical block size that was added for the s390 kuli
      hypervisor.  Interestingly it does not actually change the units
      in which the protocol works, which is still fixed at 512 bytes,
      but only communicates a different minimum I/O granularity.  So
      all we need to do in virtio is to add a trap for unaligned I/O
      and round down the device size to the next multiple of the logical
      block size.
      
      IDE does not support any other logical block size than 512 bytes.
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
      8cfacf07
  4. Feb 19, 2010
  5. Feb 10, 2010
    • Christoph Hellwig's avatar
      block: add topology qdev properties · 428c149b
      Christoph Hellwig authored
      
      Add three new qdev properties to export block topology information to
      the guest.  This is needed to get optimal I/O alignment for RAID arrays
      or SSDs.
      
      The options are:
      
       - physical_block_size to specify the physical block size of the device,
         this is going to increase from 512 bytes to 4096 kilobytes for many
         modern storage devices
       - min_io_size to specify the minimal I/O size without performance impact,
         this is typically set to the RAID chunk size for arrays.
       - opt_io_size to specify the optimal sustained I/O size, this is
         typically the RAID stripe width for arrays.
      
      I decided to not auto-probe these values from blkid which might easily
      be possible as I don't know how to deal with these issues on migration.
      
      Note that we specificly only set the physical_block_size, and not the
      logial one which is the unit all I/O is described in.  The reason for
      that is that IDE does not support increasing the logical block size and
      at last for now I want to stick to one meachnisms in queue and allow
      for easy switching of transports for a given backing image which would
      not be possible if scsi and virtio use real 4k sectors, while ide only
      uses the physical block exponent.
      
      To make this more common for the different block drivers introduce a
      new BlockConf structure holding all common block properties and a
      DEFINE_BLOCK_PROPERTIES macro to add them all together, mirroring
      what is done for network drivers.  Also switch over all block drivers
      to use it, except for the floppy driver which has weird driveA/driveB
      properties and probably won't require any advanced block options ever.
      
      Example usage for a virtio device with 4k physical block size and
      8k optimal I/O size:
      
        -drive file=scratch.img,media=disk,cache=none,id=scratch \
        -device virtio-blk-pci,drive=scratch,physical_block_size=4096,opt_io_size=8192
      
      aliguori: updated patch to take into account BLOCK events
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
      428c149b
  6. Feb 09, 2010
  7. Jan 13, 2010
  8. Dec 03, 2009
  9. Nov 17, 2009
    • Liran Schour's avatar
      Expose a mechanism to trace block writes · 7cd1e32a
      Liran Schour authored
      
      To support live migration without shared storage we need to be able to trace
      writes to disk while migrating. This Patch expose dirty block tracking per
      device to be polled from upper layer.
      
      Changes from v4:
      - Register dirty tracking for each block device.
      - Minor coding style issues.
      - Block.c will now manage a dirty bitmap per device once
        bdrv_set_dirty_tracking() is called. Bitmap is polled by the upper
        layer (block-migration.c).
      
      Signed-off-by: default avatarLiran Schour <lirans@il.ibm.com>
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
      7cd1e32a
  10. Sep 11, 2009
    • Christoph Hellwig's avatar
      block: add aio_flush operation · b2e12bc6
      Christoph Hellwig authored
      
      Instead stalling the VCPU while serving a cache flush try to do it
      asynchronously.  Use our good old helper thread pool to issue an
      asynchronous fdatasync for raw-posix.  Note that while Linux AIO
      implements a fdatasync operation it is not useful for us because
      it isn't actually implement in asynchronous fashion.
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
      b2e12bc6
    • Christoph Hellwig's avatar
      block: add enable_write_cache flag · e900a7b7
      Christoph Hellwig authored
      
      Add a enable_write_cache flag in the block driver state, and use it to
      decide if we claim to have a volatile write cache that needs controlled
      flushing from the guest.  The flag is off if cache=writethrough is
      defined because O_DSYNC guarantees that every write goes to stable
      storage, and it is on for cache=none and cache=writeback.
      
      Both scsi-disk and ide now use the new flage, changing from their
      defaults of always off (ide) or always on (scsi-disk).
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
      e900a7b7
    • Kevin Wolf's avatar
      Add bdrv_aio_multiwrite · 40b4f539
      Kevin Wolf authored
      
      One performance problem of qcow2 during the initial image growth are
      sequential writes that are not cluster aligned. In this case, when a first
      requests requires to allocate a new cluster but writes only to the first
      couple of sectors in that cluster, the rest of the cluster is zeroed - just
      to be overwritten by the following second request that fills up the cluster.
      
      Let's try to merge sequential write requests to the same cluster, so we can
      avoid to write the zero padding to the disk in the first place.
      
      As a nice side effect, also other formats take advantage of dealing with less
      and larger requests.
      
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
      40b4f539
  11. Aug 28, 2009
    • Kevin Wolf's avatar
      qcow2: Metadata preallocation · a35e1c17
      Kevin Wolf authored
      
      This introduces a qemu-img create option for qcow2 which allows the metadata to
      be preallocated, i.e. clusters are reserved in the refcount table and L1/L2
      tables, but no data is written to them. Metadata is quite small, so this
      happens in almost no time.
      
      Especially with qcow2 on virtio this helps to gain a bit of performance during
      the initial writes. However, as soon as create a snapshot, we're back to the
      normal slow speed, obviously. So this isn't the real fix, but kind of a cheat
      while we're still having trouble with qcow2 on virtio.
      
      Note that the option is disabled by default and needs to be specified
      explicitly using qemu-img create -f qcow2 -o preallocation=metadata.
      
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
      a35e1c17
  12. Jul 16, 2009
  13. Jun 15, 2009
    • Christoph Hellwig's avatar
      block: add bdrv_probe_device method · 508c7cb3
      Christoph Hellwig authored
      
      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: default avatarChristoph Hellwig <hch@lst.de>
      508c7cb3
  14. May 27, 2009
  15. May 22, 2009
  16. Apr 22, 2009
    • Anthony Liguori's avatar
      implement qemu_blockalign (Stefano Stabellini) · e268ca52
      Anthony Liguori authored
      
      this patch adds a buffer_alignment field to BlockDriverState and
      implements a qemu_blockalign function that uses that field to allocate a
      memory aligned buffer to be used by the block driver.
      buffer_alignment is initialized to 512 but each block driver can set
      a different value (at the moment none of them do).
      This patch modifies ide.c, block-qcow.c, block-qcow2.c and block.c to
      use qemu_blockalign instead of qemu_memalign.
      There is only one place left that still uses qemu_memalign to allocate
      buffers used by block drivers that is posix-aio-compat:handle_aiocb_rw
      because it is not possible to get the BlockDriverState from that
      function. However I think it is not important because posix-aio-compat
      already deals with driver specific code so it is supposed to know its
      own needs.
      
      Signed-off-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
      
      
      git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7229 c046a42c-6fe2-441c-8c8c-71466251a162
      e268ca52
  17. Apr 21, 2009
  18. Apr 07, 2009
  19. Apr 05, 2009
  20. Mar 28, 2009
  21. Mar 20, 2009
  22. Mar 12, 2009
  23. Mar 05, 2009
  24. Mar 03, 2009
    • Anthony Liguori's avatar
      Fix CVE-2008-0928 - insufficient block device address range checking (Anthony Liguori) · 71d0770c
      Anthony Liguori authored
      
      Introduce a growable flag that's set by bdrv_file_open().  Block devices should
      never be growable, only files that are being used by block devices.
      
      I went through Fabrice's early comments about the patch that was first applied.
      While I disagree with that patch, I also disagree with Fabrice's suggestion.
      
      There's no good reason to do the checks in the block drivers themselves.  It
      just increases the possibility that this bug could show up again.  Since we're
      calling bdrv_getlength() to determine the length, we're giving the block drivers
      a chance to chime in and let us know what range is valid.
      
      Basically, this patch makes the BlockDriver API guarantee that all requests are
      within 0..bdrv_getlength() which to me seems like a Good Thing.
      
      What do others think?
      
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
      
      
      git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6677 c046a42c-6fe2-441c-8c8c-71466251a162
      71d0770c
  25. Feb 11, 2009
  26. Nov 08, 2008
  27. Sep 17, 2008
  28. Mar 11, 2008
  29. Dec 24, 2007
Loading