1. 14 3月, 2016 2 次提交
  2. 01 3月, 2016 2 次提交
  3. 20 1月, 2016 1 次提交
  4. 16 10月, 2015 1 次提交
  5. 14 9月, 2015 1 次提交
  6. 11 9月, 2015 1 次提交
  7. 28 4月, 2015 2 次提交
  8. 24 1月, 2015 1 次提交
    • J
      block: vhdx - force FileOffsetMB field to '0' for certain block states · cdf9634b
      Jeff Cody 提交于
      The v1.0.0 spec calls out PAYLOAD_BLOCK_ZERO FileOffsetMB field as being
      'reserved'.  In practice, this means that Hyper-V will fail to read a
      disk image with PAYLOAD_BLOCK_ZERO block states with a FileOffsetMB
      value other than 0.
      
      The other states that indicate a block that is not there
      (PAYLOAD_BLOCK_UNDEFINED, PAYLOAD_BLOCK_NOT_PRESENT,
       PAYLOAD_BLOCK_UNMAPPED) have multiple options for what FileOffsetMB may
      be set to, and '0' is explicitly called out as an option.
      
      For all the above states, we will also just set the FileOffsetMB value
      to 0.
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: a9fe92f53f07e6ab1693811e4312c0d1e958500b.1421787566.git.jcody@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      cdf9634b
  9. 13 12月, 2014 1 次提交
  10. 12 12月, 2014 3 次提交
  11. 20 10月, 2014 1 次提交
  12. 22 9月, 2014 3 次提交
  13. 12 9月, 2014 1 次提交
  14. 20 8月, 2014 1 次提交
    • M
      block: Use g_new() & friends where that makes obvious sense · 5839e53b
      Markus Armbruster 提交于
      g_new(T, n) is neater than g_malloc(sizeof(T) * n).  It's also safer,
      for two reasons.  One, it catches multiplication overflowing size_t.
      Two, it returns T * rather than void *, which lets the compiler catch
      more type errors.
      
      Patch created with Coccinelle, with two manual changes on top:
      
      * Add const to bdrv_iterate_format() to keep the types straight
      
      * Convert the allocation in bdrv_drop_intermediate(), which Coccinelle
        inexplicably misses
      
      Coccinelle semantic patch:
      
          @@
          type T;
          @@
          -g_malloc(sizeof(T))
          +g_new(T, 1)
          @@
          type T;
          @@
          -g_try_malloc(sizeof(T))
          +g_try_new(T, 1)
          @@
          type T;
          @@
          -g_malloc0(sizeof(T))
          +g_new0(T, 1)
          @@
          type T;
          @@
          -g_try_malloc0(sizeof(T))
          +g_try_new0(T, 1)
          @@
          type T;
          expression n;
          @@
          -g_malloc(sizeof(T) * (n))
          +g_new(T, n)
          @@
          type T;
          expression n;
          @@
          -g_try_malloc(sizeof(T) * (n))
          +g_try_new(T, n)
          @@
          type T;
          expression n;
          @@
          -g_malloc0(sizeof(T) * (n))
          +g_new0(T, n)
          @@
          type T;
          expression n;
          @@
          -g_try_malloc0(sizeof(T) * (n))
          +g_try_new0(T, n)
          @@
          type T;
          expression p, n;
          @@
          -g_realloc(p, sizeof(T) * (n))
          +g_renew(T, p, n)
          @@
          type T;
          expression p, n;
          @@
          -g_try_realloc(p, sizeof(T) * (n))
          +g_try_renew(T, p, n)
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      5839e53b
  15. 15 8月, 2014 2 次提交
  16. 16 6月, 2014 3 次提交
  17. 19 5月, 2014 1 次提交
    • J
      block: vhdx - account for identical header sections · 69060461
      Jeff Cody 提交于
      The VHDX spec v1.00 declares that "a header is current if it is the only
      valid header or if it is valid and its SequenceNumber field is greater
      than the other header’s SequenceNumber field. The parser must only use
      data from the current header. If there is no current header, then the
      VHDX file is corrupt."
      
      However, the Disk2VHD tool from Microsoft creates a VHDX image file that
      has 2 identical headers, including matching checksums and matching
      sequence numbers.  Likely, as a shortcut the tool is just writing the
      header twice, for the active and inactive headers, during the image
      creation.  Technically, this should be considered a corrupt VHDX file
      (at least per the 1.00 spec, and that is how we currently treat it).
      
      But in order to accomodate images created with Disk2VHD, we can safely
      create an exception for this case.  If we find identical sequence
      numbers, then we check the VHDXHeader-sized chunks of each 64KB header
      sections (we won't rely just on the crc32c to indicate the headers are
      the same).  If they are identical, then we go ahead and use the first
      one.
      Reported-by: NNerijus Baliūnas <nerijus@users.sourceforge.net>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      69060461
  18. 01 4月, 2014 1 次提交
  19. 22 2月, 2014 2 次提交
  20. 01 2月, 2014 1 次提交
  21. 22 1月, 2014 1 次提交
  22. 20 12月, 2013 1 次提交
    • J
      block: vhdx - improve error message, and .bdrv_check implementation · 7e30e6a6
      Jeff Cody 提交于
      If there is a dirty log file to be replayed in a VHDX image, it is
      replayed in .vhdx_open().  However, if the file is opened read-only,
      then a somewhat cryptic error message results.
      
      This adds a more helpful error message for the user.  If an image file
      contains a log to be replayed, and is opened read-only, the user is
      instructed to run 'qemu-img check -r all' on the image file.
      
      Running qemu-img check -r all will cause the image file to be opened
      r/w, which will replay the log file.  If a log file replay is detected,
      this is flagged, and bdrv_check will increase the corruptions_fixed
      count for the image.
      
      [Fixed typo in error message that was pointed out by Eric Blake
      <eblake@redhat.com>.
      --Stefan]
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      7e30e6a6
  23. 03 12月, 2013 2 次提交
  24. 07 11月, 2013 5 次提交
    • J
      block: vhdx - add .bdrv_create() support · 3412f7b1
      Jeff Cody 提交于
      This adds support for VHDX image creation, for images of type "Fixed"
      and "Dynamic".  "Differencing" types (i.e., VHDX images with backing
      files) are currently not supported.
      
      Options for image creation include:
          * log size:
              The size of the journaling log for VHDX.  Minimum is 1MB,
              and it must be a multiple of 1MB. Invalid log sizes will be
              silently fixed by rounding up to the nearest MB.
      
              Default is 1MB.
      
          * block size:
              This is the size of a payload block.  The range is 1MB to 256MB,
              inclusive, and must be a multiple of 1MB as well.  Invalid sizes
              and multiples will be silently fixed.  If '0' is passed, then
              a sane size is chosen (depending on virtual image size).
      
              Default is 0 (Auto-select).
      
          * subformat:
              - "dynamic"
                  An image without data pre-allocated.
              - "fixed"
                  An image with data pre-allocated.
      
              Default is "dynamic"
      
      When creating the image file, the lettered sections are created:
      
      -----------------------------------------------------------------.
      |   (A)    |   (B)    |    (C)    |     (D)       |     (E)
      |  File ID |  Header1 |  Header 2 |  Region Tbl 1 |  Region Tbl 2
      |          |          |           |               |
      .-----------------------------------------------------------------.
      0         64KB      128KB       192KB           256KB          320KB
      
      .---- ~ ----------- ~ ------------ ~ ---------------- ~ -----------.
      |     (F)     |     (G)       |    (H)    |
      | Journal Log |  BAT / Bitmap |  Metadata |  .... data ......
      |             |               |           |
      .---- ~ ----------- ~ ------------ ~ ---------------- ~ -----------.
      1MB         (var.)          (var.)      (var.)
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      3412f7b1
    • J
      block: vhdx - break out code operations to functions · 1e74a971
      Jeff Cody 提交于
      This is preperation for vhdx_create().  The ability to write headers,
      and calculate the number of BAT entries will be needed within the
      create() functions, so move this relevant code into helper functions.
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      1e74a971
    • J
      block: vhdx - move more endian translations to vhdx-endian.c · c325ee1d
      Jeff Cody 提交于
      In preparation for vhdx_create(), move more endian translation
      functions out to vhdx-endian.c.
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      c325ee1d
    • J
      block: vhdx - remove BAT file offset bit shifting · 0b7da092
      Jeff Cody 提交于
      Bit shifting can be fun, but in this case it was unnecessary.  The
      upper 44 bits of the 64-bit BAT entry is specifies the File Offset,
      so we shifted the bits to get access to the value.
      
      However, per the spec the value is in MB.  So we dutifully shifted back
      to the left by 20 bits, to convert to a true uint64_t file offset.
      
      This replaces those steps with just a bit mask, to get rid of the lower
      20 bits instead.
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      0b7da092
    • J
      block: vhdx write support · d92aa883
      Jeff Cody 提交于
      This adds support for writing to VHDX image files, using coroutines.
      Writes into the BAT table goes through the VHDX log.  Currently, BAT
      table writes occur when expanding a dynamic VHDX file, and allocating a
      new BAT entry.
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      d92aa883