From nobody Wed Apr 16 08:23:10 2025 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558369826; cv=none; d=zoho.com; s=zohoarc; b=d23/QsfusSA9Pe+pclXZePg0eB9nCu7pFn6PnmhGh5jkZVD0CC5zlKEzKeUt9wD5vgOW4BgTYpiL5m9NkfqGeayLe5a8g+LtrL2qL96DNXbOupS1U5sHWIP9AZy9hgpdGtIeGC81pFRpVfKxXynCdgVd72ZlfZQewpS7W2jLPUk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558369826; 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=n7wrukB4ek+8F8RrSmi2KRDVQCpOe53V5/N1Ogmurwg=; b=G0yghUQra86OTkDx7P/fEYv6bNypA5Z21DkoqEbwR4L992iMUVh6rAJdsAw9AXz825njHYuC0zarIELBP0Qb2nFcPCfPqrKjwRILQIQD05blciFlYjbh66HjXCKQbBTy3LjjWpL8UlXdFaKfg8cM/8hbvuLykFi8wnGX5IT+5AI= 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558369826805725.5402164558625; Mon, 20 May 2019 09:30:26 -0700 (PDT) Received: from localhost ([127.0.0.1]:38217 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSlAt-0004EG-7R for importer@patchew.org; Mon, 20 May 2019 12:30:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSkwu-0008Js-Gu for qemu-devel@nongnu.org; Mon, 20 May 2019 12:15:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSkwt-0003ba-Jx for qemu-devel@nongnu.org; Mon, 20 May 2019 12:15:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45868) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSkwr-0003ZO-CL; Mon, 20 May 2019 12:15:37 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A691985365; Mon, 20 May 2019 16:15:31 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-208.ams2.redhat.com [10.36.117.208]) by smtp.corp.redhat.com (Postfix) with ESMTP id BDD4D601A0; Mon, 20 May 2019 16:15:28 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 20 May 2019 18:14:42 +0200 Message-Id: <20190520161453.30723-14-kwolf@redhat.com> In-Reply-To: <20190520161453.30723-1-kwolf@redhat.com> References: <20190520161453.30723-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 20 May 2019 16:15:36 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 13/24] block: Add blk_set_allow_aio_context_change() 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, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Some users (like block jobs) can tolerate an AioContext change for their BlockBackend. Add a function that tells the BlockBackend that it can allow changes. Signed-off-by: Kevin Wolf --- include/sysemu/block-backend.h | 1 + block/block-backend.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 5be6224226..938de34fe9 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -103,6 +103,7 @@ int blk_set_perm(BlockBackend *blk, uint64_t perm, uint= 64_t shared_perm, void blk_get_perm(BlockBackend *blk, uint64_t *perm, uint64_t *shared_perm= ); =20 void blk_set_allow_write_beyond_eof(BlockBackend *blk, bool allow); +void blk_set_allow_aio_context_change(BlockBackend *blk, bool allow); void blk_iostatus_enable(BlockBackend *blk); bool blk_iostatus_is_enabled(const BlockBackend *blk); BlockDeviceIoStatus blk_iostatus(const BlockBackend *blk); diff --git a/block/block-backend.c b/block/block-backend.c index 0e75fc8849..4c0a8ef88d 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -71,6 +71,7 @@ struct BlockBackend { uint64_t shared_perm; bool disable_perm; =20 + bool allow_aio_context_change; bool allow_write_beyond_eof; =20 NotifierList remove_bs_notifiers, insert_bs_notifiers; @@ -1092,6 +1093,11 @@ void blk_set_allow_write_beyond_eof(BlockBackend *bl= k, bool allow) blk->allow_write_beyond_eof =3D allow; } =20 +void blk_set_allow_aio_context_change(BlockBackend *blk, bool allow) +{ + blk->allow_aio_context_change =3D allow; +} + static int blk_check_byte_request(BlockBackend *blk, int64_t offset, size_t size) { @@ -1891,6 +1897,10 @@ static bool blk_root_can_set_aio_ctx(BdrvChild *chil= d, AioContext *ctx, { BlockBackend *blk =3D child->opaque; =20 + if (blk->allow_aio_context_change) { + return true; + } + /* Only manually created BlockBackends that are not attached to anythi= ng * can change their AioContext without updating their user. */ if (!blk->name || blk->dev) { --=20 2.20.1