Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1456910ybe; Thu, 5 Sep 2019 16:04:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwei1BWlWelcpiLg+6phiKuPwlnfPpuOfk7JiD/G+7TA+FIfv+1ZPBC/Y7gJ4UJNJOqM0HR X-Received: by 2002:a63:f04:: with SMTP id e4mr5232532pgl.38.1567724640845; Thu, 05 Sep 2019 16:04:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567724640; cv=none; d=google.com; s=arc-20160816; b=QpyMlGHzAQMCadk5S9AOZdluKf+7EaZbjqxjdE7nzdUIOhxKnhNUshfYE0j/BTrpfh 2farv0e2k2e7+gZrFgaNY/+srnkR83yc0AAO/heQXjsKWLOQoI/4rsmvFzR++6mJykw/ p6PC+31SYxK8dOhINOKyNhzH++FgGQk0Fh+9mugBAwOmaeFRX1olj6c81KRVP26Bnw/P qUeYZzR2IA7gkZvLaaHgjwS2xCmnekw38TejWLfOJkW02aQOOdmgIb5eiIGytuDb4AJE VW/BGxMNgyWhJ6sUc6StwuZzabP41wDWqz6RKrWwH6XoT7OlPZBAPu/W9DIWMtQEtb2w QRlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=M9mB7R/xQXympKpfjNs1I6isj3EpTEVORN+PkmeTbsY=; b=LDveAYkxoSsGJ7AUEGfC7xiWtHUeOtbvSwqmg7C1riBftu1ZRfWpi9FvrSt3qQPlzJ L7wTofvRIP79YmUrhPNN47vWuTeyKpBiqI/dN64cVO7GGbaDEMDviMq6jJNy2dJJr9x1 uDZpjg3QrM9DO4cgkr07HpHVivhS19WXXPKVlWwv6olwNMM2Lqy7dIOhWX6Rl9YWTjyW +usnBtorEgo7zUa0oj/T6lG02xUpoETwfGb3+95qoFMM9SqGm3BiME7pS/n1m3zz1uMU BentJr0Ig8t0IDVOzDMuFYiw5QMG9RXjRhWI/JmUFQ3PLVQkfFmwSwJ9mbw0PRWSNu20 fNxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y70si3675216pfg.184.2019.09.05.16.03.45; Thu, 05 Sep 2019 16:04:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388626AbfIETt2 (ORCPT + 99 others); Thu, 5 Sep 2019 15:49:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45520 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732717AbfIETt0 (ORCPT ); Thu, 5 Sep 2019 15:49:26 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 554507EB88; Thu, 5 Sep 2019 19:49:26 +0000 (UTC) Received: from horse.redhat.com (unknown [10.18.25.137]) by smtp.corp.redhat.com (Postfix) with ESMTP id 400FF5D6A3; Thu, 5 Sep 2019 19:49:18 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id C87AA22539B; Thu, 5 Sep 2019 15:49:17 -0400 (EDT) From: Vivek Goyal To: linux-fsdevel@vger.kernel.org, virtualization@lists.linux-foundation.org, miklos@szeredi.hu Cc: linux-kernel@vger.kernel.org, virtio-fs@redhat.com, vgoyal@redhat.com, stefanha@redhat.com, dgilbert@redhat.com, mst@redhat.com Subject: [PATCH 03/18] virtiofs: Pass fsvq instead of vq as parameter to virtio_fs_enqueue_req Date: Thu, 5 Sep 2019 15:48:44 -0400 Message-Id: <20190905194859.16219-4-vgoyal@redhat.com> In-Reply-To: <20190905194859.16219-1-vgoyal@redhat.com> References: <20190905194859.16219-1-vgoyal@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.71]); Thu, 05 Sep 2019 19:49:26 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pass fsvq instead of vq as parameter to virtio_fs_enqueue_req(). We will retrieve vq from fsvq under spin lock. Later in the patch series we will retrieve vq only if fsvq is still connected other vq might have been cleaned up by device ->remove code and we will return error. Signed-off-by: Vivek Goyal --- fs/fuse/virtio_fs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c index e9497b565dd8..9d30530e3ca9 100644 --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -698,14 +698,15 @@ static unsigned int sg_init_fuse_args(struct scatterlist *sg, } /* Add a request to a virtqueue and kick the device */ -static int virtio_fs_enqueue_req(struct virtqueue *vq, struct fuse_req *req) +static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq, + struct fuse_req *req) { /* requests need at least 4 elements */ struct scatterlist *stack_sgs[6]; struct scatterlist stack_sg[ARRAY_SIZE(stack_sgs)]; struct scatterlist **sgs = stack_sgs; struct scatterlist *sg = stack_sg; - struct virtio_fs_vq *fsvq; + struct virtqueue *vq; unsigned int argbuf_used = 0; unsigned int out_sgs = 0; unsigned int in_sgs = 0; @@ -752,9 +753,9 @@ static int virtio_fs_enqueue_req(struct virtqueue *vq, struct fuse_req *req) for (i = 0; i < total_sgs; i++) sgs[i] = &sg[i]; - fsvq = vq_to_fsvq(vq); spin_lock(&fsvq->lock); + vq = fsvq->vq; ret = virtqueue_add_sgs(vq, sgs, out_sgs, in_sgs, req, GFP_ATOMIC); if (ret < 0) { /* TODO handle full virtqueue */ @@ -824,7 +825,7 @@ __releases(fiq->waitq.lock) /* TODO check for FR_INTERRUPTED? */ retry: - ret = virtio_fs_enqueue_req(fs->vqs[queue_id].vq, req); + ret = virtio_fs_enqueue_req(&fs->vqs[queue_id], req); if (ret < 0) { if (ret == -ENOMEM || ret == -ENOSPC) { /* Virtqueue full. Retry submission */ -- 2.20.1