qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH v5 00/26] qcow2: Support refcount orders != 4
Date: Mon, 15 Dec 2014 13:50:31 +0100	[thread overview]
Message-ID: <1418647857-3589-1-git-send-email-mreitz@redhat.com> (raw)

As of version 3, the qcow2 file format supports different widths for
refcount entries, ranging from 1 to 64 bit (only powers of two).
Currently, qemu only supports 16 bit, which is the only width supported
by version 2 (compat=0.10) images.

This series adds support to qemu for all other valid refcount orders.
This is mainly done by adding two function pointers into the
BDRVQcowState structure for reading and writing refcount values
independently of the current refcount entry width; all in-memory
refcount arrays (mostly cached refcount blocks) now are void pointers
and are accessed through these functions alone.

Thanks to previous work of making the qemu code agnostic of e.g. the
number of refcount entries per refcount block, the rest is fairly
trivial. The most complex patch in this series is patch 23 which
implements changing the refcount order through qemu-img amend.

To test different refcount widths, simply invoke the qemu-iotests check
program with -o refcount_width=${your_desired_width}. The final test in
this series adds some tests for operations which do not work with
certain refcount orders and for refcount order amendment.


v5:
- Patch 5: Use absolute value for addend instead of the two's complement
  for negative values [Stefan]
- Patch 6:
  - Conflicts due to the changes in patch 5
  - Dropped the "if (ret >= 0)" -> "if (ret == 0)" hunk; since the
    update_refcount() return value was never touched in this series
    there is no point in modifying the callers' checks for their return
    value [Eric]
