From nobody Mon Feb 9 00:43:09 2026 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; 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1569935984; cv=none; d=zoho.com; s=zohoarc; b=C7ljCVOUplm5j7TdIPdjNUSu/aLlbATS6Ll48xHNF/hAWx6j6Q4ieNt1k7gRVEBdlKhffcKcxn4VzWkwjyRN6eLOu0i5WOxjEwAEk+sCB36eimrawiUr/Jtvgbx/XU0OBNx5GeA2U+rjwzTawa27Fpd+VhPlK/VNs2RT6vn621E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569935984; h=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:ARC-Authentication-Results; bh=6TqPkcUQoq7I+mg+PnBj+vQUXx6vIQa57ArubNw5czQ=; b=HcIX1gwSbKlfIgA+IvzRQGMZgoaQi9KIHGMkPj+j6XVtIeEIo8HofseSLJXUoYVRgYQMKePp8GHp75N4zrypvOgchbekpc8fOHYgr6rQlON5kGhl2OqwR9lf7BoeyjisJ0tD6yqf/h1kcsL4RfBQfeVU4e0zNch/P2DA/NWBaR4= ARC-Authentication-Results: i=1; mx.zoho.com; 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 156993598439823.765325250132832; Tue, 1 Oct 2019 06:19:44 -0700 (PDT) Received: from localhost ([::1]:41936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFI45-0000Bd-0s for importer@patchew.org; Tue, 01 Oct 2019 09:19:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53495) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFHyz-0004de-3q for qemu-devel@nongnu.org; Tue, 01 Oct 2019 09:14:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFHyw-0006Nu-TY for qemu-devel@nongnu.org; Tue, 01 Oct 2019 09:14:23 -0400 Received: from relay.sw.ru ([185.231.240.75]:60988) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iFHyr-0006DA-9f; Tue, 01 Oct 2019 09:14:19 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iFHyk-00040D-H4; Tue, 01 Oct 2019 16:14:10 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v15 2/5] block/backup: move write_flags calculation inside backup_job_create Date: Tue, 1 Oct 2019 16:14:06 +0300 Message-Id: <20191001131409.14202-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191001131409.14202-1-vsementsov@virtuozzo.com> References: <20191001131409.14202-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 185.231.240.75 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: kwolf@redhat.com, vsementsov@virtuozzo.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, den@openvz.org, mreitz@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This is logic-less refactoring, which simplifies further patch, as we'll need write_flags for backup-top filter creation and backup-top should be created before block job creation. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/backup.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/block/backup.c b/block/backup.c index d918836f1d..b5b7939356 100644 --- a/block/backup.c +++ b/block/backup.c @@ -446,20 +446,6 @@ BlockJob *backup_job_create(const char *job_id, BlockD= riverState *bs, goto error; } =20 - /* job->len is fixed, so we can't allow resize */ - job =3D block_job_create(job_id, &backup_job_driver, txn, bs, 0, BLK_P= ERM_ALL, - speed, creation_flags, cb, opaque, errp); - if (!job) { - goto error; - } - - job->source_bs =3D bs; - job->on_source_error =3D on_source_error; - job->on_target_error =3D on_target_error; - job->sync_mode =3D sync_mode; - job->sync_bitmap =3D sync_bitmap; - job->bitmap_mode =3D bitmap_mode; - /* * If source is in backing chain of target assume that target is going= to be * used for "image fleecing", i.e. it should represent a kind of snaps= hot of @@ -477,6 +463,20 @@ BlockJob *backup_job_create(const char *job_id, BlockD= riverState *bs, write_flags =3D (bdrv_chain_contains(target, bs) ? BDRV_REQ_SERIALISIN= G : 0) | (compress ? BDRV_REQ_WRITE_COMPRESSED : 0), =20 + /* job->len is fixed, so we can't allow resize */ + job =3D block_job_create(job_id, &backup_job_driver, txn, bs, 0, BLK_P= ERM_ALL, + speed, creation_flags, cb, opaque, errp); + if (!job) { + goto error; + } + + job->source_bs =3D bs; + job->on_source_error =3D on_source_error; + job->on_target_error =3D on_target_error; + job->sync_mode =3D sync_mode; + job->sync_bitmap =3D sync_bitmap; + job->bitmap_mode =3D bitmap_mode; + job->bcs =3D block_copy_state_new(bs, target, cluster_size, write_flag= s, backup_progress_bytes_callback, backup_progress_reset_callback, job, e= rrp); @@ -485,11 +485,11 @@ BlockJob *backup_job_create(const char *job_id, Block= DriverState *bs, } =20 job->cluster_size =3D cluster_size; + job->len =3D len; =20 /* Required permissions are already taken by block-copy-state target */ block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL, &error_abort); - job->len =3D len; =20 return &job->common; =20 --=20 2.21.0