From nobody Thu Nov 13 21:51:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1582707857; cv=none; d=zohomail.com; s=zohoarc; b=Y15OF6d5oqC+gNdlhmacDKN+lHKlUIHmpLEwlKrcG/1XxSNs4EbF3DaSBMUANkvsxylYE46JCHzN/X4kP7F0kLT/QCaS5sbEjr0tzYFHnzd/YYkaIHo0o7kkey/oSm+yZhbheJWUzwj1mO8BTNxLsiUi1mYL99FQ3ppD/cuBRH4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582707857; h=Content-Type: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; bh=xPFSbvv+WtlOtVos+MhqgsZmGBHXKy1YKRq49wrdV60=; b=dEcGf4WXYSX9f874iAo51n7ovGY5iHl5qtwDBxQsbNpzenySqXLqRrh4ycIqbAhpXOu8QRzoLWcGBIPIeGd/rc05JgBvHDxPTWiAJfq6Evsi0WFYtTnbiaLcuJvBNYkMkoRXw1736trkmJZAcKYacONX8QgyJOBTGc+lHhjEDs0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass 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 15827078574751001.1282801974075; Wed, 26 Feb 2020 01:04:17 -0800 (PST) Received: from localhost ([::1]:40380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6sc4-0000UA-Ck for importer@patchew.org; Wed, 26 Feb 2020 04:04:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56336) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6sZZ-0005X7-OL for qemu-devel@nongnu.org; Wed, 26 Feb 2020 04:01:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6sZY-0000t8-6w for qemu-devel@nongnu.org; Wed, 26 Feb 2020 04:01:41 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:48199 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6sZX-0000qv-KF for qemu-devel@nongnu.org; Wed, 26 Feb 2020 04:01:40 -0500 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-487-1s_cYTbVObiusI3zuO2AKQ-1; Wed, 26 Feb 2020 04:01:35 -0500 Received: by mail-qt1-f200.google.com with SMTP id p12so3555212qtu.6 for ; Wed, 26 Feb 2020 01:01:35 -0800 (PST) Received: from redhat.com (bzq-79-178-2-214.red.bezeqint.net. [79.178.2.214]) by smtp.gmail.com with ESMTPSA id p92sm761089qtd.14.2020.02.26.01.01.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 01:01:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582707698; 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=xPFSbvv+WtlOtVos+MhqgsZmGBHXKy1YKRq49wrdV60=; b=OasY3/Mdne+3f1AZSefh+zf3wNkW6D2snlCiI+p9P8q1ReAZs+ervIuB1X+lUJ+Yqa2pvj D2rCyPruOmSqxMozg43uVe66BE/Zu7NojswOE1IBKHL8mfZonsaD7VJOMgVdQzy6I/j8kk lwPGXDDbopFuA82iMjH1Tb6pqv2QuuI= X-MC-Unique: 1s_cYTbVObiusI3zuO2AKQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=X4na6KqmQ3c2V2WTi8kzbZFz4B5BaLaZ+cwVHA5c1dA=; b=Pm6/8fA37/8/uhbtnqrBmCwd6rANBrttRKIF5frK7PVOIR8FgwpkSJ0r4dnwcZgdBS JlCojUN/g/i/eXbHu88MXffN/5IBYn+y1e53k+9lPV6JXOOiYQ7/5kOTyj/EhzKhYxgU BW7RAxObBOdda+cyLLOVdnxZM07wPy6BvUlq/SA1DixFOthEaf6JuKdo2ILfvLRD2I1f oSs9NkUh1sONgAnaSz1w72Eqy7q7z4gRgLsOSOzOY317HxMSexRJY6hlfIr4CmuGlCZu d0PM8fPklbJTdQ2XzetV9bejKjXQQrsvl9lbmd/MaEsuh744ZTpVkM7gHxvzfKL1CnOp l8SA== X-Gm-Message-State: APjAAAVjw88nP2pcWJuE+phjooKJPtpLQSiDgGB4br7wnieZ80/lgxCv GAbFAckNEvXVoACEz6phEZi2VUT4QF7C0zJ3+UBg6OuuKwvy/4M3uz6pDJyxre1R/54NiJXP30U I6OEhAhx5XSwlTY8= X-Received: by 2002:a05:6214:80c:: with SMTP id df12mr3571508qvb.113.1582707694178; Wed, 26 Feb 2020 01:01:34 -0800 (PST) X-Google-Smtp-Source: APXvYqx6fPChg4JbTeTA0Ws6bzvfswW6xwg4hclUgDRtPlfb5OkUxbu2g1qYYlg2cPkroG4Xeum+Xw== X-Received: by 2002:a05:6214:80c:: with SMTP id df12mr3571488qvb.113.1582707693866; Wed, 26 Feb 2020 01:01:33 -0800 (PST) Date: Wed, 26 Feb 2020 04:01:29 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 06/30] vhost-user-fs: convert to the new virtio_delete_queue function Message-ID: <20200226090010.708934-7-mst@redhat.com> References: <20200226090010.708934-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200226090010.708934-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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: Peter Maydell , Pan Nengyuan , "Dr. David Alan Gilbert" , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Pan Nengyuan use the new virtio_delete_queue function to cleanup. Signed-off-by: Pan Nengyuan Cc: "Dr. David Alan Gilbert" Cc: Stefan Hajnoczi Message-Id: <20200225075554.10835-3-pannengyuan@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-user-fs.h | 2 ++ hw/virtio/vhost-user-fs.c | 15 +++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/hw/virtio/vhost-user-fs.h b/include/hw/virtio/vhost-us= er-fs.h index 9ff1bdb7cf..6f3030d288 100644 --- a/include/hw/virtio/vhost-user-fs.h +++ b/include/hw/virtio/vhost-user-fs.h @@ -37,6 +37,8 @@ typedef struct { struct vhost_virtqueue *vhost_vqs; struct vhost_dev vhost_dev; VhostUserState vhost_user; + VirtQueue **req_vqs; + VirtQueue *hiprio_vq; =20 /*< public >*/ } VHostUserFS; diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c index 4554d123b7..6136768875 100644 --- a/hw/virtio/vhost-user-fs.c +++ b/hw/virtio/vhost-user-fs.c @@ -209,11 +209,12 @@ static void vuf_device_realize(DeviceState *dev, Erro= r **errp) sizeof(struct virtio_fs_config)); =20 /* Hiprio queue */ - virtio_add_queue(vdev, fs->conf.queue_size, vuf_handle_output); + fs->hiprio_vq =3D virtio_add_queue(vdev, fs->conf.queue_size, vuf_hand= le_output); =20 /* Request queues */ + fs->req_vqs =3D g_new(VirtQueue *, fs->conf.num_request_queues); for (i =3D 0; i < fs->conf.num_request_queues; i++) { - virtio_add_queue(vdev, fs->conf.queue_size, vuf_handle_output); + fs->req_vqs[i] =3D virtio_add_queue(vdev, fs->conf.queue_size, vuf= _handle_output); } =20 /* 1 high prio queue, plus the number configured */ @@ -230,10 +231,11 @@ static void vuf_device_realize(DeviceState *dev, Erro= r **errp) =20 err_virtio: vhost_user_cleanup(&fs->vhost_user); - virtio_del_queue(vdev, 0); + virtio_delete_queue(fs->hiprio_vq); for (i =3D 0; i < fs->conf.num_request_queues; i++) { - virtio_del_queue(vdev, i + 1); + virtio_delete_queue(fs->req_vqs[i]); } + g_free(fs->req_vqs); virtio_cleanup(vdev); g_free(fs->vhost_dev.vqs); return; @@ -252,10 +254,11 @@ static void vuf_device_unrealize(DeviceState *dev, Er= ror **errp) =20 vhost_user_cleanup(&fs->vhost_user); =20 - virtio_del_queue(vdev, 0); + virtio_delete_queue(fs->hiprio_vq); for (i =3D 0; i < fs->conf.num_request_queues; i++) { - virtio_del_queue(vdev, i + 1); + virtio_delete_queue(fs->req_vqs[i]); } + g_free(fs->req_vqs); virtio_cleanup(vdev); g_free(fs->vhost_dev.vqs); fs->vhost_dev.vqs =3D NULL; --=20 MST