- Patch 9: Use DIV_ROUND_UP() [Eric]
- Patch 16: Rebase conflicts due to Fam's patch removing trailing
  whitespace in all qemu-iotests/*.out files
  (7486458c33cd3e5714368f181a5fea39c54444ca); I kept the R-bs because
  these are only trailing whitespace conflicts in *.out files which are
  really trivial.
  There are two not-so-trivial conflicts: Two hunks are missing from v5
  which were part of v4 which did nothing but remove trailing
  whitespace. Obviously those are no longer necessary, so removing these
  hunks was actually trivial after all.


git-backport-diff against v4:

Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch
[down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/26:[----] [--] 'qcow2: Add two new fields to BDRVQcowState'
002/26:[----] [--] 'qcow2: Add refcount_bits to format-specific info'
003/26:[----] [--] 'qcow2: Do not return new value after refcount update'
004/26:[----] [--] 'qcow2: Only return status from qcow2_get_refcount'
005/26:[0040] [FC] 'qcow2: Use unsigned addend for update_refcount()'
006/26:[0028] [FC] 'qcow2: Use 64 bits for refcount values'
007/26:[----] [--] 'qcow2: Respect error in qcow2_alloc_bytes()'
008/26:[----] [--] 'qcow2: Refcount overflow and qcow2_alloc_bytes()'
009/26:[0002] [FC] 'qcow2: Helper for refcount array reallocation'
010/26:[----] [-C] 'qcow2: Helper function for refcount modification'
011/26:[----] [--] 'qcow2: More helpers for refcount modification'
012/26:[----] [--] 'qcow2: Open images with refcount order != 4'
013/26:[----] [--] 'qcow2: refcount_order parameter for qcow2_create2'
014/26:[----] [--] 'qcow2: Use symbolic macros in qcow2_amend_options'
015/26:[----] [--] 'iotests: Prepare for refcount_bits option'
016/26:[0126] [FC] 'qcow2: Allow creation with refcount order != 4'
017/26:[----] [--] 'progress: Allow regressing progress'
018/26:[----] [--] 'block: Add opaque value to the amend CB'
019/26:[----] [-C] 'qcow2: Use error_report() in qcow2_amend_options()'
020/26:[----] [--] 'qcow2: Use abort() instead of assert(false)'
021/26:[----] [--] 'qcow2: Split upgrade/downgrade paths for amend'
022/26:[----] [--] 'qcow2: Use intermediate helper CB for amend'
023/26:[----] [--] 'qcow2: Add function for refcount order amendment'
024/26:[----] [--] 'qcow2: Invoke refcount order amendment function'
025/26:[----] [--] 'qcow2: Point to amend function in check'
026/26:[----] [--] 'iotests: Add test for different refcount widths'


Max Reitz (26):
  qcow2: Add two new fields to BDRVQcowState
  qcow2: Add refcount_bits to format-specific info
  qcow2: Do not return new value after refcount update
  qcow2: Only return status from qcow2_get_refcount
  qcow2: Use unsigned addend for update_refcount()
  qcow2: Use 64 bits for refcount values
  qcow2: Respect error in qcow2_alloc_bytes()
  qcow2: Refcount overflow and qcow2_alloc_bytes()
  qcow2: Helper for refcount array reallocation
  qcow2: Helper function for refcount modification
  qcow2: More helpers for refcount modification
  qcow2: Open images with refcount order != 4
  qcow2: refcount_order parameter for qcow2_create2
  qcow2: Use symbolic macros in qcow2_amend_options
  iotests: Prepare for refcount_bits option
  qcow2: Allow creation with refcount order != 4
  progress: Allow regressing progress
  block: Add opaque value to the amend CB
  qcow2: Use error_report() in qcow2_amend_options()
  qcow2: Use abort() instead of assert(false)
  qcow2: Split upgrade/downgrade paths for amend
  qcow2: Use intermediate helper CB for amend
  qcow2: Add function for refcount order amendment
  qcow2: Invoke refcount order amendment function
  qcow2: Point to amend function in check
  iotests: Add test for different refcount widths

 block.c                          |    4 +-
 block/qcow2-cluster.c            |   24 +-
 block/qcow2-refcount.c           | 1054 +++++++++++++++++++++++++++++++-------
 block/qcow2.c                    |  286 ++++++++---
 block/qcow2.h                    |   23 +-
 include/block/block.h            |    4 +-
 include/block/block_int.h        |    4 +-
 qapi/block-core.json             |    5 +-
 qemu-img.c                       |    5 +-
 tests/qemu-iotests/007           |    3 +
 tests/qemu-iotests/015           |    2 +
 tests/qemu-iotests/026           |    7 +
 tests/qemu-iotests/029           |    2 +
 tests/qemu-iotests/049.out       |  108 ++--
 tests/qemu-iotests/051           |    3 +
 tests/qemu-iotests/058           |    2 +
 tests/qemu-iotests/060.out       |    1 +
 tests/qemu-iotests/061.out       |   14 +-
 tests/qemu-iotests/065           |   23 +-
 tests/qemu-iotests/067           |    2 +
 tests/qemu-iotests/067.out       |    5 +
 tests/qemu-iotests/079           |   10 +-
 tests/qemu-iotests/079.out       |   38 +-
 tests/qemu-iotests/080           |    2 +
 tests/qemu-iotests/082.out       |   48 +-
 tests/qemu-iotests/085.out       |   38 +-
 tests/qemu-iotests/089           |    2 +
 tests/qemu-iotests/089.out       |    2 +
 tests/qemu-iotests/108           |    2 +
 tests/qemu-iotests/112           |  296 +++++++++++
 tests/qemu-iotests/112.out       |  155 ++++++
 tests/qemu-iotests/common.filter |    3 +-
 tests/qemu-iotests/group         |    1 +
 util/qemu-progress.c             |    3 +-
 34 files changed, 1782 insertions(+), 399 deletions(-)
 create mode 100755 tests/qemu-iotests/112
 create mode 100644 tests/qemu-iotests/112.out

-- 
1.9.3

             reply	other threads:[~2014-12-15 12:51 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-15 12:50 Max Reitz [this message]
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 01/26] qcow2: Add two new fields to BDRVQcowState Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 02/26] qcow2: Add refcount_bits to format-specific info Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 03/26] qcow2: Do not return new value after refcount update Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 04/26] qcow2: Only return status from qcow2_get_refcount Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 05/26] qcow2: Use unsigned addend for update_refcount() Max Reitz
2015-01-22 15:33   ` Eric Blake
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 06/26] qcow2: Use 64 bits for refcount values Max Reitz
2015-01-22 15:35   ` Eric Blake
2015-02-03 19:26   ` Kevin Wolf
2015-02-03 19:48     ` Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 07/26] qcow2: Respect error in qcow2_alloc_bytes() Max Reitz
2015-02-04 11:40   ` Kevin Wolf
2015-02-04 15:04     ` Max Reitz
2015-02-04 15:12       ` Kevin Wolf
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 08/26] qcow2: Refcount overflow and qcow2_alloc_bytes() Max Reitz
2015-02-04 11:55   ` Kevin Wolf
2015-02-04 15:33     ` Max Reitz
2015-02-04 16:10       ` Kevin Wolf
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 09/26] qcow2: Helper for refcount array reallocation Max Reitz
2015-02-04 13:21   ` Kevin Wolf
2015-02-04 15:57     ` Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 10/26] qcow2: Helper function for refcount modification Max Reitz
2015-02-04 16:06   ` Kevin Wolf
2015-02-04 17:12     ` Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 11/26] qcow2: More helpers " Max Reitz
2015-02-04 13:53   ` Kevin Wolf
2015-02-04 15:59     ` Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 12/26] qcow2: Open images with refcount order != 4 Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 13/26] qcow2: refcount_order parameter for qcow2_create2 Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 14/26] qcow2: Use symbolic macros in qcow2_amend_options Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 15/26] iotests: Prepare for refcount_bits option Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 16/26] qcow2: Allow creation with refcount order != 4 Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 17/26] progress: Allow regressing progress Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 18/26] block: Add opaque value to the amend CB Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 19/26] qcow2: Use error_report() in qcow2_amend_options() Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 20/26] qcow2: Use abort() instead of assert(false) Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 21/26] qcow2: Split upgrade/downgrade paths for amend Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 22/26] qcow2: Use intermediate helper CB " Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 23/26] qcow2: Add function for refcount order amendment Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 24/26] qcow2: Invoke refcount order amendment function Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 25/26] qcow2: Point to amend function in check Max Reitz
2014-12-15 12:50 ` [Qemu-devel] [PATCH v5 26/26] iotests: Add test for different refcount widths Max Reitz
2015-01-20 22:48 ` [Qemu-devel] [PATCH v5 00/26] qcow2: Support refcount orders != 4 Max Reitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1418647857-3589-1-git-send-email-mreitz@redhat.com \
    --to=mreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).