From nobody Wed Nov 5 18:21:32 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1537361373406748.9713625211813; Wed, 19 Sep 2018 05:49:33 -0700 (PDT) Received: from localhost ([::1]:45257 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2bv9-00023Z-KU for importer@patchew.org; Wed, 19 Sep 2018 08:49:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2bpv-0006oV-Ml for qemu-devel@nongnu.org; Wed, 19 Sep 2018 08:44:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2bpp-0005Sy-TK for qemu-devel@nongnu.org; Wed, 19 Sep 2018 08:44:07 -0400 Received: from relay.sw.ru ([185.231.240.75]:35640) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2bpp-0005N6-Iy; Wed, 19 Sep 2018 08:44:01 -0400 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1g2bpb-0002oH-6N; Wed, 19 Sep 2018 15:43:48 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Wed, 19 Sep 2018 15:43:42 +0300 Message-Id: <20180919124343.28206-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180919124343.28206-1-vsementsov@virtuozzo.com> References: <20180919124343.28206-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 1/2] block/replication: drop extra synchronization X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, famz@redhat.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, mreitz@redhat.com, den@openvz.org, jcody@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" After commit f8d59dfb40 "block/backup: fix fleecing scheme: use serialized writes" fleecing (specifically reading from backup target, when backup source is in backing chain of backup target) is safe, because all backup-job writes to target are serialized. Therefore we don't need additional synchronization for these reads. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/replication.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/block/replication.c b/block/replication.c index 6349d6958e..0c2989d2cb 100644 --- a/block/replication.c +++ b/block/replication.c @@ -218,9 +218,6 @@ static coroutine_fn int replication_co_readv(BlockDrive= rState *bs, QEMUIOVector *qiov) { BDRVReplicationState *s =3D bs->opaque; - BdrvChild *child =3D s->secondary_disk; - BlockJob *job =3D NULL; - CowRequest req; int ret; =20 if (s->mode =3D=3D REPLICATION_MODE_PRIMARY) { @@ -233,28 +230,9 @@ static coroutine_fn int replication_co_readv(BlockDriv= erState *bs, return ret; } =20 - if (child && child->bs) { - job =3D child->bs->job; - } - - if (job) { - uint64_t remaining_bytes =3D remaining_sectors * BDRV_SECTOR_SIZE; - - backup_wait_for_overlapping_requests(child->bs->job, - sector_num * BDRV_SECTOR_SIZE, - remaining_bytes); - backup_cow_request_begin(&req, child->bs->job, - sector_num * BDRV_SECTOR_SIZE, - remaining_bytes); - ret =3D bdrv_co_preadv(bs->file, sector_num * BDRV_SECTOR_SIZE, - remaining_bytes, qiov, 0); - backup_cow_request_end(&req); - goto out; - } - ret =3D bdrv_co_preadv(bs->file, sector_num * BDRV_SECTOR_SIZE, remaining_sectors * BDRV_SECTOR_SIZE, qiov, 0); -out: + return replication_return_value(s, ret); } =20 --=20 2.18.0 From nobody Wed Nov 5 18:21:32 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1537361163372956.2239529707851; Wed, 19 Sep 2018 05:46:03 -0700 (PDT) Received: from localhost ([::1]:45237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2brl-0007vu-1V for importer@patchew.org; Wed, 19 Sep 2018 08:46:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2bpv-0006oe-RB for qemu-devel@nongnu.org; Wed, 19 Sep 2018 08:44:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2bpp-0005T4-Uv for qemu-devel@nongnu.org; Wed, 19 Sep 2018 08:44:07 -0400 Received: from relay.sw.ru ([185.231.240.75]:35642) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2bpp-0005NG-Lb; Wed, 19 Sep 2018 08:44:01 -0400 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1g2bpd-0002oH-Kt; Wed, 19 Sep 2018 15:43:50 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Wed, 19 Sep 2018 15:43:43 +0300 Message-Id: <20180919124343.28206-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180919124343.28206-1-vsementsov@virtuozzo.com> References: <20180919124343.28206-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 2/2] block/backup: drop unused synchronization interface X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, famz@redhat.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, mreitz@redhat.com, den@openvz.org, jcody@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_backup.h | 13 ------------ block/backup.c | 38 +++++++----------------------------- 2 files changed, 7 insertions(+), 44 deletions(-) diff --git a/include/block/block_backup.h b/include/block/block_backup.h index 994a3bd2ec..157596c296 100644 --- a/include/block/block_backup.h +++ b/include/block/block_backup.h @@ -20,19 +20,6 @@ =20 #include "block/block_int.h" =20 -typedef struct CowRequest { - int64_t start_byte; - int64_t end_byte; - QLIST_ENTRY(CowRequest) list; - CoQueue wait_queue; /* coroutines blocked on this request */ -} CowRequest; - -void backup_wait_for_overlapping_requests(BlockJob *job, int64_t offset, - uint64_t bytes); -void backup_cow_request_begin(CowRequest *req, BlockJob *job, - int64_t offset, uint64_t bytes); -void backup_cow_request_end(CowRequest *req); - void backup_do_checkpoint(BlockJob *job, Error **errp); =20 #endif diff --git a/block/backup.c b/block/backup.c index 8630d32926..2c759708ae 100644 --- a/block/backup.c +++ b/block/backup.c @@ -28,6 +28,13 @@ =20 #define BACKUP_CLUSTER_SIZE_DEFAULT (1 << 16) =20 +typedef struct CowRequest { + int64_t start_byte; + int64_t end_byte; + QLIST_ENTRY(CowRequest) list; + CoQueue wait_queue; /* coroutines blocked on this request */ +} CowRequest; + typedef struct BackupBlockJob { BlockJob common; BlockBackend *target; @@ -322,37 +329,6 @@ void backup_do_checkpoint(BlockJob *job, Error **errp) hbitmap_set(backup_job->copy_bitmap, 0, len); } =20 -void backup_wait_for_overlapping_requests(BlockJob *job, int64_t offset, - uint64_t bytes) -{ - BackupBlockJob *backup_job =3D container_of(job, BackupBlockJob, commo= n); - int64_t start, end; - - assert(block_job_driver(job) =3D=3D &backup_job_driver); - - start =3D QEMU_ALIGN_DOWN(offset, backup_job->cluster_size); - end =3D QEMU_ALIGN_UP(offset + bytes, backup_job->cluster_size); - wait_for_overlapping_requests(backup_job, start, end); -} - -void backup_cow_request_begin(CowRequest *req, BlockJob *job, - int64_t offset, uint64_t bytes) -{ - BackupBlockJob *backup_job =3D container_of(job, BackupBlockJob, commo= n); - int64_t start, end; - - assert(block_job_driver(job) =3D=3D &backup_job_driver); - - start =3D QEMU_ALIGN_DOWN(offset, backup_job->cluster_size); - end =3D QEMU_ALIGN_UP(offset + bytes, backup_job->cluster_size); - cow_request_begin(req, backup_job, start, end); -} - -void backup_cow_request_end(CowRequest *req) -{ - cow_request_end(req); -} - static void backup_drain(BlockJob *job) { BackupBlockJob *s =3D container_of(job, BackupBlockJob, common); --=20 2.18.0