1. 05 12月, 2013 1 次提交
  2. 04 12月, 2013 1 次提交
  3. 29 11月, 2013 3 次提交
    • F
      blkdebug: add "remove_break" command · 4cc70e93
      Fam Zheng 提交于
      This adds "remove_break" command which is the reverse of blkdebug
      command "break": it removes all breakpoints with given tag and resumes
      all the requests.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      4cc70e93
    • L
      sheepdog: support user-defined redundancy option · b3af018f
      Liu Yuan 提交于
      Sheepdog support two kinds of redundancy, full replication and erasure coding.
      
      # create a fully replicated vdi with x copies
       -o redundancy=x (1 <= x <= SD_MAX_COPIES)
      
      # create a erasure coded vdi with x data strips and y parity strips
       -o redundancy=x:y (x must be one of {2,4,8,16} and 1 <= y < SD_EC_MAX_STRIP)
      
      E.g, to convert a vdi into sheepdog vdi 'test' with 8:3 erasure coding scheme
      
      $ qemu-img convert -o redundancy=8:3 linux-0.2.img sheepdog:test
      
      Cc: Kevin Wolf <kwolf@redhat.com>
      Cc: Stefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NLiu Yuan <namei.unix@gmail.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      b3af018f
    • F
      block: per caller dirty bitmap · e4654d2d
      Fam Zheng 提交于
      Previously a BlockDriverState has only one dirty bitmap, so only one
      caller (e.g. a block job) can keep track of writing. This changes the
      dirty bitmap to a list and creates a BdrvDirtyBitmap for each caller, the
      lifecycle is managed with these new functions:
      
          bdrv_create_dirty_bitmap
          bdrv_release_dirty_bitmap
      
      Where BdrvDirtyBitmap is a linked list wrapper structure of HBitmap.
      
      In place of bdrv_set_dirty_tracking, a BdrvDirtyBitmap pointer argument
      is added to these functions, since each caller has its own dirty bitmap:
      
          bdrv_get_dirty
          bdrv_dirty_iter_init
          bdrv_get_dirty_count
      
      bdrv_set_dirty and bdrv_reset_dirty prototypes are unchanged but will
      internally walk the list of all dirty bitmaps and set them one by one.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      e4654d2d
  4. 28 11月, 2013 2 次提交
  5. 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
  6. 11 10月, 2013 2 次提交
  7. 25 9月, 2013 1 次提交
  8. 12 9月, 2013 4 次提交
    • M
      bdrv: Use "Error" for creating images · d5124c00
      Max Reitz 提交于
      Add an Error ** parameter to BlockDriver.bdrv_create to allow more
      specific error messages.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      d5124c00
    • M
      bdrv: Use "Error" for opening images · 015a1036
      Max Reitz 提交于
      Add an Error ** parameter to BlockDriver.bdrv_open and
      BlockDriver.bdrv_file_open to allow more specific error messages.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      015a1036
    • W
      snapshot: distinguish id and name in snapshot delete · a89d89d3
      Wenchao Xia 提交于
      Snapshot creation actually already distinguish id and name since it take
      a structured parameter *sn, but delete can't. Later an accurate delete
      is needed in qmp_transaction abort and blockdev-snapshot-delete-sync,
      so change its prototype. Also *errp is added to tip error, but return
      value is kepted to let caller check what kind of error happens. Existing
      caller for it are savevm, delvm and qemu-img, they are not impacted by
      introducing a new function bdrv_snapshot_delete_by_id_or_name(), which
      check the return value and do the operation again.
      
      Before this patch:
        For qcow2, it search id first then name to find the one to delete.
        For rbd, it search name.
        For sheepdog, it does nothing.
      
      After this patch:
        For qcow2, logic is the same by call it twice in caller.
        For rbd, it always fails in delete with id, but still search for name
      in second try, no change to user.
      
      Some code for *errp is based on Pavel's patch.
      Signed-off-by: NWenchao Xia <xiawenc@linux.vnet.ibm.com>
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      a89d89d3
    • M
      block: Image file option amendment · 6f176b48
      Max Reitz 提交于
      This patch adds the "amend" option to qemu-img which allows changing
      image options on existing image files. It also adds the generic bdrv
      implementation which is basically just a wrapper for the image format
      specific function.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      6f176b48
  9. 06 9月, 2013 3 次提交
  10. 23 8月, 2013 1 次提交
  11. 22 8月, 2013 1 次提交
    • A
      block: Introduce bs->zero_beyond_eof · 0d51b4de
      Asias He 提交于
      In 4146b46c42e0989cb5842e04d88ab6ccb1713a48 (block: Produce zeros when
      protocols reading beyond end of file), we break qemu-iotests ./check
      -qcow2 022. This happens because qcow2 temporarily sets ->growable = 1
      for vmstate accesses (which are stored beyond the end of regular image
      data).
      
      We introduce the bs->zero_beyond_eof to allow qcow2_load_vmstate() to
      disable ->zero_beyond_eof temporarily in addition to enable ->growable.
      
      [Since the broken patch "block: Produce zeros when protocols reading
      beyond end of file" has not been merged yet, I have applied this fix
      *first* and will then apply the next patch to keep the tree bisectable.
      -- Stefan]
      Suggested-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NAsias He <asias@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      0d51b4de
  12. 27 7月, 2013 1 次提交
    • I
      Implement sync modes for drive-backup. · fc5d3f84
      Ian Main 提交于
      This patch adds sync-modes to the drive-backup interface and
      implements the FULL, NONE and TOP modes of synchronization.
      
      FULL performs as before copying the entire contents of the drive
      while preserving the point-in-time using CoW.
      NONE only copies new writes to the target drive.
      TOP copies changes to the topmost drive image and preserves the
      point-in-time using CoW.
      
      For sync mode TOP are creating a new target image using the same backing
      file as the original disk image.  Then any new data that has been laid
      on top of it since creation is copied in the main backup_run() loop.
      There is an extra check in the 'TOP' case so that we don't bother to copy
      all the data of the backing file as it already exists in the target.
      This is where the bdrv_co_is_allocated() is used to determine if the
      data exists in the topmost layer or below.
      
      Also any new data being written is intercepted via the write_notifier
      hook which ends up calling backup_do_cow() to copy old data out before
      it gets overwritten.
      
      For mode 'NONE' we create the new target image and only copy in the
      original data from the disk image starting from the time the call was
      made.  This preserves the point in time data by only copying the parts
      that are *going to change* to the target image.  This way we can
      reconstruct the final image by checking to see if the given block exists
      in the new target image first, and if it does not, you can get it from
      the original image.  This is basically an optimization allowing you to
      do point-in-time snapshots with low overhead vs the 'FULL' version.
      
      Since there is no old data to copy out the loop in backup_run() for the
      NONE case just calls qemu_coroutine_yield() which only wakes up after
      an event (usually cancel in this case).  The rest is handled by the
      before_write notifier which again calls backup_do_cow() to write out
      the old data so it can be preserved.
      Signed-off-by: NIan Main <imain@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      fc5d3f84
  13. 28 6月, 2013 2 次提交
    • D
      block: add basic backup support to block driver · 98d2c6f2
      Dietmar Maurer 提交于
      backup_start() creates a block job that copies a point-in-time snapshot
      of a block device to a target block device.
      
      We call backup_do_cow() for each write during backup. That function
      reads the original data from the block device before it gets
      overwritten.  The data is then written to the target device.
      
      Currently backup cluster size is hardcoded to 65536 bytes.
      
      [I made a number of changes to Dietmar's original patch and folded them
      in to make code review easy.  Here is the full list:
      
       * Drop BackupDumpFunc interface in favor of a target block device
       * Detect zero clusters with buffer_is_zero() and use bdrv_co_write_zeroes()
       * Use 0 delay instead of 1us, like other block jobs
       * Unify creation/start functions into backup_start()
       * Simplify cleanup, free bitmap in backup_run() instead of cb
       * function
       * Use HBitmap to avoid duplicating bitmap code
       * Use bdrv_getlength() instead of accessing ->total_sectors
       * directly
       * Delete the backup.h header file, it is no longer necessary
       * Move ./backup.c to block/backup.c
       * Remove #ifdefed out code
       * Coding style and whitespace cleanups
       * Use bdrv_add_before_write_notifier() instead of blockjob-specific hooks
       * Keep our own in-flight CowRequest list instead of using block.c
         tracked requests.  This means a little code duplication but is much
         simpler than trying to share the tracked requests list and use the
         backup block size.
       * Add on_source_error and on_target_error error handling.
       * Use trace events instead of DPRINTF()
      
      -- stefanha]
      Signed-off-by: NDietmar Maurer <dietmar@proxmox.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      98d2c6f2
    • S
      block: add bdrv_add_before_write_notifier() · d616b224
      Stefan Hajnoczi 提交于
      The bdrv_add_before_write_notifier() function installs a callback that
      is invoked before a write request is processed.  This will be used to
      implement copy-on-write point-in-time snapshots where we need to copy
      out old data before overwriting it.
      
      Note that BdrvTrackedRequest is moved to block_int.h since it is passed
      to .notify() functions.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      d616b224
  14. 04 6月, 2013 1 次提交
    • W
      block: move qmp and info dump related code to block/qapi.c · f364ec65
      Wenchao Xia 提交于
      This patch is a pure code move patch, except following modification:
      1 get_human_readable_size() is changed to static function.
      2 dump_human_image_info() is renamed to bdrv_image_info_dump().
      3 in qmp_query_block() and qmp_query_blockstats, use bdrv_next(bs)
      instead of direct traverse of global array 'bdrv_states'.
      4 collect_snapshots() and collect_image_info() are renamed, unused parameter
      *fmt in collect_image_info() is removed.
      5 code style fix.
      
      To avoid conflict and tip better, macro in header file is BLOCK_QAPI_H
      instead of QAPI_H. Now block.h and snapshot.h are at the same level in
      include path, block_int.h and qapi.h will both include them.
      Signed-off-by: NWenchao Xia <xiawenc@linux.vnet.ibm.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      f364ec65
  15. 22 4月, 2013 1 次提交
  16. 15 4月, 2013 1 次提交
  17. 06 4月, 2013 2 次提交
  18. 23 3月, 2013 3 次提交
    • K
      block: Allow omitting the file name when using driver-specific options · c2ad1b0c
      Kevin Wolf 提交于
      After this patch, using -drive with an empty file name continues to open
      the file if driver-specific options are used. If no driver-specific
      options are specified, the semantics stay as it was: It defines a drive
      without an inserted medium.
      
      In order to achieve this, bdrv_open() must be made safe to work with a
      NULL filename parameter. The assumption that is made is that only block
      drivers which implement bdrv_parse_filename() support using driver
      specific options and could therefore work without a filename. These
      drivers must make sure to cope with NULL in their implementation of
      .bdrv_open() (this is only NBD for now). For all other drivers, the
      block layer code will make sure to error out before calling into their
      code - they can't possibly work without a filename.
      
      Now an NBD connection can be opened like this:
      
        qemu-system-x86_64 -drive file.driver=nbd,file.port=1234,file.host=::1
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      c2ad1b0c
    • K
      block: Introduce .bdrv_parse_filename callback · 6963a30d
      Kevin Wolf 提交于
      If a driver needs structured data and not just a string, it can provide
      a .bdrv_parse_filename callback now that parses the command line string
      into separate options. Keeping this separate from .bdrv_open_filename
      ensures that the preferred way of directly specifying the options always
      works as well if parsing the string works.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      6963a30d
    • K
      block: Add options QDict to bdrv_file_open() prototypes · 787e4a85
      Kevin Wolf 提交于
      The new parameter is unused yet.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      787e4a85
  19. 15 3月, 2013 3 次提交
  20. 01 2月, 2013 1 次提交
  21. 26 1月, 2013 3 次提交
  22. 19 12月, 2012 2 次提交