From nobody Mon Feb 9 11:32:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599136152; cv=none; d=zohomail.com; s=zohoarc; b=CTlAY22ncGeuLSVCRf6Cq0VCWkbp2b2AM57hC2bunpXd2RGWR+DqqTcIfRxmz5kSSTqisBnjD1XUeuX/jJbBO5x4RdTAbgTiKjT4/pKuzzePf+f7tAKNNuy/lPZKBR6bT9MpOPxYhB250eGjOkWCQUHPd+ooOjvxK2jnthH9vEI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599136152; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=x5/xQskK0Ke2FAX64uYiLcx+1Sf83WT/CYfOUHG+VA0=; b=GvOo0/qRzpS3s4+O+1x489Fv6j5JHnGA7NAEUiyrMptK/pifwdX1hsYYtO75uVPlWYH5EnfvETy6kk7XGguBitq8hsSyDaSJc5MtUQ1SagAavFg0wTl6AgAvHsWuyKMAd43KaEKyDsFtLHk5nBpOhlVH2Plsv8vCOUMWCNnaaug= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1599136152521969.7711744857386; Thu, 3 Sep 2020 05:29:12 -0700 (PDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-362-IhrEWrR0OA25wpHumsdrig-1; Thu, 03 Sep 2020 08:29:10 -0400 Received: by mail-wr1-f70.google.com with SMTP id m7so1009121wrb.20 for ; Thu, 03 Sep 2020 05:29:10 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (50.red-83-52-54.dynamicip.rima-tde.net. [83.52.54.50]) by smtp.gmail.com with ESMTPSA id f17sm4442865wru.13.2020.09.03.05.29.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2020 05:29:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599136151; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x5/xQskK0Ke2FAX64uYiLcx+1Sf83WT/CYfOUHG+VA0=; b=ItSOUFUpyVZDtg+PuPZTdcCU/nbuuqp92CddQpK31/jWLgH3zVOox0BwKNuOCVn33W8Y+y Zpw/L7WHQVPmHwpsTiPtw0Z5PUFMDTpkRCuQuwU0YeRimmvJiUnjAk3he4LZn/Yys/ML93 8LPCFxuCLHcyGWA+gd/NF9UcaR0aJW4= X-MC-Unique: IhrEWrR0OA25wpHumsdrig-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x5/xQskK0Ke2FAX64uYiLcx+1Sf83WT/CYfOUHG+VA0=; b=raroQVwPDLUrJHBR9VkR1+MD0G67D6QTyZ/rj1xrSPXjCTjhMs4fwucg4VOlQC5v1x XP8gnOOyhDXq/kiRzqsN5wq2Im4rVCH0oMzlg+S7t534N52F7DS3dvkYqb26ZbhfV8al u8h6lOTKvbUKMKVRuTaxJ+GCceRaF6eAsBuxtszYFQPzH55m9A6po0d6xMWdgd7E1lVU begwdWZQwlRmughWghuv67cDcD5nwPjTVnbas8R2peHnbTgwDdGHkYtqLP70+BGZ1XgS YLyCoFC1RYKY8S/KA7CHODfkcIuXfYVB8eJtjQHKXKHK1LxXF4+1d6pDGyfvGiAXzqWT gHCQ== X-Gm-Message-State: AOAM531im3EPiK4PVqdGmdz5eigUjtAyAbRtKv9ISbPUZrqiSwD9R3xb VdrpI73IFCJeINoslRXy5TBM4r4ckZEM0wFsp7j8mQLW9SEgvYuRv4dNFYnvvBnNLbEXJWvkXF7 /jiRq68OP39my0w== X-Received: by 2002:a7b:c84a:: with SMTP id c10mr2227570wml.139.1599136149185; Thu, 03 Sep 2020 05:29:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5NMKKDbITg75Dhbnj9Yb4GEJg7u7c/HGsjaFHbKZce9YPq+wSot8h//t4GqgNxa6X9ZnlFQ== X-Received: by 2002:a7b:c84a:: with SMTP id c10mr2227549wml.139.1599136149031; Thu, 03 Sep 2020 05:29:09 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Klaus Jensen , Fam Zheng , Max Reitz , Keith Busch , Kevin Wolf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Stefano Garzarella Subject: [PATCH v7 13/15] block/nvme: Simplify nvme_create_queue_pair() arguments Date: Thu, 3 Sep 2020 14:28:01 +0200 Message-Id: <20200903122803.405265-14-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200903122803.405265-1-philmd@redhat.com> References: <20200903122803.405265-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) nvme_create_queue_pair() doesn't require BlockDriverState anymore. Replace it by BDRVNVMeState and AioContext to simplify. Reviewed-by: Stefan Hajnoczi Reviewed-by: Stefano Garzarella Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index b03735129d3..914a3c4ab31 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -208,12 +208,12 @@ static void nvme_free_req_queue_cb(void *opaque) qemu_mutex_unlock(&q->lock); } =20 -static NVMeQueuePair *nvme_create_queue_pair(BlockDriverState *bs, +static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMeState *s, + AioContext *aio_context, int idx, int size, Error **errp) { int i, r; - BDRVNVMeState *s =3D bs->opaque; Error *local_err =3D NULL; NVMeQueuePair *q; uint64_t prp_list_iova; @@ -232,8 +232,7 @@ static NVMeQueuePair *nvme_create_queue_pair(BlockDrive= rState *bs, q->s =3D s; q->index =3D idx; qemu_co_queue_init(&q->free_req_queue); - q->completion_bh =3D aio_bh_new(bdrv_get_aio_context(bs), - nvme_process_completion_bh, q); + q->completion_bh =3D aio_bh_new(aio_context, nvme_process_completion_b= h, q); r =3D qemu_vfio_dma_map(s->vfio, q->prp_list_pages, s->page_size * NVME_NUM_REQS, false, &prp_list_iova); @@ -637,7 +636,8 @@ static bool nvme_add_io_queue(BlockDriverState *bs, Err= or **errp) NvmeCmd cmd; int queue_size =3D NVME_QUEUE_SIZE; =20 - q =3D nvme_create_queue_pair(bs, n, queue_size, errp); + q =3D nvme_create_queue_pair(s, bdrv_get_aio_context(bs), + n, queue_size, errp); if (!q) { return false; } @@ -683,6 +683,7 @@ static int nvme_init(BlockDriverState *bs, const char *= device, int namespace, Error **errp) { BDRVNVMeState *s =3D bs->opaque; + AioContext *aio_context =3D bdrv_get_aio_context(bs); int ret; uint64_t cap; uint64_t timeout_ms; @@ -743,7 +744,7 @@ static int nvme_init(BlockDriverState *bs, const char *= device, int namespace, =20 /* Set up admin queue. */ s->queues =3D g_new(NVMeQueuePair *, 1); - s->queues[INDEX_ADMIN] =3D nvme_create_queue_pair(bs, 0, + s->queues[INDEX_ADMIN] =3D nvme_create_queue_pair(s, aio_context, 0, NVME_QUEUE_SIZE, errp); if (!s->queues[INDEX_ADMIN]) { --=20 2.26.2