From nobody Mon Feb 9 08:41:44 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; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547477502986560.7490996230982; Mon, 14 Jan 2019 06:51:42 -0800 (PST) Received: from localhost ([127.0.0.1]:44861 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj3aX-00072g-QV for importer@patchew.org; Mon, 14 Jan 2019 09:51:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj3Ap-0001dR-Tt for qemu-devel@nongnu.org; Mon, 14 Jan 2019 09:25:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj3Ao-0008Vj-E6 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 09:25:07 -0500 Received: from fanzine.igalia.com ([91.117.99.155]:52456) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gj3Ao-0008LP-2a; Mon, 14 Jan 2019 09:25:06 -0500 Received: from [194.100.51.2] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1gj3AV-0002jS-UM; Mon, 14 Jan 2019 15:24:48 +0100 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1gj39z-000389-4G; Mon, 14 Jan 2019 16:24:15 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=2aMwKPnI9IS6rxkTuyf5yBvVNXJewJfksZj5pzl1vHY=; b=QujABnCb/XNr9Y2gbI+39yjouCaU8iNLREDw0eGVkVEUUWyBnYJv12qD5UxSHAqlG8OTwn1v+cnwL6fbSICgWc1f2/UkAVqkWWU78vxwoDULLSxo5WpC2YR3KsH+u2PsQsizo2cxqQ3vbC220Qs+ll+x5XKPhLTaUvhWceJVLlvCBmBD3I5LtHV/YRvONOaBCbwROIi5MyMCwvGDKKn3hO2ZorngiDWdC76/SuDdXsnJMcco4TeONfPemcD1RWNzvbVPIueocs/r2Ojmmjap668qutnX/NM2M4oV/HY8Ca4fmv++soTn2zzy8rimezHwJvE8/v7fuEk+UDdsm68LbA==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Mon, 14 Jan 2019 16:24:02 +0200 Message-Id: <8e40a9c26445563f719b4b89e0ed82ef1c8b50f1.1547475602.git.berto@igalia.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH v2 4/6] block: Acquire the AioContext in nvme_realize() 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: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Stefan Hajnoczi , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Alberto Garcia --- hw/block/nvme.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 7c8c63e8f5..72e94aff86 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1203,6 +1203,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error **= errp) { NvmeCtrl *n =3D NVME(pci_dev); NvmeIdCtrl *id =3D &n->id_ctrl; + AioContext *ctx; =20 int i; int64_t bs_size; @@ -1213,20 +1214,23 @@ static void nvme_realize(PCIDevice *pci_dev, Error = **errp) return; } =20 + ctx =3D blk_get_aio_context(n->conf.blk); + aio_context_acquire(ctx); + bs_size =3D blk_getlength(n->conf.blk); if (bs_size < 0) { error_setg(errp, "could not get backing file size"); - return; + goto out; } =20 if (!n->serial) { error_setg(errp, "serial property not set"); - return; + goto out; } blkconf_blocksizes(&n->conf); if (!blkconf_apply_backend_options(&n->conf, blk_is_read_only(n->conf.= blk), false, errp)) { - return; + goto out; } =20 pci_conf =3D pci_dev->config; @@ -1323,6 +1327,9 @@ static void nvme_realize(PCIDevice *pci_dev, Error **= errp) cpu_to_le64(n->ns_size >> id_ns->lbaf[NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas)].ds); } + +out: + aio_context_release(ctx); } =20 static void nvme_exit(PCIDevice *pci_dev) --=20 2.11.0