From patchwork Fri Dec 24 15:35:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12699057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 281C8C433EF for ; Fri, 24 Dec 2021 15:38:30 +0000 (UTC) Received: from localhost ([::1]:52108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0meL-0000Xa-8m for qemu-devel@archiver.kernel.org; Fri, 24 Dec 2021 10:38:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0mcl-0006Tn-Di; Fri, 24 Dec 2021 10:36:51 -0500 Received: from mail-vi1eur05on2109.outbound.protection.outlook.com ([40.107.21.109]:56161 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0mcj-0000hE-MT; Fri, 24 Dec 2021 10:36:51 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K5RdSdP2efPmKgUIwPW/MjvlgU1GYyed3aDJtid3uuTgEmZL70jLntZDd0nMYEabQoJV6vmXay7UidLteuiUBG1DQEfpTCUTMv+f2DCBX+WvkWM+Ruhu8FddqoldmShVpWHAfKe5bYgRDUE+y2LWgp8hXyaa6egjAtm5bWC/2hN7Jjpc7UjAjAvcM0/pegE9eYT/SLT125F1qXXTlFxZqGWnYmLvAHYVj0BEVJQ6ldBToZbtEXpUipCDHtdF/gtmrT4j2DxKYarNEJGSD/D2mpmNKgMDrWDJdt4dkT2IeXh9K7wZNwfBiV3hwZKfWntRTPNPjvY5iH4FLUluru3/YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GcE2bvCY98TxRSD0z0xPyFqMmGn5y9sm3QcYhqLALBk=; b=ZiENMiiNkEUODnhB5cjhJSAHeEGpHqszuebP8K9iOcWbEk6tMDQRneeGDq9QKKZzQZ4V0/COQ3dr35BdOEzp4ZwV8Fu+/3HSZn81fV/N8zCfVOUJK46u4JRqaZhiJ52Wgzs5XBXO3cHl6wdHjkwP3SMEJpwjpD3WiZFkazEiAgP6sWp3IEp2gBQ4+2SOTatqq582aOdWUURhimtsXSQk64+jElFGSPNmAARwa8ZN9U13wBxpSXQPEISxSeLK3/vw6cyFGT1O03KA/ADKiU+51wDXRVJLeiKyC6Ivh/xIpb7MVvT0QYC6KgAL2E2td/ZB50J2J9b70dU5YAqBZZEBhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GcE2bvCY98TxRSD0z0xPyFqMmGn5y9sm3QcYhqLALBk=; b=CHluJl7KAJFzoxzUgV5sVr65vFM+JCCmzwcNWd4eat5oWY5EaZ/EZAeP40AQeejxfxePZTa0VJQJ1WY8vXS132Rm26/ZFuzbEQha3bu2bNIGwSbcbGRRDxdjyj/PgsOSuMZaywfaHoPwE9ZfKo/XE2dWnIzSO3+D9T8maviPRI4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM9PR08MB6769.eurprd08.prod.outlook.com (2603:10a6:20b:2fd::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.18; Fri, 24 Dec 2021 15:36:16 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112%5]) with mapi id 15.20.4823.021; Fri, 24 Dec 2021 15:36:16 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, nikita.lapshin@virtuozzo.com Subject: [PATCH v2 1/5] blockjob: implement and use block_job_get_aio_context Date: Fri, 24 Dec 2021 16:35:48 +0100 Message-Id: <20211224153552.2086061-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211224153552.2086061-1-vsementsov@virtuozzo.com> References: <20211224153552.2086061-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM5PR1001CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:2::28) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 93c801f9-6e2d-4fb0-a639-08d9c6f31fc5 X-MS-TrafficTypeDiagnostic: AM9PR08MB6769:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WtXcOlsVUziq401DvdQBLf9bUTiQXaDwyAXf2aeePR3jTPhwtlFD1dcLDkUKz2ms/Z3FscjeYNCn4LcJBGfF8qn2xVNJMMwmUNGV1SWPs6it8tZSJl3Sqe9MXdbKLstlviNtLaiosqMr7ZfdogsD5JcR7wCfCIAcEpdxM00YyO+vW+oeGCZYgVHj9YKTdD6yp8DqR/UbZhOLhTFLVUw0mLBuZU5Tiq2lcOHbvqsYOqjKd9SAtM8f6xGPfRYYWcEx3cB9CgjwQxLrfV/b/mY3TrSFY2I7xHzaaYCCb4qsneud7ZTQszDkJ5t7l2Sku+ZJ8ZxXWA/o7jvh+Z0bmbpP2I8vM1t7z7D1jBUuOTprlFRFtHzkUUSxHMA8tSnJ8gcMq/2Vb/PCjDMfTFnxZuAf8v5qtzZzLoICOfnx5lSJWG062Oec4b1cyrcsHJPAg4zcNRBhZ2UQOpBcSxBJ85GKMdmHTn/FJ5Taqcdv7ebp5vYM7sTmO3nY0joVOHqv6Mm+jVF5HiKMC7S7Lau0zq3Mnv1tDHT5yA/dONOP5EOHbcHoR7VFCMJ7h5OKrUBXu9HYScnfcym9a9lYoYOGZRdzqEIq2oB3QIQLOWfzXz9xf81s9vp+GBm7jmTq7ZG1E9vdR/JqXU6Ys1Ntm1FrkzRZg5CPSjQU90KIvWe2Q5SbW3jnAIP8hpFNOQuAEMKuOSS9xozOaTsqGZO3D+L3r0Akrg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(316002)(26005)(8676002)(6486002)(6512007)(5660300002)(1076003)(107886003)(6666004)(4326008)(186003)(2616005)(66476007)(66556008)(83380400001)(38350700002)(36756003)(86362001)(6916009)(66946007)(6506007)(2906002)(508600001)(38100700002)(52116002)(8936002); DIR:OUT; SF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Yw6323Y4Ne/mqqPPWoRe+ibDOEV//Bm2SsLyBOFSxwRmt2TWC5hkb9txCdviqKgfjtdTmjeOJuaF2OdJgbLsWBw0ykAfCmuhMo3NMhUCiqTa1wljRRppyesNydzT6IeARj/SlrvJ7Wl1bMvSybtYHjb9Mt5FGsz7kO8cZbGj2pAgcVb8fGRD+9g1icos6uo09AHjDanaagID+gKUT/6n41Q5BzMVMOeoHIsUTgVmsRdj3r1aEM/EH5vGFhLuV6HgBxUJPm/zWPnZUXUzG2Tyb4cwK3ik/TchRcz+X9I9Ii5mNF6qaVC+gWPcs6sYVuklc99SknWiZZ4fhSMq5IOL+4K0q5TcI2qnf7aYHo3hMru3KHCwDjUQLcv+dPlexdWP/sVOTCILzp0fGv57OJhHMz84s0ZMzieYJsxI6NFCMIn7MC8OcamKbm6yOvBPMRF8WSXhuN89gi48v1HOWt7WyjX6ESDbGuyIp2UBW3uyJPiTYFaOwjHmzdiJqNxfxFPH54TMyNYeSh6a8vRV5/FlrxlOxwVAryj/ck6UQvlcy74390pMt8jIP8CVoW8jV9TRqm6s6yYQtnLR//RAWcC/Em5O+qJR3j+XalzKMi+bOgVQpZnZ7SCI/YnvIfnMBhPLKUchtLGnFlphxvvbcgTmj6p1RpIPTV2mxzwazY9XQmOGFmU= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93c801f9-6e2d-4fb0-a639-08d9c6f31fc5 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2021 15:36:16.3129 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XtamZt5ufLnga3bItIPek1HHllamMVOybB77IVCIPE9LSj9XTV0jkPmTLWQrexh1dpc6EjVH/5+/0rZUplOE2fLfTZK+bJU0LknW3x1TG5k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6769 Received-SPF: pass client-ip=40.107.21.109; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We are going to drop BlockJob.blk. So let's retrieve block job context from underlying job instead of main node. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/blockjob.h | 7 +++++++ blockdev.c | 6 +++--- blockjob.c | 5 +++++ qemu-img.c | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/include/block/blockjob.h b/include/block/blockjob.h index d200f33c10..3b84805140 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -173,4 +173,11 @@ bool block_job_is_internal(BlockJob *job); */ const BlockJobDriver *block_job_driver(BlockJob *job); +/* + * block_job_get_aio_context: + * + * Returns aio context associated with a block job. + */ +AioContext *block_job_get_aio_context(BlockJob *job); + #endif diff --git a/blockdev.c b/blockdev.c index 0eb2823b1b..b5ff9b854e 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3315,7 +3315,7 @@ static BlockJob *find_block_job(const char *id, AioContext **aio_context, return NULL; } - *aio_context = blk_get_aio_context(job->blk); + *aio_context = block_job_get_aio_context(job); aio_context_acquire(*aio_context); return job; @@ -3420,7 +3420,7 @@ void qmp_block_job_finalize(const char *id, Error **errp) * automatically acquires the new one), so make sure we release the correct * one. */ - aio_context = blk_get_aio_context(job->blk); + aio_context = block_job_get_aio_context(job); job_unref(&job->job); aio_context_release(aio_context); } @@ -3711,7 +3711,7 @@ BlockJobInfoList *qmp_query_block_jobs(Error **errp) if (block_job_is_internal(job)) { continue; } - aio_context = blk_get_aio_context(job->blk); + aio_context = block_job_get_aio_context(job); aio_context_acquire(aio_context); value = block_job_query(job, errp); aio_context_release(aio_context); diff --git a/blockjob.c b/blockjob.c index 4bad1408cb..70bc3105a6 100644 --- a/blockjob.c +++ b/blockjob.c @@ -547,3 +547,8 @@ BlockErrorAction block_job_error_action(BlockJob *job, BlockdevOnError on_err, } return action; } + +AioContext *block_job_get_aio_context(BlockJob *job) +{ + return job->job.aio_context; +} diff --git a/qemu-img.c b/qemu-img.c index f036a1d428..21ba1e6800 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -902,7 +902,7 @@ static void common_block_job_cb(void *opaque, int ret) static void run_block_job(BlockJob *job, Error **errp) { uint64_t progress_current, progress_total; - AioContext *aio_context = blk_get_aio_context(job->blk); + AioContext *aio_context = block_job_get_aio_context(job); int ret = 0; aio_context_acquire(aio_context); From patchwork Fri Dec 24 15:35:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12699056 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BF7DCC433EF for ; Fri, 24 Dec 2021 15:38:09 +0000 (UTC) Received: from localhost ([::1]:51856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0me0-0000NU-O4 for qemu-devel@archiver.kernel.org; Fri, 24 Dec 2021 10:38:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0mcn-0006Xr-CW; Fri, 24 Dec 2021 10:36:53 -0500 Received: from mail-vi1eur05on2109.outbound.protection.outlook.com ([40.107.21.109]:56161 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0mcl-0000hE-Vh; Fri, 24 Dec 2021 10:36:53 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hqAsfo+lm/9RdP5wPf5N/xDk0hfwZ7dn+AQoQQHP7Mw/HO2yOhfKv/rrGRA7D/87p/H9Z3KqSTSVIBqSkvi9LNOgNzj0gkhnm+irgz4EG1VCRm0eZE9KB77vexQHXRJfWijFMqp5PY6wGQtMyMbNunAtGRxTrrFLRfDyDGdKj8B0Rq6v/gd3Hj8U73r2oQgdVkirMC4QeMDewqn7p/A8mVwH/sdYCuLQXFQkkvFfXIhSBrxyv1wPs3jEEwkgwAfZi1ZwnBKrcD5/fw54tGje9J+5GCl+ebgzp49MlCm8QsjS8n9rp5Gt9+1wv4mMvvicbq5AUxD6bJE23InniWQ0Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ETrBO321JCwwtX0BLRKxi8KVt/FNRfW3UXu4Gsf6qeE=; b=Abpb2BrarnXKbbjUJSkwqfSuFkE7j/0fz7qDRJ9+5sTtRTCzjnkW1IehUnjq0NtR0RhKAAMIAp94LFfE3+R8aTrWg62TDqdJV9CgEEKhJtOvbMpafW1OEbBLPg5AXjMSHsFcOgxctFnLIwFYc6KL7eXQWz7f6UhhX8mqRu+Jn1WkZGccsL/0bTMLnv1p+X1Q5x3VQXahyhpBCesgVDVxXooWajtjlhQeabcdc53hQCPjcyB3ikafOTGbIgWc6PLR5Hhs+ScmcFdaCsiXeh9Rv4KebQupeBMGBZL3JZJlcqkOxUP4v3zmwp6cbRhdd3TWAcXkejBd+of65KM/pu8AcQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ETrBO321JCwwtX0BLRKxi8KVt/FNRfW3UXu4Gsf6qeE=; b=j+JcKNHEQ8RfkjSaL7SkpbKso2TkHqdXbGHyIUjXmc0qANdTcOvCNbN4HQjs5kRLuJWGWpNT5fNkaHpKzGogjvJBB7RF8euh3FOYIecEYrGRNNg7tcxonwBGylE4c78+X+wkrlOOLv3ji6E8IHWHJbsGM2TZgKNF2v3+2CR9bco= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM9PR08MB6769.eurprd08.prod.outlook.com (2603:10a6:20b:2fd::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.18; Fri, 24 Dec 2021 15:36:16 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112%5]) with mapi id 15.20.4823.021; Fri, 24 Dec 2021 15:36:16 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, nikita.lapshin@virtuozzo.com Subject: [PATCH v2 2/5] test-blockjob-txn: don't abuse job->blk Date: Fri, 24 Dec 2021 16:35:49 +0100 Message-Id: <20211224153552.2086061-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211224153552.2086061-1-vsementsov@virtuozzo.com> References: <20211224153552.2086061-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM5PR1001CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:2::28) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1df4794d-3b04-4df8-3df5-08d9c6f32001 X-MS-TrafficTypeDiagnostic: AM9PR08MB6769:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:164; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kIWqPyUZJDraA64qTVQZhgz3A6dYhnowLGDI3ZPKEnuwPT2Rkr8/RUjfCESdGrgV/8uAkR2FAtqqElkV1BmHP9qEp/gt+B5vsG98/V2X+5qDyTqulZQXOmnz6vTNkCVS0XwaJn01VByJuBIoWlB8qqTvMgJ1FFKNYMEuZgL5JobuMjm5AcCEXuz3kXLPfiQh7mJXDaTVCf5HxMCWrnBLPClIDnyVcqneXW7+D+LWVGB7SmolR9RYCM1rYfmlyfA7t/6iCrN0njXM7H5iNhjcOmNzcpgtCRwGN3Ax2tTLT5SP6lrAi7n0gPW97teehbTUimpJKTr920llamm235hdn+n7p02xQrxZv/Uu+nYJLwNfa+HBQb7PBFf+/clVcn/dZc/w9AHVy1FMercqW9LzOBMR2VUhpJis6SKo3KiWH0HwQW6ll+RU8hvzPvDQKwKFzD4QnZg3ZnqXLkTRKt39kCDyB/jxXt0gkq0ZYmHhl28wZtrT0u/2390BeaOF6chqSV1PE2EkG5swyyHebCqz6NQ0qngDLPb1jlcKQWN/UNJUzly3JIxYcf7RDLKP4rwg1E+EoPoDLVqA8sloZFZaalxg8YxdLvXkgj4VD1kpycQssxXOfvX7+FS0tAqSdhRjAauG2Ywu0mJCYDoM3pduO/GnpHsc1oFb6orXYcaIzFIFqSpL9tIMCnCAsGCzJWg7y7z36ScIhKXjYFGUTSHC4A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(316002)(26005)(8676002)(6486002)(6512007)(5660300002)(1076003)(107886003)(6666004)(4326008)(186003)(2616005)(66476007)(66556008)(83380400001)(38350700002)(36756003)(86362001)(6916009)(66946007)(6506007)(2906002)(508600001)(38100700002)(52116002)(8936002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GjA8QHyXmpGzJtg+Coaz9+vndVf0XE/y+E9SRTAbWn7JQVZtIhZZLCHA4124WxvFYCkoQJ4cTGuOPYzjRpvNa8rr1dd6Axb+OMm3r142ja/ayHVDS3hkbgmV9clfbL+b2zPCPKWkD9YwcpcEedvRSmDM5qpbPpWsM5Iil6kflbvq85OlEdrObVuknafYTaduGvfqw+nEBMuXaRxxlsEO237gvwBkPj8jKa6p5Mb2dZ71+jpM7PumF5fGUUxNzHv55kbV9Np0IgFSXhZzF0VUrQCHkc7lbgNlM0hSbrWJIhselY/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ruJgfgEWWgPW5Z+O5COxQ9a1AYAQR+CYdYqbiSL7kdCs10/GP6ucjPsS9OI5kGb2m31Pa/Xub9i7glpV0PaIpV92PZgdyCFcDWVGFgl4Cilq5n3zUCIRECWTEO2/0zJtkMHfIB9vwWDG451GUMM28fnxPpZGLQOZ5FmB29WkEJfuNK/tul6pfMo82fi0akgvgRcWRnqyDSP3k2drXp42la0FO6RHfTYq1Xf6DiO9XbHVosBXPpdxgkJTRdDxla/uppUJnxDsspO3uLXyDhRCYKnB8Fp8y51xNZyLcVmPhCbASXg97QYak8WB8fYnUY2qV/++BAmTsqU9K4= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1df4794d-3b04-4df8-3df5-08d9c6f32001 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2021 15:36:16.7190 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2YS/w2xv0di1w3RGHWZmHri1y0e4lAD427IfFY4Lrt7hZK38Xi4Mz4FUXp0NH3dei8NABF2IBaw+sAc7RQdM2gN40p92ezQ22gr3h85ozXc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6769 Received-SPF: pass client-ip=40.107.21.109; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Here we use job->blk to drop our own reference in job cleanup. Let's do simpler: drop our reference immediately after job creation. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/unit/test-blockjob-txn.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/tests/unit/test-blockjob-txn.c b/tests/unit/test-blockjob-txn.c index 8bd13b9949..c69028b450 100644 --- a/tests/unit/test-blockjob-txn.c +++ b/tests/unit/test-blockjob-txn.c @@ -25,14 +25,6 @@ typedef struct { int *result; } TestBlockJob; -static void test_block_job_clean(Job *job) -{ - BlockJob *bjob = container_of(job, BlockJob, job); - BlockDriverState *bs = blk_bs(bjob->blk); - - bdrv_unref(bs); -} - static int coroutine_fn test_block_job_run(Job *job, Error **errp) { TestBlockJob *s = container_of(job, TestBlockJob, common.job); @@ -73,7 +65,6 @@ static const BlockJobDriver test_block_job_driver = { .free = block_job_free, .user_resume = block_job_user_resume, .run = test_block_job_run, - .clean = test_block_job_clean, }, }; @@ -105,6 +96,7 @@ static BlockJob *test_block_job_start(unsigned int iterations, s = block_job_create(job_id, &test_block_job_driver, txn, bs, 0, BLK_PERM_ALL, 0, JOB_DEFAULT, test_block_job_cb, data, &error_abort); + bdrv_unref(bs); /* referenced by job now */ s->iterations = iterations; s->use_timer = use_timer; s->rc = rc; From patchwork Fri Dec 24 15:35:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12699055 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D7354C433EF for ; Fri, 24 Dec 2021 15:37:52 +0000 (UTC) Received: from localhost ([::1]:50380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0mdj-0007pm-HZ for qemu-devel@archiver.kernel.org; Fri, 24 Dec 2021 10:37:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0mcH-0005q1-Jw; Fri, 24 Dec 2021 10:36:21 -0500 Received: from [2a01:111:f400:fe07::712] (port=55270 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0mcF-0000YV-Kd; Fri, 24 Dec 2021 10:36:21 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gltt8DITptCWm1EdGJq59vF6IuamSdU6wX6uQXZI+h3EFwwAlXH0V9FqlpY+EiyRjzwXKDj7jJ2350cj19Vy8g9qIrg1RbvGq4veZuPWcJC/20mgebPaGny7rixsETQxE6zrevWS5kyqjQoDHLiNnqzKPL6nBqcUkeVgYWKgQl31G9hvdSW6W5OkD4eYKFlPO7mbKeYBZNqDwJrY0I0UICIcVfmhBaD+SSZD6hN15VIQQwxlK0ZO8/+4LuBMWlVsU8z645b1MwDJAL6dufqZTf2l1TodiWRclTbr+h/xK6aGJ21bLuxv7/wDbTILkAEuXvxGgZIuRx+VkH9p5EyW5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DhfTs802s5lvkMdah/POtNRkTw1/pQ27yN+AjxyD318=; b=RI024eXmi2W0BqahEpdDN8Q7xuKgDX7ld9d25MVgwof6z1UgWVOEdCZN4rlaAtOFCW9HxarAmyQekWaCQXaXfjzFkG4Rl/dTXXmpd4A/HOFWpevS8vahArKgNg6MROti7C1JwUEfRJ8YTq2RY3+S83ehgjqeNKAYovTqXVEsQs8+acrMPrZ9hrjMrsHrVr02D4Oa0Jsh2kgpWuKbT6J1qq+AIspZL8TWBI6O9NWtRDDhuxxwbBWdYhAZIFWnsLO7vIrXCSD+t2a8Uedpc69qHQYLS9U0Ekc/ffHawsar2F5H3qCFUC25pV49oz76FweUBbTLz8Ugw2zCalPtodgCWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DhfTs802s5lvkMdah/POtNRkTw1/pQ27yN+AjxyD318=; b=tmrcVooEdHrT1jUxsHBrXkdhgzcSynj9K0PpxPoxfPq71NhrGJN8qkr9p8vGGYlazXvxGM25p7cCAbqlrtJRectBRE7Y1nqLKowAOpxNIaMw3KOFEShe70CqY98Dhqhn9J822CRLogk4bZT8G7jlIJLUzrJdelidNNM2Ozf/NAo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB3955.eurprd08.prod.outlook.com (2603:10a6:208:12d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.19; Fri, 24 Dec 2021 15:36:17 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112%5]) with mapi id 15.20.4823.021; Fri, 24 Dec 2021 15:36:17 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, nikita.lapshin@virtuozzo.com Subject: [PATCH v2 3/5] block/stream: add own blk Date: Fri, 24 Dec 2021 16:35:50 +0100 Message-Id: <20211224153552.2086061-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211224153552.2086061-1-vsementsov@virtuozzo.com> References: <20211224153552.2086061-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM5PR1001CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:2::28) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1bbd03de-72e9-4a8c-d604-08d9c6f3203c X-MS-TrafficTypeDiagnostic: AM0PR08MB3955:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1c91Ic3r1Ukbb56OxfTAzWtzC7He2lcto1T1uvMwoqlqrNWnyzPTl27C94A5GQ9hsJLkQPoFYG6r78acU5X9T+da05Yao5W0gOGKIRE4xSGepAx2EbP8eiL94EqEJxaK3bjwh2H0/3qTVx3rZoql+WoRqQ4TTiraYl+ibLH7iwcEoi+A++Ek71H8wyXWoPp+i55oKv3tp+toMt1fQhPqdSixY9rIra4AJgMKKVlQzyj6CTIPkQG2ncaxQ9m++eDY9Q9dIDdG69eJ55EU+k8PwvIV3YBB5An2NXlelAsJWG45ng+l4z5JBKwkiA4Bky6x+MjHdp24USUfdhERAOFHMbVN3B9yG4dTASp1DDrOLMET6QM2eKwcYbw0+YJryOW3DyrGzbsRY8LRx1vonLrKLQYN1CdmKDNhmjNrPnG2xlzHGPnjlsjO/SSY2+kSQWdLc9/sh3+q2GzHPnpUEP1qxxNN3zq01JT3KDXVj/917Dpa6T4HidKNlcClc2QX21ysgRdkHveXXpLo7i57x0vqUeXvFZJ2+bdZiO/NOYBFYVIQ4gbKuZHkscPa/O+q5VSkyRLC5HTCzfM67siciKtgeVFh8AnsTxrgIiNp7ij/TGvdwKIAXgos1bXdYT2uo114v3KfZ9I/REucmRVhARqOS1tnaz1z+YN9fr7oWp9mbrnOSDQDRnEbOPVKOr/EtfxtVOjYt11yxNV9R5mXNoZtTA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6666004)(4326008)(508600001)(86362001)(2906002)(107886003)(66476007)(26005)(186003)(6506007)(66556008)(2616005)(38350700002)(38100700002)(83380400001)(66946007)(36756003)(6512007)(52116002)(316002)(8676002)(1076003)(6916009)(6486002)(8936002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Fs1N0cYAhev3zLOr1/mfYrp28xrgRAR9n6tHr3O5WNKktY5gQkOEK7Ftnbi+sVW5i4d+UWDVBNHbief/r9n6hCjuU2+g1zug4oiv3npMglR6c4iEg5YeECvkuCQohmnPX4KUxdqGmjg99b3kpB/NORqeBmx0ECcxncgygRvGXPlVjoaMejiXdKlAgNGfRVDgihn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nZHvscBw5D1MMEGkpsKdIvlwoUC6tXZL1tiBuFFoanDkDpuhfZECM42DcrNWeDIBfDsb9I4ACnGkY0HXYPU8mc7BSlIpoz5ecRF25pjDwNYxmOdTa84joAzxmakyX5O5m3f/YCqHeFI6AnGbwUWT8h3ZkBzt2BmNqhyOPkv5JXC+OAsTakK0aS8j3hgv6ppjEe1Cxx3Gv678aKFM+G4qtO4J6Y28W0VtIe5Q+1KlKCEDboietOZjp40A6palMfWW+Hq6OOLWO+BUaUtVxtVtI3spV7nSLmHJUS5MOgyJzS5Qo0Ctl7I2R8cnHzh17QXyM4upRS6W89mZVsvL9qtvs2TFkg5r52B9OT9mVhW56JyIWbuN7G5mklyHiMhbLM7C3yHBIdrMcIQk+wW/xzldm8wBoFdwZ84ASdGdrh1zuLDuulRIY2beEM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1bbd03de-72e9-4a8c-d604-08d9c6f3203c X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2021 15:36:17.0940 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2QR3HOCM3vcUCF+4cztfQedVAPh9cS99006H9ToHdoyjsQPdLk9KTx+JNFNgU4HfOSh+FKPX/82SfydW3cHXZpNvtnSy7/EHRIOcgxio8Dc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3955 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:fe07::712 (failed) Received-SPF: pass client-ip=2a01:111:f400:fe07::712; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" block-stream is the only block-job, that reasonably use BlockJob.blk. We are going to drop BlockJob.blk soon. So, let block-stream have own blk. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/stream.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/block/stream.c b/block/stream.c index e45113aed6..7c6b173ddd 100644 --- a/block/stream.c +++ b/block/stream.c @@ -33,6 +33,7 @@ enum { typedef struct StreamBlockJob { BlockJob common; + BlockBackend *blk; BlockDriverState *base_overlay; /* COW overlay (stream from this) */ BlockDriverState *above_base; /* Node directly above the base */ BlockDriverState *cor_filter_bs; @@ -88,17 +89,18 @@ static int stream_prepare(Job *job) static void stream_clean(Job *job) { StreamBlockJob *s = container_of(job, StreamBlockJob, common.job); - BlockJob *bjob = &s->common; if (s->cor_filter_bs) { bdrv_cor_filter_drop(s->cor_filter_bs); s->cor_filter_bs = NULL; } + blk_unref(s->blk); + s->blk = NULL; + /* Reopen the image back in read-only mode if necessary */ if (s->bs_read_only) { /* Give up write permissions before making it read-only */ - blk_set_perm(bjob->blk, 0, BLK_PERM_ALL, &error_abort); bdrv_reopen_set_read_only(s->target_bs, true, NULL); } @@ -108,7 +110,6 @@ static void stream_clean(Job *job) static int coroutine_fn stream_run(Job *job, Error **errp) { StreamBlockJob *s = container_of(job, StreamBlockJob, common.job); - BlockBackend *blk = s->common.blk; BlockDriverState *unfiltered_bs = bdrv_skip_filters(s->target_bs); int64_t len; int64_t offset = 0; @@ -159,7 +160,7 @@ static int coroutine_fn stream_run(Job *job, Error **errp) } trace_stream_one_iteration(s, offset, n, ret); if (copy) { - ret = stream_populate(blk, offset, n); + ret = stream_populate(s->blk, offset, n); } if (ret < 0) { BlockErrorAction action = @@ -294,13 +295,24 @@ void stream_start(const char *job_id, BlockDriverState *bs, } s = block_job_create(job_id, &stream_job_driver, NULL, cor_filter_bs, - BLK_PERM_CONSISTENT_READ, - basic_flags | BLK_PERM_WRITE, + 0, BLK_PERM_ALL, speed, creation_flags, NULL, NULL, errp); if (!s) { goto fail; } + s->blk = blk_new_with_bs(cor_filter_bs, BLK_PERM_CONSISTENT_READ, + basic_flags | BLK_PERM_WRITE, errp); + if (!s->blk) { + goto fail; + } + /* + * Disable request queuing in the BlockBackend to avoid deadlocks on drain: + * The job reports that it's busy until it reaches a pause point. + */ + blk_set_disable_request_queuing(s->blk, true); + blk_set_allow_aio_context_change(s->blk, true); + /* * Prevent concurrent jobs trying to modify the graph structure here, we * already have our own plans. Also don't allow resize as the image size is From patchwork Fri Dec 24 15:35:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12699058 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6DC67C433EF for ; Fri, 24 Dec 2021 15:41:19 +0000 (UTC) Received: from localhost ([::1]:56340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0mh4-0003Pk-AO for qemu-devel@archiver.kernel.org; Fri, 24 Dec 2021 10:41:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0mcJ-0005qH-JF; Fri, 24 Dec 2021 10:36:23 -0500 Received: from [2a01:111:f400:fe07::712] (port=55270 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0mcI-0000YV-6E; Fri, 24 Dec 2021 10:36:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a49SmaCdz5XZ2JYkQzeNJ+3wMMrrpXMcIAQBNZPieHj8gIULtOhNNsmRijAR1Y8dUwebuOLgu9g/j2xiBoxhiMIrvUANAwQ4oGhEDqBEhefQ2GjWOhP7zCewudr6yIUgZVp8GazdwLQ4EoTogZhC3Crk4NK4tyqRE+VUQpWKk+Qba+VYjsdGxVep/gPkdRCbfTddswsBAvzPVYZ1VsZ6k9i3PpIcAnLTxcjG+q8gE6Ddk2jZKS/m6nQIZAJ9xzmVT0g77dAOTwP3zzm58uqsSt5z4O7RKy5ZBCPgx5nKX305FKHM+CuuuSht42ewQCH2lKqiLzrcwVYcf3kR2Zp9aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mLwGVSdAE9uh+PAaecJAc6BEShd9WOc+Rya+6nuVyc8=; b=RRe3SUYz4RKBBajlRJHF8rhKhjB1HubYb4ZtQGyvYnWtajzRo/GCzv7y/KQWeiwfJILhrIk4dXOQ9/KpX0rZR1rji4TfR8ClcevX5fJ+q5qAja3qt6epdhobbAtZVxcmg5ThA6+sfnMFaBjgqRnS0J62b0vHSDpp2RoQVT6FmZhIwJxtB7AdfIxnS2u7x2EJj5deBhi/GZ+67PIdWePtw3KnJ4GMYQ1JEhXSkw1eR3Sjdf+5cW1JBYNAqF6SQBHqJBvfqgcisS0TeDhnxO/hAXDb38EoBOYTRpRXBMKKANp6d8JYWpWkhq5O0hBVXV6uMuyWwMffFKGljBYiFbsUaw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mLwGVSdAE9uh+PAaecJAc6BEShd9WOc+Rya+6nuVyc8=; b=str97SJ8lKwbXOJfpq/DtQ8y+3vRhmMOZJ4CwcHu6EyMu5hdju651F2oq+vD2ar+9aCn2Pgq6ObSzf7ULU2RIxCh4KsXKZnNObXv0ty5EesYjxlnhfkJ+Z28IjSGnYNyGVhtNkbhg40fxp9ZNQpcozGi8jNe+nip2suzKkmlqaA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB3955.eurprd08.prod.outlook.com (2603:10a6:208:12d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.19; Fri, 24 Dec 2021 15:36:17 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112%5]) with mapi id 15.20.4823.021; Fri, 24 Dec 2021 15:36:17 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, nikita.lapshin@virtuozzo.com Subject: [PATCH v2 4/5] test-bdrv-drain: don't use BlockJob.blk Date: Fri, 24 Dec 2021 16:35:51 +0100 Message-Id: <20211224153552.2086061-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211224153552.2086061-1-vsementsov@virtuozzo.com> References: <20211224153552.2086061-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM5PR1001CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:2::28) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8a92ba03-9b76-4977-a340-08d9c6f3207a X-MS-TrafficTypeDiagnostic: AM0PR08MB3955:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:20; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V5aO5vTWPajj7KShX+X15CZGLCUKtfWPaZro9tuIRF827OJoEtcm/a1ax/AY7PAlD0D2miEAmx6nIgCrMl5uSkZRqVdnU0C9QferUBRoB/OEkHQabHf4N7tcSdRQjBbGcEqO9L7AZ+56ajomo1/HKaCsGgjZDHcbFmUDM2SqGb2QRkMTlsP0KxWvfac0Z9A1pSd05KjzyjqWA+NRmOZe1BylU9GREQfXwdk1ccwnF/u10kPK3iRz6DNW0+Wu+tVWcYOymA9AK/Dyfwf8iusWXmTsW/daXev6vj2MmUK7XHu3vuBjCatp65BT+qVSzqzQf1JAq6KKmINhyW2v0TI9zfyU0LhrMH6MqlQftNJLTqRxC/RaBApkYLrN+YtflzlGn6sVEMLnWzRyuwXe1jPjG6FIvB0XyJ8fIZ8kAg82HS64DGJLkS8uiS8lYCRsbIGiYTTzgCJbIq1d3hXnQ7HL2oSw3DqrkLmPUJ9rRTem/BEoNoPD4w9/WmTtXBClMnda8cvTiX8pGcJ4mttN8rdB1y75WOs+j0Pqhz5oauqqgUN+lFKBMIrBzjHtGTyDJPNhmfN2zFmbg3biQUIXYgzaTECGmmsKErqdI/zKXuMCJE252eXEBpNwRT7ddEYMaSsQfVeI0KYa5yeg5ut2KVAVpqdvViM5Np4Hgqru1zIsqAnC/e4dWRZA+VvdqCujsZI8JX/NsXusjo3VZngyGuRL/w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6666004)(4326008)(508600001)(86362001)(2906002)(107886003)(66476007)(26005)(186003)(6506007)(66556008)(2616005)(38350700002)(38100700002)(83380400001)(66946007)(36756003)(6512007)(52116002)(316002)(8676002)(1076003)(6916009)(6486002)(8936002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CoQmZmtI2Dbe50RDo0vrvfdwlcYMS9dgx7XmIvbHjUToXVJc+Nr0atHKs/WyE8HLP+7Qyj0xxa+1m3Uw7+iSIiPT9jTbNUcw+dtd7zynJpGqgvT+Z8hRHRFoKec+8wegpwg1vuSAenmstOxFMY0Tfn53l1BeZkuJ2OM1kpc8/Cj59NyLBm1CApXtLqqHm/FBApnVQaPvZpGIGJWblhrh/2aa4lu0R4Lom9wRPlcsxFbsVvwXKwx8KW0/c5LannhcjVh3HXM5IjHF9Q5OMOHvUDai6zHxQJBpwDqd0+fc/HvyuIogyafIGrTkmPjCiNdCEmZPcWFQld13+wp/AkMZ4tciModzvT/AEsQC7DmpF5PfDswkvDKTpgig2J0wbwhwkxMx91TlrvH5SlIowOv9rZpZ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9Yup0Zp5oeo4GDldfZfvAcFcPn7q0W1K4/FW2qgbGUv+T/UQ6lvaLzzLUvBsxhBpf7gWSuyPVsyRbjirMfGnO72wmZe+TtJAJFk2iI1nkQgHR1R67M9p5CpoptXngWRWc4sflZnfCKeypgj/0tQDGC+4vfg7h+QqppoRyoqx4KCoctzHvL40K3gY/eRcYuKReoL9o8J0iy56K3tSSneKGw2IfgEQ2u4LPwTcHjxIqL/FA= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8a92ba03-9b76-4977-a340-08d9c6f3207a X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2021 15:36:17.4990 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HAFHIwPTquJVhMfpq86ew1HDO/6uZvJpUEugSGDoD4GrqqhVJdT81SB6BSVxwx6cPJhPbAhS83Ai4ht8uEqNHEYMx024vWi0M5lmE8h8ff4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3955 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:fe07::712 (failed) Received-SPF: pass client-ip=2a01:111:f400:fe07::712; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We are going to drop BlockJob.blk in further commit. For tests it's enough to simply pass bs pointer. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/unit/test-bdrv-drain.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/unit/test-bdrv-drain.c b/tests/unit/test-bdrv-drain.c index 2d3c17e566..36be84ae55 100644 --- a/tests/unit/test-bdrv-drain.c +++ b/tests/unit/test-bdrv-drain.c @@ -772,6 +772,7 @@ static void test_iothread_drain_subtree(void) typedef struct TestBlockJob { BlockJob common; + BlockDriverState *bs; int run_ret; int prepare_ret; bool running; @@ -783,7 +784,7 @@ static int test_job_prepare(Job *job) TestBlockJob *s = container_of(job, TestBlockJob, common.job); /* Provoke an AIO_WAIT_WHILE() call to verify there is no deadlock */ - blk_flush(s->common.blk); + bdrv_flush(s->bs); return s->prepare_ret; } @@ -792,7 +793,7 @@ static void test_job_commit(Job *job) TestBlockJob *s = container_of(job, TestBlockJob, common.job); /* Provoke an AIO_WAIT_WHILE() call to verify there is no deadlock */ - blk_flush(s->common.blk); + bdrv_flush(s->bs); } static void test_job_abort(Job *job) @@ -800,7 +801,7 @@ static void test_job_abort(Job *job) TestBlockJob *s = container_of(job, TestBlockJob, common.job); /* Provoke an AIO_WAIT_WHILE() call to verify there is no deadlock */ - blk_flush(s->common.blk); + bdrv_flush(s->bs); } static int coroutine_fn test_job_run(Job *job, Error **errp) @@ -915,6 +916,7 @@ static void test_blockjob_common_drain_node(enum drain_type drain_type, tjob = block_job_create("job0", &test_job_driver, NULL, src, 0, BLK_PERM_ALL, 0, 0, NULL, NULL, &error_abort); + tjob->bs = src; job = &tjob->common; block_job_add_bdrv(job, "target", target, 0, BLK_PERM_ALL, &error_abort); @@ -1538,6 +1540,7 @@ typedef struct TestDropBackingBlockJob { bool should_complete; bool *did_complete; BlockDriverState *detach_also; + BlockDriverState *bs; } TestDropBackingBlockJob; static int coroutine_fn test_drop_backing_job_run(Job *job, Error **errp) @@ -1557,7 +1560,7 @@ static void test_drop_backing_job_commit(Job *job) TestDropBackingBlockJob *s = container_of(job, TestDropBackingBlockJob, common.job); - bdrv_set_backing_hd(blk_bs(s->common.blk), NULL, &error_abort); + bdrv_set_backing_hd(s->bs, NULL, &error_abort); bdrv_set_backing_hd(s->detach_also, NULL, &error_abort); *s->did_complete = true; @@ -1657,6 +1660,7 @@ static void test_blockjob_commit_by_drained_end(void) job = block_job_create("job", &test_drop_backing_job_driver, NULL, bs_parents[2], 0, BLK_PERM_ALL, 0, 0, NULL, NULL, &error_abort); + job->bs = bs_parents[2]; job->detach_also = bs_parents[0]; job->did_complete = &job_has_completed; From patchwork Fri Dec 24 15:35:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12699060 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 75F09C433F5 for ; Fri, 24 Dec 2021 15:44:12 +0000 (UTC) Received: from localhost ([::1]:33184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0mjr-0006x7-GG for qemu-devel@archiver.kernel.org; Fri, 24 Dec 2021 10:44:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0mcM-0005uJ-19; Fri, 24 Dec 2021 10:36:26 -0500 Received: from [2a01:111:f400:fe07::712] (port=55270 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0mcK-0000YV-55; Fri, 24 Dec 2021 10:36:25 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eIokFDXTb7VzqbAdrLKDSFJNrE86WfnRZZaXT1JSFO/6gXNpTKWNqi+Wj+YpNKMtNGgDZOgGWWseFnjDFwke8542WUU83qIojgcmtTDSd+1EsZcid0Ay8J8vmwzSiXAuRfhWZ2EUX+KW6e2BocqeL8YwBzlqKFB2zgf/D9wvZYc8qpUR5DAjd6GIscWSoCv6WrEJ/C0qjKBf3kzKmMVF6X6yICTtMSFoZhu0Kpoo3gdwEv5gph+rVr6C18v5JwsQ9YrFVbAAr5TBkf+4Mgsyncal4UzHRkSYSJgN7IxTSf1yUdG6BIsG82eWLowMdqu77vr+yZefPZbqMoJZ9KMpog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=D85/jZ/aN1MPawxs3SdddkYdMY3MUdWHqyN6OmJNi4w=; b=n+Q2bTVc9VF1e0FZtgiuSMPIZEQULPx9xuUoTRCEzde+MEBlYQGzjXxE4GCv49a07fpWuS45wfU+AUZ8O8RQE84VcBH01FGR817oP3lI06cTuQ6Yx06gCb/ABry/RUjbGg9SIRFJGXm3rhTJlbAWlpD+GWr4RO0eKlCbuGLXg3hM9LedvIBikBBisaJr+JS8l8u9yJOVUvBD/XhKsSov4GwZblGFXaGdMhccRihFgjxm2JNStU2nMbN0zvXt1/gLtNleipft71gA2wY7oEeBDtUk/HHqoGhVwRC1xaQe3akEOkWWyfjf/4BVuZhCoxElLH/IDKKMNdWCWghgQHdz4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D85/jZ/aN1MPawxs3SdddkYdMY3MUdWHqyN6OmJNi4w=; b=aLCU7Z4MVHtL5w2CumQHQVHcm6L+AtCrMKLB4fdMVYJ7v4bCYPSaVmthWn0E6NRiUOQeiiLqYJDANmP2uB2VbTOyIRhtBdGxwQrvOICzw5ETe8Uvk+FtSxzT3herUxSWqaorRV7OnCz36j7vfbKnAPZLJ7/Rxuqmt/QATpJxLpc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB3955.eurprd08.prod.outlook.com (2603:10a6:208:12d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.19; Fri, 24 Dec 2021 15:36:18 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112%5]) with mapi id 15.20.4823.021; Fri, 24 Dec 2021 15:36:17 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, nikita.lapshin@virtuozzo.com Subject: [PATCH v2 5/5] blockjob: drop BlockJob.blk field Date: Fri, 24 Dec 2021 16:35:52 +0100 Message-Id: <20211224153552.2086061-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211224153552.2086061-1-vsementsov@virtuozzo.com> References: <20211224153552.2086061-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM5PR1001CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:2::28) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 556b332b-1943-46b5-305b-08d9c6f320bb X-MS-TrafficTypeDiagnostic: AM0PR08MB3955:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y3nf4L9VIsCsWvVngJm2mkfBq2SmonLNvS7ZCOmWOtL7JPmc6u54spdNq7UwwG1C/vV+/wk+Au3RsPu107z3pG81KwbhJwk1OFfXMnVmOlkRx3G/2aVf4N9OmKQQV0l0UyCzikRW0bd/EkmyLt4yXT9sMnmE52K5Y4N3NAIAhINqu9CUYNw2hIKishjddDvTTMQ/grFcbcAt4k6L+3a0uBNLwBmn0vKq/oi6OJE3l8RWlJ6BQ1GkFp7eJ17np3cG9Yorysx8BC13AsXCTpWUB0Z+tbpXMcRU/3m/Y5uLw7PaZ8cPk/gTNkoDFr6gme5qMZTdFL6zZJ5+X/qs8cCqvHHJkARNxUbixRJWFJOW3XmOc7uwB1BC4k97Hb7z0jvuZ0iPY6sJL8pCsWnxvmB4BjxSHh4FRPPB29dX0+z/n8VxmBFhXKLCyldLPYTik0OYHaMtTZG6gkhA6eiTJK8pbg+ZLz3QIoJcUcDoB3J93ZohTgjitM2M+TPwDWR+gmr4z+VozEwgAbUXDf/Sy45uLLs4JyF7hr/Am3gtEVFvm/RPk1w1GMftfx4DUWPPizU7QVhQpZw6Ih7IXb9hslkOT+b8CntdtoAyZlqjhNxFihVi1xQ4LHT6k8QYcmbW33TpH5qqSGlKECgl9hruL98s2Ibr8XxfHA45/cYBEySOM7ZVYePomlY6m+mGX3msOKDrs0FGWJ55ErwUKoymeuHEHg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6666004)(4326008)(508600001)(86362001)(2906002)(107886003)(66476007)(26005)(186003)(6506007)(66556008)(2616005)(38350700002)(38100700002)(83380400001)(66946007)(36756003)(6512007)(52116002)(316002)(8676002)(1076003)(6916009)(6486002)(8936002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OKtaKhEzzJ3rsODlQQg/xIRKA7vcp0P/C9HQbyhjneaxGu6wiYlr40T7846xLIwS/XrqwNgURd+eARqMXYzr4RF2ofvtGI2U95sFwmA3gFTMIg/LjqHAiuXDMIYpCjLqSUW/dOZt40zcPCGllHl84/uB0/e/hR/9Yu9NODNwVIs/sIP0PNE0Go37BGdv/pOz9ZW2rOGwg4lsfEQoOFlacaguSZTfJ5P0GodDbHui+VnvXbiXUR9NC7e57vQ96p+7lWUl5bi78+kG2NnEpTHqUl4JItu8aHaKfpNU1qeMdkrejKS3ZPCIsg5JNuNlyl0o36vsU9yeRF39H4O5Z/sS5TGxvrZ1HqpJ49dR0ClZpQH42RSg94g0fOA6vGdMwmnDGRwb/1e8RIaDyLxRfzeA8YJzeYLZmqyBgmAOF8/XATWHnGFLsCdRdUvd7zchQrn5D+QCctwUTM+HD+WZfADYvdRARWs5SJnBft0hwX3LZ/HKVJ5JDy2VbueFf0MhIjnOakhvCLgYK4HPZCXy+g5vAfQalv8419BZXFrFbixKiDGLvgiEiW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ya93QfikNKkWChwdu8c/huhgdYSSlTbsEbTrBM0uz3LQXvI5H+dp1M5pCebkmqmbBMhmI= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 556b332b-1943-46b5-305b-08d9c6f320bb X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2021 15:36:17.9220 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bMh8zcIDNniONHQ3QfgRzV/Gr1UqV+9UwcRZT6D17qy5Fi8zkjPNh08PPN9wGS0ugM99AjVkTjNpNgnBfQn3A2ri+H12LG7M8mWyusAHZ/E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3955 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:fe07::712 (failed) Received-SPF: pass client-ip=2a01:111:f400:fe07::712; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" It's unused now (except for permission handling)[*]. The only reasonable user of it was block-stream job, recently updated to use own blk. And other block jobs prefer to use own source node related objects. So, the arguments of dropping the field are: - block jobs prefer not to use it - block jobs usually has more then one node to operate on, and better to operate symmetrically (for example has both source and target blk's in specific block-job state structure) *: BlockJob.blk is used to keep some permissions. We simply move permissions to block-job child created in block_job_create() together with blk. In mirror, we just should not care anymore about restoring state of blk. Most probably this code could be dropped long ago, after dropping bs->job pointer. Now it finally goes away together with BlockJob.blk itself. iotest 141 output is updated, as "bdrv_has_blk(bs)" check in qmp_blockdev_del() doesn't fail (we don't have blk now). Still, new error message looks even better. In iotest 283 we need to add a job id, otherwise "Invalid job ID" happens now earlier than permission check (as permissions moved from blk to block-job node). Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/blockjob.h | 3 --- block/mirror.c | 7 ------- blockjob.c | 31 ++++++++++++------------------- tests/qemu-iotests/141.out | 2 +- tests/qemu-iotests/283 | 3 ++- tests/qemu-iotests/283.out | 2 +- 6 files changed, 16 insertions(+), 32 deletions(-) diff --git a/include/block/blockjob.h b/include/block/blockjob.h index 3b84805140..87fbb3985f 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -43,9 +43,6 @@ typedef struct BlockJob { /** Data belonging to the generic Job infrastructure */ Job job; - /** The block device on which the job is operating. */ - BlockBackend *blk; - /** Status that is published by the query-block-jobs QMP API */ BlockDeviceIoStatus iostatus; diff --git a/block/mirror.c b/block/mirror.c index efec2c7674..959e3dfbd6 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -771,13 +771,6 @@ static int mirror_exit_common(Job *job) block_job_remove_all_bdrv(bjob); bdrv_replace_node(mirror_top_bs, mirror_top_bs->backing->bs, &error_abort); - /* We just changed the BDS the job BB refers to (with either or both of the - * bdrv_replace_node() calls), so switch the BB back so the cleanup does - * the right thing. We don't need any permissions any more now. */ - blk_remove_bs(bjob->blk); - blk_set_perm(bjob->blk, 0, BLK_PERM_ALL, &error_abort); - blk_insert_bs(bjob->blk, mirror_top_bs, &error_abort); - bs_opaque->job = NULL; bdrv_drained_end(src); diff --git a/blockjob.c b/blockjob.c index 70bc3105a6..10815a89fe 100644 --- a/blockjob.c +++ b/blockjob.c @@ -86,7 +86,6 @@ void block_job_free(Job *job) BlockJob *bjob = container_of(job, BlockJob, job); block_job_remove_all_bdrv(bjob); - blk_unref(bjob->blk); ratelimit_destroy(&bjob->limit); error_free(bjob->blocker); } @@ -433,22 +432,16 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver, uint64_t shared_perm, int64_t speed, int flags, BlockCompletionFunc *cb, void *opaque, Error **errp) { - BlockBackend *blk; BlockJob *job; + int ret; if (job_id == NULL && !(flags & JOB_INTERNAL)) { job_id = bdrv_get_device_name(bs); } - blk = blk_new_with_bs(bs, perm, shared_perm, errp); - if (!blk) { - return NULL; - } - - job = job_create(job_id, &driver->job_driver, txn, blk_get_aio_context(blk), + job = job_create(job_id, &driver->job_driver, txn, bdrv_get_aio_context(bs), flags, cb, opaque, errp); if (job == NULL) { - blk_unref(blk); return NULL; } @@ -458,8 +451,6 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver, ratelimit_init(&job->limit); - job->blk = blk; - job->finalize_cancelled_notifier.notify = block_job_event_cancelled; job->finalize_completed_notifier.notify = block_job_event_completed; job->pending_notifier.notify = block_job_event_pending; @@ -476,21 +467,23 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver, error_setg(&job->blocker, "block device is in use by block job: %s", job_type_str(&job->job)); - block_job_add_bdrv(job, "main node", bs, 0, BLK_PERM_ALL, &error_abort); + + ret = block_job_add_bdrv(job, "main node", bs, perm, shared_perm, errp); + if (ret < 0) { + goto fail; + } bdrv_op_unblock(bs, BLOCK_OP_TYPE_DATAPLANE, job->blocker); - /* Disable request queuing in the BlockBackend to avoid deadlocks on drain: - * The job reports that it's busy until it reaches a pause point. */ - blk_set_disable_request_queuing(blk, true); - blk_set_allow_aio_context_change(blk, true); - if (!block_job_set_speed(job, speed, errp)) { - job_early_fail(&job->job); - return NULL; + goto fail; } return job; + +fail: + job_early_fail(&job->job); + return NULL; } void block_job_iostatus_reset(BlockJob *job) diff --git a/tests/qemu-iotests/141.out b/tests/qemu-iotests/141.out index c4c15fb275..63203d9944 100644 --- a/tests/qemu-iotests/141.out +++ b/tests/qemu-iotests/141.out @@ -132,7 +132,7 @@ wrote 1048576/1048576 bytes at offset 0 {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}} {'execute': 'blockdev-del', 'arguments': {'node-name': 'drv0'}} -{"error": {"class": "GenericError", "desc": "Node drv0 is in use"}} +{"error": {"class": "GenericError", "desc": "Node 'drv0' is busy: block device is in use by block job: commit"}} {'execute': 'block-job-cancel', 'arguments': {'device': 'job0'}} {"return": {}} diff --git a/tests/qemu-iotests/283 b/tests/qemu-iotests/283 index a09e0183ae..5defe48e97 100755 --- a/tests/qemu-iotests/283 +++ b/tests/qemu-iotests/283 @@ -93,7 +93,8 @@ vm.qmp_log('blockdev-add', **{ 'take-child-perms': ['write'] }) -vm.qmp_log('blockdev-backup', sync='full', device='source', target='target') +vm.qmp_log('blockdev-backup', sync='full', device='source', target='target', + job_id="backup0") vm.shutdown() diff --git a/tests/qemu-iotests/283.out b/tests/qemu-iotests/283.out index 5bb75952ef..5e4f456db5 100644 --- a/tests/qemu-iotests/283.out +++ b/tests/qemu-iotests/283.out @@ -4,7 +4,7 @@ {"return": {}} {"execute": "blockdev-add", "arguments": {"driver": "blkdebug", "image": "base", "node-name": "other", "take-child-perms": ["write"]}} {"return": {}} -{"execute": "blockdev-backup", "arguments": {"device": "source", "sync": "full", "target": "target"}} +{"execute": "blockdev-backup", "arguments": {"device": "source", "job-id": "backup0", "sync": "full", "target": "target"}} {"error": {"class": "GenericError", "desc": "Permission conflict on node 'base': permissions 'write' are both required by node 'other' (uses node 'base' as 'image' child) and unshared by node 'source' (uses node 'base' as 'image' child)."}} === copy-before-write filter should be gone after job-finalize ===