1. 17 7月, 2017 1 次提交
  2. 11 7月, 2017 26 次提交
  3. 26 6月, 2017 3 次提交
  4. 29 5月, 2017 1 次提交
  5. 11 5月, 2017 4 次提交
    • E
      qcow2: Discard/zero clusters by byte count · d2cb36af
      Eric Blake 提交于
      Passing a byte offset, but sector count, when we ultimately
      want to operate on cluster granularity, is madness.  Clean up
      the external interfaces to take both offset and count as bytes,
      while still keeping the assertion added previously that the
      caller must align the values to a cluster.  Then rename things
      to make sure backports don't get confused by changed units:
      instead of qcow2_discard_clusters() and qcow2_zero_clusters(),
      we now have qcow2_cluster_discard() and qcow2_cluster_zeroize().
      
      The internal functions still operate on clusters at a time, and
      return an int for number of cleared clusters; but on an image
      with 2M clusters, a single L2 table holds 256k entries that each
      represent a 2M cluster, totalling well over INT_MAX bytes if we
      ever had a request for that many bytes at once.  All our callers
      currently limit themselves to 32-bit bytes (and therefore fewer
      clusters), but by making this function 64-bit clean, we have one
      less place to clean up if we later improve the block layer to
      support 64-bit bytes through all operations (with the block layer
      auto-fragmenting on behalf of more-limited drivers), rather than
      the current state where some interfaces are artificially limited
      to INT_MAX at a time.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20170507000552.20847-13-eblake@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      d2cb36af
    • E
      qcow2: Optimize write zero of unaligned tail cluster · fbaa6bb3
      Eric Blake 提交于
      We've already improved discards to operate efficiently on the tail
      of an unaligned qcow2 image; it's time to make a similar improvement
      to write zeroes.  The special case is only valid at the tail
      cluster of a file, where we must recognize that any sectors beyond
      the image end would implicitly read as zero, and therefore should
      not penalize our logic for widening a partial cluster into writing
      the whole cluster as zero.
      
      However, note that for now, the special case of end-of-file is only
      recognized if there is no backing file, or if the backing file has
      the same length; that's because when the backing file is shorter
      than the active layer, we don't have code in place to recognize
      that reads of a sector unallocated at the top and beyond the backing
      end-of-file are implicitly zero.  It's not much of a real loss,
      because most people don't use images that aren't cluster-aligned,
      or where the active layer is a different size than the backing
      layer (especially where the difference falls within a single cluster).
      
      Update test 154 to cover the new scenarios, using two images of
      intentionally differing length.
      
      While at it, fix the test to gracefully skip when run as
      ./check -qcow2 -o compat=0.10 154
      since the older format lacks zero clusters already required earlier
      in the test.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20170507000552.20847-11-eblake@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      fbaa6bb3
    • E
      qcow2: Make distinction between zero cluster types obvious · fdfab37d
      Eric Blake 提交于
      Treat plain zero clusters differently from allocated ones, so that
      we can simplify the logic of checking whether an offset is present.
      Do this by splitting QCOW2_CLUSTER_ZERO into two new enums,
      QCOW2_CLUSTER_ZERO_PLAIN and QCOW2_CLUSTER_ZERO_ALLOC.
      
      I tried to arrange the enum so that we could use
      'ret <= QCOW2_CLUSTER_ZERO_PLAIN' for all unallocated types, and
      'ret >= QCOW2_CLUSTER_ZERO_ALLOC' for allocated types, although
      I didn't actually end up taking advantage of the layout.
      
      In many cases, this leads to simpler code, by properly combining
      cases (sometimes, both zero types pair together, other times,
      plain zero is more like unallocated while allocated zero is more
      like normal).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-id: 20170507000552.20847-7-eblake@redhat.com
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      fdfab37d
    • M
      qcow2: Fix preallocation size formula · 92413c16
      Max Reitz 提交于
      When calculating the number of reftable entries, we should actually use
      the number of refblocks and not (wrongly[1]) re-calculate it.
      
      [1] "Wrongly" means: Dividing the number of clusters by the number of
          entries per refblock and rounding down instead of up.
      Reported-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      92413c16
  6. 09 5月, 2017 1 次提交
  7. 28 4月, 2017 4 次提交