Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1862331ybe; Tue, 3 Sep 2019 04:45:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCFFcq1ia9N8oAaOS9p6J6HcP8qsQ1oXB5xY8ltpk893ZB8oiR93Y/IQJwbFlk7/wto62u X-Received: by 2002:a17:902:9a8b:: with SMTP id w11mr35563569plp.171.1567511156010; Tue, 03 Sep 2019 04:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567511156; cv=none; d=google.com; s=arc-20160816; b=l/C87byrFUw5whGHC0N8A63Gbw4LcJqXs35vALaWqbEs/b7jBdxkeepilSN4AAQlOC OfKJKtLqfXnwQ7HlnbKEm9qXbaSuoOamc4AJ0p6O0GbPn3dCkj9ZcCIx7CjzKquLbE0P FUOv2nMZM/oqQ5USFUO4SRTKkQjOYlFlI10Mc3vZdNUHq9tv0XoXAN0orelA4kBR8BYs /XqdbXE3xx0x4Cr+xRz2ieJoX9MIbGiCpY/ZIUvcjiXH92vQ/jSSu3KDpFjzY96RqjSK v6R+B8RvBv0906hWIsvqPYyVOMAM1G32EMe7gxVrfBFeG26p4aJX3qKqTsrS6ZkXT5Fm 7Yog== 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=mq6DklOvXBQpcnChGI+5PjZr8M6YoeohLU7OSViViJw=; b=tTbjE3gope5GPERHQYM7B4E1MSQEfN30ieJeB8GomH/mI+AYahvPKKhunEaif0Frkn fP61pbq/CACLRvsR6bLtYvJukcAPD5DSd+sFp8vZ1Zz58xFoaR+DIXy5EZgG7cRUp1uP GIYbQvCDwWvCGnSVvOE7XwNSqqmk24r67+TNxEhWgEW80WBknekwjdvRmf7hMXHFw36P KR4G1ADXLBtYAU3AT3np8v9fcyN8j5hfl3CvVu91H+F8FT9ke7fAergU2SkQ1o3Ti3Vl UuwZVN7WRn+i/pCD8XXWk0A8A1hkOOR0ycfFKiep7MUkRmskbWyuI+nQuGhtWT2JEtiV YL9Q== 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 c1si9333219pld.370.2019.09.03.04.45.40; Tue, 03 Sep 2019 04:45:56 -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 S1729090AbfICLmw (ORCPT + 99 others); Tue, 3 Sep 2019 07:42:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35540 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729052AbfICLmK (ORCPT ); Tue, 3 Sep 2019 07:42:10 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 16E004E4E6 for ; Tue, 3 Sep 2019 11:42:10 +0000 (UTC) Received: by mail-wr1-f71.google.com with SMTP id x12so1279300wrs.0 for ; Tue, 03 Sep 2019 04:42:10 -0700 (PDT) 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=mq6DklOvXBQpcnChGI+5PjZr8M6YoeohLU7OSViViJw=; b=Cv8EaQufo+Da/jhXnT8X8DCx6aP8guZPBL5OQ9PtHeBlT+8CGNX048V1iFdvzuICtk FxSt+XMa6Hah+QobDd5+xecTu++sf5jNCCCnwWH0Ok2jWf0WmKTdMkiHenyCO7WMmGNg hEG5QfBKukH+0IFDFlOrOl+Vy6MBUx4A1nqUJaYqdXBmYy2nKTSaiYWmB6EWROhZbwqr q+P/1hTRdrMe96DbeZmibB5z+vecTOq+jgrGqBT+CzyzrY/aFIMlg7YPpUWKm8ymS8dS rFwk2odbPu6Cx14VsT5CezePVjSVtMTUOrHY1D1sShLcA2Hu/Y4DmBdZzC31Qd07yMz+ gaNA== X-Gm-Message-State: APjAAAU1w8U2JFxK+V6jmYf9N/KPiA49odgL3CYttMMKXfe3QWjfHfhO 5+hDD95xC2KaM9mA5t1E2bMlUNNcu5CywhB6nRj9wv3Pw6liLejc9MKCFRJcpaI1402CN+M1VyD I82RyBaF8Ilr2enIuUYEUQGOv X-Received: by 2002:a1c:544e:: with SMTP id p14mr15475611wmi.72.1567510928431; Tue, 03 Sep 2019 04:42:08 -0700 (PDT) X-Received: by 2002:a1c:544e:: with SMTP id p14mr15475591wmi.72.1567510928273; Tue, 03 Sep 2019 04:42:08 -0700 (PDT) Received: from miu.piliscsaba.redhat.com (catv-212-96-48-140.catv.broadband.hu. [212.96.48.140]) by smtp.gmail.com with ESMTPSA id x6sm2087551wmf.38.2019.09.03.04.42.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 04:42:07 -0700 (PDT) From: Miklos Szeredi To: virtualization@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org Cc: Vivek Goyal , linux-kernel@vger.kernel.org, "Michael S. Tsirkin" , Stefan Hajnoczi , "Dr. David Alan Gilbert" Subject: [PATCH v4 08/16] fuse: export fuse_dequeue_forget() function Date: Tue, 3 Sep 2019 13:41:55 +0200 Message-Id: <20190903114203.8278-3-mszeredi@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190903113640.7984-1-mszeredi@redhat.com> References: <20190903113640.7984-1-mszeredi@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vivek Goyal File systems like virtio-fs need to do not have to play directly with forget list data structures. There is a helper function use that instead. Rename dequeue_forget() to fuse_dequeue_forget() and export it so that stacked filesystems can use it. Signed-off-by: Vivek Goyal Signed-off-by: Miklos Szeredi --- fs/fuse/dev.c | 13 +++++++------ fs/fuse/fuse_i.h | 4 ++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 167f476fbe16..c0c30a225e78 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -1185,9 +1185,9 @@ __releases(fiq->waitq.lock) return err ? err : reqsize; } -static struct fuse_forget_link *dequeue_forget(struct fuse_iqueue *fiq, - unsigned max, - unsigned *countp) +struct fuse_forget_link *fuse_dequeue_forget(struct fuse_iqueue *fiq, + unsigned int max, + unsigned int *countp) { struct fuse_forget_link *head = fiq->forget_list_head.next; struct fuse_forget_link **newhead = &head; @@ -1206,6 +1206,7 @@ static struct fuse_forget_link *dequeue_forget(struct fuse_iqueue *fiq, return head; } +EXPORT_SYMBOL(fuse_dequeue_forget); static int fuse_read_single_forget(struct fuse_iqueue *fiq, struct fuse_copy_state *cs, @@ -1213,7 +1214,7 @@ static int fuse_read_single_forget(struct fuse_iqueue *fiq, __releases(fiq->waitq.lock) { int err; - struct fuse_forget_link *forget = dequeue_forget(fiq, 1, NULL); + struct fuse_forget_link *forget = fuse_dequeue_forget(fiq, 1, NULL); struct fuse_forget_in arg = { .nlookup = forget->forget_one.nlookup, }; @@ -1261,7 +1262,7 @@ __releases(fiq->waitq.lock) } max_forgets = (nbytes - ih.len) / sizeof(struct fuse_forget_one); - head = dequeue_forget(fiq, max_forgets, &count); + head = fuse_dequeue_forget(fiq, max_forgets, &count); spin_unlock(&fiq->waitq.lock); arg.count = count; @@ -2249,7 +2250,7 @@ void fuse_abort_conn(struct fuse_conn *fc) clear_bit(FR_PENDING, &req->flags); list_splice_tail_init(&fiq->pending, &to_end); while (forget_pending(fiq)) - kfree(dequeue_forget(fiq, 1, NULL)); + kfree(fuse_dequeue_forget(fiq, 1, NULL)); wake_up_all_locked(&fiq->waitq); spin_unlock(&fiq->waitq.lock); kill_fasync(&fiq->fasync, SIGIO, POLL_IN); diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 7e19c936ece8..6533be37873f 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -820,6 +820,10 @@ void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget, struct fuse_forget_link *fuse_alloc_forget(void); +struct fuse_forget_link *fuse_dequeue_forget(struct fuse_iqueue *fiq, + unsigned int max, + unsigned int *countp); + /* Used by READDIRPLUS */ void fuse_force_forget(struct file *file, u64 nodeid); -- 2.21.0