Received: from eggs.gnu.org ([2001:4830:134:3::10]:56411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7UAH-0005jk-Mv for qemu-devel@nongnu.org; Thu, 17 Nov 2016 16:24:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c7UAG-0004e4-Qh for qemu-devel@nongnu.org; Thu, 17 Nov 2016 16:24:13 -0500 References: <1479413642-22463-1-git-send-email-eblake@redhat.com> <1479413642-22463-3-git-send-email-eblake@redhat.com> From: Max Reitz Message-ID: <9d283f1b-b050-f7b3-2bd1-fff07e5d5bdd@redhat.com> Date: Thu, 17 Nov 2016 22:24:03 +0100 MIME-Version: 1.0 In-Reply-To: <1479413642-22463-3-git-send-email-eblake@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="1JO8EM1xRmicFOsUDT20CblcAoAx0p84a" Subject: Re: [Qemu-devel] [PATCH v2 2/9] qcow2: Inform block layer about discard boundaries List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, kwolf@redhat.com, pbonzini@redhat.com, qemu-stable@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1JO8EM1xRmicFOsUDT20CblcAoAx0p84a From: Max Reitz To: Eric Blake , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, kwolf@redhat.com, pbonzini@redhat.com, qemu-stable@nongnu.org Message-ID: <9d283f1b-b050-f7b3-2bd1-fff07e5d5bdd@redhat.com> Subject: Re: [PATCH v2 2/9] qcow2: Inform block layer about discard boundaries References: <1479413642-22463-1-git-send-email-eblake@redhat.com> <1479413642-22463-3-git-send-email-eblake@redhat.com> In-Reply-To: <1479413642-22463-3-git-send-email-eblake@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 17.11.2016 21:13, Eric Blake wrote: > At the qcow2 layer, discard is only possible on a per-cluster > basis; at the moment, qcow2 silently rounds any unaligned > requests to this granularity. However, an upcoming patch will > fix a regression in the block layer ignoring too much of an > unaligned discard request, by changing the block layer to > break up a discard request at alignment boundaries; for that > to work, the block layer must know about our limits. >=20 > However, we can't go one step further by changing > qcow2_discard_clusters() to assert that requests are always > aligned, since that helper function is reached on paths > outside of the block layer. Also, to do that, we'd have to establish that pdiscard_alignment is a mandatory alignment. Currently, it's described as the "best alignment", which doesn't sound too mandatory to me (although the block layer apparently always does drop unaligned parts). > CC: qemu-stable@nongnu.org > Signed-off-by: Eric Blake > --- > block/qcow2.c | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/block/qcow2.c b/block/qcow2.c > index 6d5689a..e22f6dc 100644 > --- a/block/qcow2.c > +++ b/block/qcow2.c > @@ -1206,6 +1206,7 @@ static void qcow2_refresh_limits(BlockDriverState= *bs, Error **errp) > bs->bl.request_alignment =3D BDRV_SECTOR_SIZE; > } > bs->bl.pwrite_zeroes_alignment =3D s->cluster_size; > + bs->bl.pdiscard_alignment =3D s->cluster_size; > } >=20 > static int qcow2_set_key(BlockDriverState *bs, const char *key) Reviewed-by: Max Reitz --1JO8EM1xRmicFOsUDT20CblcAoAx0p84a Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEvBAEBCAAZBQJYLh/zEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRD0B9sAYdXPQHkx B/9pvezmxB44GSKu96VK7sWjXJUi+s+xG0u+Mz//1drJiG1UnuhLf6ni0XnYSp3b XL9Mi+M/1iV72E6m2oeQIDalOqBv4jRGlqNXc/zU226Pp2h2LxtMdxN2CQ/XLjl0 7HphlxULVnVZpSYLqTl6PThqXMIZiN6iyRxBsktt/GXvhGHINYwO0ZuXsQe+Zct+ TkQrdezMeZWHAKJPccZbqR6ryYasqBtehk7LCzDfisweWpZoV8YdybolQTeTf2pu kL+RlbITmzDMFJQVrKXx9VuitP73SIUcB+TVQHX8zKteq1qWdCNMfR5rKmzoeKH2 W+KIivLFu4u9VnPLFP2+fgTK =4Zvz -----END PGP SIGNATURE----- --1JO8EM1xRmicFOsUDT20CblcAoAx0p84a--