From nobody Sat May 4 19:56:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572858485; cv=none; d=zoho.com; s=zohoarc; b=gZJnRehttrUzOIj/vjU3Xlzeje36iG2tzQvNxWVAwgGjSdm0ijK4zJ2LktxETFypIbFwG7lE2lmhKlzzhQWs5PvS1xBnLcgBwZXktFZwk51/+YOOBAikf+4oEhhcXBfTDILGwWLNbG0ahLeaKHeyViCfDjaPGuN4GQffMXLhiME= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572858485; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hsInyKxAekr/73cu9ypbm4mQK5co9xxqt+ZM3Emg74g=; b=AONq2EQ0SICRTIWkd3koVwKQ9l/OJVLD8agEu1zhEEcoPmyT+8oxIMFuKahWj0meythW1sHnVcro2sdeGg7C/MDAKRhf7C3Sd99+w3iLyU8XNiK/BrDTGygNqTHssIF7gYFifVUzdZCX4o+OR8VWmfaiMMKPQIvWoRFKugpDMJ4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572858485769478.30970526853037; Mon, 4 Nov 2019 01:08:05 -0800 (PST) Received: from localhost ([::1]:58644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRYLC-0004Ei-BJ for importer@patchew.org; Mon, 04 Nov 2019 04:08:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34736) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRYHJ-0007MT-Px for qemu-devel@nongnu.org; Mon, 04 Nov 2019 04:04:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iRYHF-0002y6-AE for qemu-devel@nongnu.org; Mon, 04 Nov 2019 04:04:01 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:25338 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iRYHD-0002uu-Dc for qemu-devel@nongnu.org; Mon, 04 Nov 2019 04:03:55 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-176-wC-yCm-TMY-w6f8cdh27DA-1; Mon, 04 Nov 2019 04:03:52 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5A9278017E0; Mon, 4 Nov 2019 09:03:51 +0000 (UTC) Received: from localhost (ovpn-117-85.ams2.redhat.com [10.36.117.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F160A60BF1; Mon, 4 Nov 2019 09:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572858233; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hsInyKxAekr/73cu9ypbm4mQK5co9xxqt+ZM3Emg74g=; b=Qj+9rnRjuZhZeSTHJ1KTvmEn3anWjE0vMvR51uyVGg2oi3Kwr/Wx1/qBnlUYU6jBtTK7XG UCCcDHCcsz88jJUqsKVzNFh3/wrBeeJsmKi+3hArgz5csFXXTXiL1oZzRN1bomDwbxjQgL Gp+G/TMT12OqKaQs3pxJNNh8/lZ1qik= From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 1/5] nvme: fix NSSRS offset in CAP register Date: Mon, 4 Nov 2019 10:03:43 +0100 Message-Id: <20191104090347.27278-2-mreitz@redhat.com> In-Reply-To: <20191104090347.27278-1-mreitz@redhat.com> References: <20191104090347.27278-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: wC-yCm-TMY-w6f8cdh27DA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Klaus Jensen Fix the offset of the NSSRS field the CAP register. From NVME 1.4, section 3 ("Controller Registers"), subsection 3.1.1 ("Offset 0h: CAP =E2=80=93 Controller Capabilities") CAP_NSSRS_SHIFT is bit= 36, not 33. Signed-off-by: Klaus Jensen Reported-by: Javier Gonzalez Message-id: 20191023073315.446534-1-its@irrelevant.dk Reviewed-by: John Snow [mreitz: Added John's note on the location in the specification where this information can be found] Signed-off-by: Max Reitz --- include/block/nvme.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/block/nvme.h b/include/block/nvme.h index ab5943b90a..8fb941c653 100644 --- a/include/block/nvme.h +++ b/include/block/nvme.h @@ -23,7 +23,7 @@ enum NvmeCapShift { CAP_AMS_SHIFT =3D 17, CAP_TO_SHIFT =3D 24, CAP_DSTRD_SHIFT =3D 32, - CAP_NSSRS_SHIFT =3D 33, + CAP_NSSRS_SHIFT =3D 36, CAP_CSS_SHIFT =3D 37, CAP_MPSMIN_SHIFT =3D 48, CAP_MPSMAX_SHIFT =3D 52, --=20 2.21.0 From nobody Sat May 4 19:56:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572858357; cv=none; d=zoho.com; s=zohoarc; b=TyoQ2jCyglhcQbS1Sz8YajriEpqmRf0i7sOWlk5rf2R2jY+YL0+XUFjOkjCmIKYu9n5l3QihVoIc33Z27mXP8JpKwFpqpTwebDBl3fFgAzw2te6GlGz4AR/X+WWiO19myo8quoTSgyN2XJQLx3WLCw8LAzb2DTc6u1dXqHm62No= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572858357; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2gqxhpNHUfIaIwcmwOFm6C8eab2g7cgHMKq1J40k/qM=; b=YmVvlPiflUd2A/5mIsqJnZKTnJFryPo0BdIMbj8hiOeCpZxC0Tl2++Jrqk0N1RRj0Sk3HdlTMi7AjZrRTnFv7q7QUuZBMhLWBcrTuCJ5MGnp/GkZi20pj6d6xMyjwgwY6O5HqSIsi8lYy9vwmIhxRAIVUTjjgGX1iJufIlaQFfc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572858357322269.476522828921; Mon, 4 Nov 2019 01:05:57 -0800 (PST) Received: from localhost ([::1]:58610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRYJ9-0000jW-LW for importer@patchew.org; Mon, 04 Nov 2019 04:05:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34768) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRYHV-0007N7-Ol for qemu-devel@nongnu.org; Mon, 04 Nov 2019 04:04:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iRYHJ-00032t-PK for qemu-devel@nongnu.org; Mon, 04 Nov 2019 04:04:05 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:37480 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iRYHJ-0002yb-8N for qemu-devel@nongnu.org; Mon, 04 Nov 2019 04:04:01 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-44-CbRMszHVMPSk0lywyLO3cw-1; Mon, 04 Nov 2019 04:03:54 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5CFAF1005500; Mon, 4 Nov 2019 09:03:53 +0000 (UTC) Received: from localhost (ovpn-117-85.ams2.redhat.com [10.36.117.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F330C60874; Mon, 4 Nov 2019 09:03:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572858237; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2gqxhpNHUfIaIwcmwOFm6C8eab2g7cgHMKq1J40k/qM=; b=I4cMF+WZ7PwjgNsxKJ4XV9luq3uL8aB5iODDFUKJQLQXlTTVb6sS4MKn1Br61HsqIfOQCm nQYYWhMWK4MQLxA0B2H3pdIftm2m21uWpiXNqRzy4d96HSvthhGJ9rs8O4XZ1OyoIf5q0h VUxlN/popWF83lKwHvFaLHSkBisp1J4= From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 2/5] block/block-copy: fix s->copy_size for compressed cluster Date: Mon, 4 Nov 2019 10:03:44 +0100 Message-Id: <20191104090347.27278-3-mreitz@redhat.com> In-Reply-To: <20191104090347.27278-1-mreitz@redhat.com> References: <20191104090347.27278-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: CbRMszHVMPSk0lywyLO3cw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy 0e2402452f1f20429 allowed writes larger than cluster, but that's unsupported for compressed write. Fix it. Fixes: 0e2402452f1f20429 Signed-off-by: Vladimir Sementsov-Ogievskiy Message-id: 20191029150934.26416-1-vsementsov@virtuozzo.com Signed-off-by: Max Reitz --- block/block-copy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/block-copy.c b/block/block-copy.c index c39cc9cffe..79798a1567 100644 --- a/block/block-copy.c +++ b/block/block-copy.c @@ -109,9 +109,9 @@ BlockCopyState *block_copy_state_new(BdrvChild *source,= BdrvChild *target, s->use_copy_range =3D false; s->copy_size =3D cluster_size; } else if (write_flags & BDRV_REQ_WRITE_COMPRESSED) { - /* Compression is not supported for copy_range */ + /* Compression supports only cluster-size writes and no copy-range= . */ s->use_copy_range =3D false; - s->copy_size =3D MAX(cluster_size, BLOCK_COPY_MAX_BUFFER); + s->copy_size =3D cluster_size; } else { /* * copy_range does not respect max_transfer (it's a TODO), so we f= actor --=20 2.21.0 From nobody Sat May 4 19:56:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572858365; cv=none; d=zoho.com; s=zohoarc; b=nllt1s93IeeNUHGafDUJh9NlAlXEY99S1WWqi+HnDkcrd8xVDMSP1twdAjtT6sAb5jr0clMPEkFuC0XCSjouOpARiZCZosfYcsnSX86L6cVNfr+fJsbaacwqQopS8uQJv8stF6k1yTgXM3lvoQ3FrqY5b0Cv7CzQiaNiaxvZoR8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572858365; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gDK2u4eyYssTF6J7D92BnAJOpV2mcWKYyqC1Djn0bHA=; b=Mppo+AMQf6A5ANpmhZpX1qdARLUQOzjEhvRX46j4RTafNwhv6S8ZuEMWJB0+7AgCKhbfQC9UETi/hV23SCSz6YkuKNApCJioMaDQ0SzyffUj4bEd/cBktPhtNH7alizsczkmpWKK9bQeoQz6PRwNlDZknr1ILnPPC3NXEgJklM4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572858365803133.20806825691045; Mon, 4 Nov 2019 01:06:05 -0800 (PST) Received: from localhost ([::1]:58612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRYJI-0000zZ-Bf for importer@patchew.org; Mon, 04 Nov 2019 04:06:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34826) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRYHa-0007Oh-3c for qemu-devel@nongnu.org; Mon, 04 Nov 2019 04:04:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iRYHX-0003Il-PK for qemu-devel@nongnu.org; Mon, 04 Nov 2019 04:04:17 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:58862 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iRYHN-000326-Ko for qemu-devel@nongnu.org; Mon, 04 Nov 2019 04:04:10 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-254-reAd0zRFPhyRizK0O3yarA-1; Mon, 04 Nov 2019 04:03:56 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 63D372EDA; Mon, 4 Nov 2019 09:03:55 +0000 (UTC) Received: from localhost (ovpn-117-85.ams2.redhat.com [10.36.117.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 074FF5C296; Mon, 4 Nov 2019 09:03:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572858241; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gDK2u4eyYssTF6J7D92BnAJOpV2mcWKYyqC1Djn0bHA=; b=ZqbJ9RPkC9q1Stneh2KizhT1KQoovDK9AU08OiIJ2mdWQH7IBx1ZwVqEsoRVIWqPOP0IR5 R0ZBQ/nRbSdKgWqBfexfK5QSUg7Cw1cVC1ev7iYy6iLq7xQEpleDjHxHAggoSSVKWFyov+ rMNm4Cnq5m6WR5oMFN9ioQl29lMil6I= From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 3/5] block: Make wait/mark serialising requests public Date: Mon, 4 Nov 2019 10:03:45 +0100 Message-Id: <20191104090347.27278-4-mreitz@redhat.com> In-Reply-To: <20191104090347.27278-1-mreitz@redhat.com> References: <20191104090347.27278-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: reAd0zRFPhyRizK0O3yarA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Make both bdrv_mark_request_serialising() and bdrv_wait_serialising_requests() public so they can be used from block drivers. Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Message-id: 20191101152510.11719-2-mreitz@redhat.com Signed-off-by: Max Reitz --- include/block/block_int.h | 3 +++ block/io.c | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 02dc0034a2..32fa323b63 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -999,6 +999,9 @@ extern unsigned int bdrv_drain_all_count; void bdrv_apply_subtree_drain(BdrvChild *child, BlockDriverState *new_pare= nt); void bdrv_unapply_subtree_drain(BdrvChild *child, BlockDriverState *old_pa= rent); =20 +bool coroutine_fn bdrv_wait_serialising_requests(BdrvTrackedRequest *self); +void bdrv_mark_request_serialising(BdrvTrackedRequest *req, uint64_t align= ); + int get_tmp_filename(char *filename, int size); BlockDriver *bdrv_probe_all(const uint8_t *buf, int buf_size, const char *filename); diff --git a/block/io.c b/block/io.c index 02659f994d..039c0d49c9 100644 --- a/block/io.c +++ b/block/io.c @@ -715,7 +715,7 @@ static void tracked_request_begin(BdrvTrackedRequest *r= eq, qemu_co_mutex_unlock(&bs->reqs_lock); } =20 -static void mark_request_serialising(BdrvTrackedRequest *req, uint64_t ali= gn) +void bdrv_mark_request_serialising(BdrvTrackedRequest *req, uint64_t align) { int64_t overlap_offset =3D req->offset & ~(align - 1); uint64_t overlap_bytes =3D ROUND_UP(req->offset + req->bytes, align) @@ -805,7 +805,7 @@ void bdrv_dec_in_flight(BlockDriverState *bs) bdrv_wakeup(bs); } =20 -static bool coroutine_fn wait_serialising_requests(BdrvTrackedRequest *sel= f) +bool coroutine_fn bdrv_wait_serialising_requests(BdrvTrackedRequest *self) { BlockDriverState *bs =3D self->bs; BdrvTrackedRequest *req; @@ -1437,14 +1437,14 @@ static int coroutine_fn bdrv_aligned_preadv(BdrvChi= ld *child, * with each other for the same cluster. For example, in copy-on-= read * it ensures that the CoR read and write operations are atomic and * guest writes cannot interleave between them. */ - mark_request_serialising(req, bdrv_get_cluster_size(bs)); + bdrv_mark_request_serialising(req, bdrv_get_cluster_size(bs)); } =20 /* BDRV_REQ_SERIALISING is only for write operation */ assert(!(flags & BDRV_REQ_SERIALISING)); =20 if (!(flags & BDRV_REQ_NO_SERIALISING)) { - wait_serialising_requests(req); + bdrv_wait_serialising_requests(req); } =20 if (flags & BDRV_REQ_COPY_ON_READ) { @@ -1841,10 +1841,10 @@ bdrv_co_write_req_prepare(BdrvChild *child, int64_t= offset, uint64_t bytes, assert(!(flags & ~BDRV_REQ_MASK)); =20 if (flags & BDRV_REQ_SERIALISING) { - mark_request_serialising(req, bdrv_get_cluster_size(bs)); + bdrv_mark_request_serialising(req, bdrv_get_cluster_size(bs)); } =20 - waited =3D wait_serialising_requests(req); + waited =3D bdrv_wait_serialising_requests(req); =20 assert(!waited || !req->serialising || is_request_serialising_and_aligned(req)); @@ -2008,8 +2008,8 @@ static int coroutine_fn bdrv_co_do_zero_pwritev(BdrvC= hild *child, =20 padding =3D bdrv_init_padding(bs, offset, bytes, &pad); if (padding) { - mark_request_serialising(req, align); - wait_serialising_requests(req); + bdrv_mark_request_serialising(req, align); + bdrv_wait_serialising_requests(req); =20 bdrv_padding_rmw_read(child, req, &pad, true); =20 @@ -2111,8 +2111,8 @@ int coroutine_fn bdrv_co_pwritev_part(BdrvChild *chil= d, } =20 if (bdrv_pad_request(bs, &qiov, &qiov_offset, &offset, &bytes, &pad)) { - mark_request_serialising(&req, align); - wait_serialising_requests(&req); + bdrv_mark_request_serialising(&req, align); + bdrv_wait_serialising_requests(&req); bdrv_padding_rmw_read(child, &req, &pad, false); } =20 @@ -3205,7 +3205,7 @@ static int coroutine_fn bdrv_co_copy_range_internal( /* BDRV_REQ_SERIALISING is only for write operation */ assert(!(read_flags & BDRV_REQ_SERIALISING)); if (!(read_flags & BDRV_REQ_NO_SERIALISING)) { - wait_serialising_requests(&req); + bdrv_wait_serialising_requests(&req); } =20 ret =3D src->bs->drv->bdrv_co_copy_range_from(src->bs, @@ -3336,7 +3336,7 @@ int coroutine_fn bdrv_co_truncate(BdrvChild *child, i= nt64_t offset, bool exact, * new area, we need to make sure that no write requests are made to it * concurrently or they might be overwritten by preallocation. */ if (new_bytes) { - mark_request_serialising(&req, 1); + bdrv_mark_request_serialising(&req, 1); } if (bs->read_only) { error_setg(errp, "Image is read-only"); --=20 2.21.0 From nobody Sat May 4 19:56:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572858367; cv=none; d=zoho.com; s=zohoarc; b=KpgLejay1xNk7ifYUr5V5xyGO3AMVSjr6tLKpTSll7kKBoFNErQUSiLoKamkC6GnJO7f1redufcWGFw/8QRMF8eVSbuRByrdUPfproQxC8yM4HW0PzHBX6JWEfO5wRD0rvsS3HG1EffBot66QbyG84TtoUgvU4q4rlUHPIJ5vJ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572858367; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kjoRQxInG7FgLzMkntMX8CHdxFC9p5J7VjjpF3PLyEw=; b=nNh6AnkPfHthyBX7VAwihntNI46Ly7lvx8IcoTp6FawKbGZ0Ztn6i1uH1jjuPyAUDMRYETHlDq0AE4tA8T1rDKuBDEFvNMgC64rASFndlvrraawjLvUH9DQ5eO5P+TO+mYRBdPzB1izibCgwUM0r/ciDO5Atdq3nk2tT+Rrw+Z4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572858367365209.56477957771733; Mon, 4 Nov 2019 01:06:07 -0800 (PST) Received: from localhost ([::1]:58614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRYJK-00011n-0i for importer@patchew.org; Mon, 04 Nov 2019 04:06:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34888) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRYHb-0007Ri-Gq for qemu-devel@nongnu.org; Mon, 04 Nov 2019 04:04:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iRYHa-0003MZ-7x for qemu-devel@nongnu.org; Mon, 04 Nov 2019 04:04:19 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:46138 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iRYHa-00032o-1G for qemu-devel@nongnu.org; Mon, 04 Nov 2019 04:04:18 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-183-66HkISBmObmzzF0QHqDO8A-1; Mon, 04 Nov 2019 04:03:58 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6FFFC180496F; Mon, 4 Nov 2019 09:03:57 +0000 (UTC) Received: from localhost (ovpn-117-85.ams2.redhat.com [10.36.117.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0DFD260BF1; Mon, 4 Nov 2019 09:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572858241; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kjoRQxInG7FgLzMkntMX8CHdxFC9p5J7VjjpF3PLyEw=; b=D5mlSGijlr+iMADY9gEo56h9PX+0jvzLPtMeLKwNcbsgc65w/5GyqD0fZxObsItqWActYj HaCY7VPmosXez3LUWi+dS3PE3Y4n3ZAgbxc9qN7oznPOW1nb2dugA85w9P+EUKOxYeSuz5 OfLnOI2kojsIsnimLj8Ea4nWEvlCSSY= From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 4/5] block: Add bdrv_co_get_self_request() Date: Mon, 4 Nov 2019 10:03:46 +0100 Message-Id: <20191104090347.27278-5-mreitz@redhat.com> In-Reply-To: <20191104090347.27278-1-mreitz@redhat.com> References: <20191104090347.27278-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: 66HkISBmObmzzF0QHqDO8A-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Message-id: 20191101152510.11719-3-mreitz@redhat.com Signed-off-by: Max Reitz --- include/block/block_int.h | 1 + block/io.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/block/block_int.h b/include/block/block_int.h index 32fa323b63..dd033d0b37 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -1001,6 +1001,7 @@ void bdrv_unapply_subtree_drain(BdrvChild *child, Blo= ckDriverState *old_parent); =20 bool coroutine_fn bdrv_wait_serialising_requests(BdrvTrackedRequest *self); void bdrv_mark_request_serialising(BdrvTrackedRequest *req, uint64_t align= ); +BdrvTrackedRequest *coroutine_fn bdrv_co_get_self_request(BlockDriverState= *bs); =20 int get_tmp_filename(char *filename, int size); BlockDriver *bdrv_probe_all(const uint8_t *buf, int buf_size, diff --git a/block/io.c b/block/io.c index 039c0d49c9..f75777f5ea 100644 --- a/block/io.c +++ b/block/io.c @@ -742,6 +742,24 @@ static bool is_request_serialising_and_aligned(BdrvTra= ckedRequest *req) (req->bytes =3D=3D req->overlap_bytes); } =20 +/** + * Return the tracked request on @bs for the current coroutine, or + * NULL if there is none. + */ +BdrvTrackedRequest *coroutine_fn bdrv_co_get_self_request(BlockDriverState= *bs) +{ + BdrvTrackedRequest *req; + Coroutine *self =3D qemu_coroutine_self(); + + QLIST_FOREACH(req, &bs->tracked_requests, list) { + if (req->co =3D=3D self) { + return req; + } + } + + return NULL; +} + /** * Round a region to cluster boundaries */ --=20 2.21.0 From nobody Sat May 4 19:56:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572858477; cv=none; d=zoho.com; s=zohoarc; b=SBw8bhAlurWtX+NXzTdfV0pXHLZiu4boOaHXtJ6IhbyXqsupNtr0pXCT5QRiJCWIcUx9TqOSzZaZ4+CuhBGKZNiX9hkRR7gdrhnFYw6q8l/ysCKzCoY0yWPhk3Ps2B4okOdYr6TWCBcNRza4htWSEznfiefBtHdShmi5lPd15zU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572858477; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hT5Z3TYNMcaiyYP/Nvw6MDMmwNVAlQDViWN92O18NNo=; b=iTcnp00jhJaLIeo1NiY0soKPzIDynqwoIoPuLW5uajnW2J7EwDCMZvnn52AaN8jBEe/Rg4YaLhtUMEjqAn0hqZuwJr9dceUyo7S65fRiXW3EtKOBf4ZXqzKTkOkjQ1bGqJelfx6Qre5Nw/55YoeeXJZnCKsZgCyYe+Z+YuyI2Dk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572858477863731.86812800553; Mon, 4 Nov 2019 01:07:57 -0800 (PST) Received: from localhost ([::1]:58642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRYL6-00040x-6H for importer@patchew.org; Mon, 04 Nov 2019 04:07:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34825) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRYHa-0007Og-4a for qemu-devel@nongnu.org; Mon, 04 Nov 2019 04:04:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iRYHY-0003JR-17 for qemu-devel@nongnu.org; Mon, 04 Nov 2019 04:04:17 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:60095 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iRYHX-00034l-SZ for qemu-devel@nongnu.org; Mon, 04 Nov 2019 04:04:15 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-206-ULR8YgewMUWnsluifsrzjQ-1; Mon, 04 Nov 2019 04:04:00 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7692E107ACC2; Mon, 4 Nov 2019 09:03:59 +0000 (UTC) Received: from localhost (ovpn-117-85.ams2.redhat.com [10.36.117.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 16B4D5D9CD; Mon, 4 Nov 2019 09:03:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572858243; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hT5Z3TYNMcaiyYP/Nvw6MDMmwNVAlQDViWN92O18NNo=; b=H9GwoVuDLaZjEOsuIFqwG7gfld3oluJsuJRtD4nRf6liz0niMSta1L/LHzH+yquDaLv0qm 4SbNcvIP6R0ZhPyz13M+QaSJcRPiKZG8ATDLnsNLBDjpZnFwTA1RfBZeZuHWAVWOEGgblC pOLd335R8qdZaJcAXS1gst5wsMa6tzM= From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 5/5] block/file-posix: Let post-EOF fallocate serialize Date: Mon, 4 Nov 2019 10:03:47 +0100 Message-Id: <20191104090347.27278-6-mreitz@redhat.com> In-Reply-To: <20191104090347.27278-1-mreitz@redhat.com> References: <20191104090347.27278-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: ULR8YgewMUWnsluifsrzjQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The XFS kernel driver has a bug that may cause data corruption for qcow2 images as of qemu commit c8bb23cbdbe32f. We can work around it by treating post-EOF fallocates as serializing up until infinity (INT64_MAX in practice). Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Message-id: 20191101152510.11719-4-mreitz@redhat.com Signed-off-by: Max Reitz --- block/file-posix.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/block/file-posix.c b/block/file-posix.c index 0b7e904d48..1f0f61a02b 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2721,6 +2721,42 @@ raw_do_pwrite_zeroes(BlockDriverState *bs, int64_t o= ffset, int bytes, RawPosixAIOData acb; ThreadPoolFunc *handler; =20 +#ifdef CONFIG_FALLOCATE + if (offset + bytes > bs->total_sectors * BDRV_SECTOR_SIZE) { + BdrvTrackedRequest *req; + uint64_t end; + + /* + * This is a workaround for a bug in the Linux XFS driver, + * where writes submitted through the AIO interface will be + * discarded if they happen beyond a concurrently running + * fallocate() that increases the file length (i.e., both the + * write and the fallocate() happen beyond the EOF). + * + * To work around it, we extend the tracked request for this + * zero write until INT64_MAX (effectively infinity), and mark + * it as serializing. + * + * We have to enable this workaround for all filesystems and + * AIO modes (not just XFS with aio=3Dnative), because for + * remote filesystems we do not know the host configuration. + */ + + req =3D bdrv_co_get_self_request(bs); + assert(req); + assert(req->type =3D=3D BDRV_TRACKED_WRITE); + assert(req->offset <=3D offset); + assert(req->offset + req->bytes >=3D offset + bytes); + + end =3D INT64_MAX & -(uint64_t)bs->bl.request_alignment; + req->bytes =3D end - req->offset; + req->overlap_bytes =3D req->bytes; + + bdrv_mark_request_serialising(req, bs->bl.request_alignment); + bdrv_wait_serialising_requests(req); + } +#endif + acb =3D (RawPosixAIOData) { .bs =3D bs, .aio_fildes =3D s->fd, --=20 2.21.0