1. 22 Jan, 2014 3 commits
  2. 13 Dec, 2013 1 commit
  3. 06 Dec, 2013 1 commit
    • Stefan Hajnoczi's avatar
      block: clean up bdrv_drain_all() throttling comments · 0b06ef3b
      Stefan Hajnoczi authored
      Since cc0681c4 ("block: Enable the new
      throttling code in the block layer.") bdrv_drain_all() no longer spins.
      The code used to look as follows:
      
        do {
            busy = qemu_aio_wait();
      
            /* FIXME: We do not have timer support here, so this is effectively
             * a busy wait.
             */
            QTAILQ_FOREACH(bs, &bdrv_states, list) {
                while (qemu_co_enter_next(&bs->throttled_reqs)) {
                    busy = true;
                }
            }
        } while (busy);
      
      Note that throttle requests are kicked but I/O throttling limits are
      still in effect.  The loop spins until the vm_clock time allows the
      request to make progress and complete.
      
      The new throttling code introduced bdrv_start_throttled_reqs().  This
      function not only kicks throttled requests but also temporarily disables
      throttling so requests can run.
      
      The outdated FIXME comment can be removed.  Also drop the busy = true
      assignment since we overwrite it immediately afterwards.
      Reviewed-by: default avatarAlex Bligh <alex@alex.org.uk>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      0b06ef3b
  4. 04 Dec, 2013 1 commit
    • Max Reitz's avatar
      block: Close backing file early in bdrv_img_create · 66f6b814
      Max Reitz authored
      Leaving the backing file open although it is not needed anymore can
      cause problems if it is opened through a block driver which allows
      exclusive access only and if the create function of the block driver
      used for the top image (the one being created) tries to close and reopen
      the image file (which will include opening the backing file a second
      time).
      
      In particular, this will happen with a backing file opened through
      qemu-nbd and using qcow2 as the top image file format (which reopens the
      image to flush it to disk).
      
      In addition, the BlockDriverState in bdrv_img_create() is used for the
      backing file only; it should therefore be made local to the respective
      block.
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
      Reviewed-by: default avatarWenchao Xia <xiawenc@linux.vnet.ibm.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      66f6b814
  5. 03 Dec, 2013 6 commits
  6. 29 Nov, 2013 5 commits
  7. 28 Nov, 2013 8 commits
  8. 15 Nov, 2013 1 commit
  9. 14 Nov, 2013 1 commit
    • Fam Zheng's avatar
      block: Print its file name if backing file opening failed · b04b6b6e
      Fam Zheng authored
      If backing file doesn't exist, the error message is confusing and
      misleading:
      
          $ qemu /tmp/a.qcow2
          qemu: could not open disk image /tmp/a.qcow2: Could not open file: No
          such file or directory
      
      But...
      
          $ ls /tmp/a.qcow2
          /tmp/a.qcow2
      
          $ qemu-img info /tmp/a.qcow2
          image: /tmp/a.qcow2
          file format: qcow2
          virtual size: 8.0G (8589934592 bytes)
          disk size: 196K
          cluster_size: 65536
          backing file: /tmp/b.qcow2
      
      Because...
      
          $ ls /tmp/b.qcow2
          ls: cannot access /tmp/b.qcow2: No such file or directory
      
      This is not intuitive. It's better to have the missing file's name in
      the error message. With this patch:
      
          $ qemu-io -c 'read 0 512' /tmp/a.qcow2
          qemu-io: can't open device /tmp/a.qcow2: Could not open backing
          file: Could not open '/stor/vm/arch.raw': No such file or directory
          no file open, try 'help open'
      
      Which is a little bit better.
      Signed-off-by: default avatarFam Zheng <famz@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      b04b6b6e
  10. 08 Nov, 2013 1 commit
  11. 07 Nov, 2013 1 commit
  12. 29 Oct, 2013 2 commits
    • Kevin Wolf's avatar
      block: Avoid unecessary drv->bdrv_getlength() calls · b94a2610
      Kevin Wolf authored
      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: default avatarKevin Wolf <kwolf@redhat.com>
      Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b94a2610
    • Thibaut LAURENT's avatar
      block: Disable BDRV_O_COPY_ON_READ for the backing file · 87a5debd
      Thibaut LAURENT authored
      Since commit 0ebd24e0,
      bdrv_open_common will throw an error when trying to open a file
      read-only with the BDRV_O_COPY_ON_READ flag set.
      Although BDRV_O_RDWR is unset for the backing files,
      BDRV_O_COPY_ON_READ is still passed on if copy-on-read was requested
      for the drive. Let's unset this flag too before opening the backing
      file, or bdrv_open_common will fail.
      Signed-off-by: default avatarThibaut LAURENT <thibaut.laurent@gmail.com>
      Reviewed-by: default avatarBenoit Canet <benoit@irqsave.net>
      Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      87a5debd
  13. 28 Oct, 2013 1 commit
  14. 11 Oct, 2013 5 commits
  15. 07 Oct, 2013 1 commit
  16. 02 Oct, 2013 1 commit
  17. 26 Sep, 2013 1 commit