From nobody Tue Feb 10 19:09:46 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1603391600; cv=none; d=zohomail.com; s=zohoarc; b=SXhVq0jBa2xjUpAwfQoNzvq3y8/L3ydV56ogn84BuG7XS/OUMpIcIDCUHjRIDC4aQ3YXjmDpHtQwInihWbOUvMB9vJ4s2S37636rWnZWk1UdVJZRYi/rJHOcMsEn9Z3dKxGXf2q8wMFQslVuXkNpra4+T+YeP7Bmp6BKuZfRXCU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603391600; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=BK6eaEF0CJa+BMyWQyuDDzDjCfxGX9PMxZ6zJ17pMio=; b=Hq9GbuUGj1t4s9qpAyqzMEb3J4T3V7ztt0cXEPYJpKhSF7UUrCK0Z4wBfFlT1oKmSniQkUF61a2HxL2Z1wpQJkyLOGOCI6rWbSlmSlRxNv1T4M4PRvBEPBd3aXbDzTkhp0E47b1KcAkEzaUfKo5Whr7i+yjEs4zGQXatmSb5Or8= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass 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 160339160069511.792262276800216; Thu, 22 Oct 2020 11:33:20 -0700 (PDT) Received: from localhost ([::1]:55504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVfOp-0008H8-Ig for importer@patchew.org; Thu, 22 Oct 2020 14:33:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVf6a-0000qX-FJ; Thu, 22 Oct 2020 14:14:28 -0400 Received: from relay.sw.ru ([185.231.240.75]:52098 helo=relay3.sw.ru) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVf6K-0001nr-JQ; Thu, 22 Oct 2020 14:14:28 -0400 Received: from [172.16.25.136] (helo=localhost.sw.ru) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kVf5r-005dVw-UO; Thu, 22 Oct 2020 21:13:43 +0300 To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, fam@euphon.net, stefanha@redhat.com, kwolf@redhat.com, mreitz@redhat.com, armbru@redhat.com, jsnow@redhat.com, eblake@redhat.com, den@openvz.org, vsementsov@virtuozzo.com, andrey.shinkevich@virtuozzo.com Subject: [PATCH v12 12/14] copy-on-read: skip non-guest reads if no copy needed Date: Thu, 22 Oct 2020 21:13:41 +0300 Message-Id: <1603390423-980205-13-git-send-email-andrey.shinkevich@virtuozzo.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1603390423-980205-1-git-send-email-andrey.shinkevich@virtuozzo.com> References: <1603390423-980205-1-git-send-email-andrey.shinkevich@virtuozzo.com> Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=185.231.240.75; envelope-from=andrey.shinkevich@virtuozzo.com; helo=relay3.sw.ru X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/22 14:13:46 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Andrey Shinkevich From: Andrey Shinkevich via Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If the flag BDRV_REQ_PREFETCH was set, skip idling read/write operations in COR-driver. It can be taken into account for the COR-algorithms optimization. That check is being made during the block stream job by the moment. Signed-off-by: Andrey Shinkevich --- block/copy-on-read.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/block/copy-on-read.c b/block/copy-on-read.c index a2b180a..081e661 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -153,10 +153,14 @@ static int coroutine_fn cor_co_preadv_part(BlockDrive= rState *bs, } } =20 - ret =3D bdrv_co_preadv_part(bs->file, offset, n, qiov, qiov_offset, - local_flags); - if (ret < 0) { - return ret; + /* Skip if neither read nor write are needed */ + if ((local_flags & (BDRV_REQ_PREFETCH | BDRV_REQ_COPY_ON_READ)) != =3D + BDRV_REQ_PREFETCH) { + ret =3D bdrv_co_preadv_part(bs->file, offset, n, qiov, qiov_of= fset, + local_flags); + if (ret < 0) { + return ret; + } } =20 offset +=3D n; --=20 1.8.3.1