Received: from eggs.gnu.org ([2001:4830:134:3::10]:48571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO2gr-0003vw-PK for qemu-devel@nongnu.org; Wed, 18 Feb 2015 06:21:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YO2gn-0001pE-JW for qemu-devel@nongnu.org; Wed, 18 Feb 2015 06:21:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33009) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO2gn-0001p7-CW for qemu-devel@nongnu.org; Wed, 18 Feb 2015 06:21:09 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1IB1ZJo006193 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 18 Feb 2015 06:01:35 -0500 Date: Wed, 18 Feb 2015 12:01:33 +0100 From: Kevin Wolf Message-ID: <20150218110133.GA4996@noname.str.redhat.com> References: <1423600146-7642-1-git-send-email-mreitz@redhat.com> <1423600146-7642-15-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1423600146-7642-15-git-send-email-mreitz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v6 14/24] qcow2: Allow creation with refcount order != 4 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: qemu-devel@nongnu.org, Stefan Hajnoczi Am 10.02.2015 um 21:28 hat Max Reitz geschrieben: > Add a creation option to qcow2 for setting the refcount order of images > to be created, and respect that option's value. > > This breaks some test outputs, fix them. > > Signed-off-by: Max Reitz > Reviewed-by: Eric Blake > Reviewed-by: Stefan Hajnoczi > --- > block/qcow2.c | 20 +++++++++ > include/block/block_int.h | 1 + > tests/qemu-iotests/049.out | 108 ++++++++++++++++++++++----------------------- > tests/qemu-iotests/082.out | 41 ++++++++++++++--- > tests/qemu-iotests/085.out | 38 ++++++++-------- > 5 files changed, 128 insertions(+), 80 deletions(-) > > diff --git a/block/qcow2.c b/block/qcow2.c > index 65f7e91..99f6604 100644 > --- a/block/qcow2.c > +++ b/block/qcow2.c > @@ -2077,6 +2077,17 @@ static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp) > goto finish; > } > > + refcount_bits = qemu_opt_get_number_del(opts, BLOCK_OPT_REFCOUNT_BITS, > + refcount_bits); This truncates the uint64_t result to an int, so the code accepts inputs like refcount_bits=4294967297 (treating it as refcount_bits=1). > + if (refcount_bits <= 0 || refcount_bits > 64 || Should we have a constant MAX_REFCOUNT_ORDER that is shared between qcow2_open() and qcow2_create()? > + !is_power_of_2(refcount_bits)) > + { > + error_setg(errp, "Refcount width must be a power of two and may not " > + "exceed 64 bits"); > + ret = -EINVAL; > + goto finish; > + } > + Kevin