From patchwork Fri Sep 28 15:42:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10620119 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EBC3C15A6 for ; Fri, 28 Sep 2018 15:42:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E34402BE8A for ; Fri, 28 Sep 2018 15:42:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1AFA2BF47; Fri, 28 Sep 2018 15:42:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81BB42BF2D for ; Fri, 28 Sep 2018 15:42:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729615AbeI1WHG (ORCPT ); Fri, 28 Sep 2018 18:07:06 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:37535 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729566AbeI1WHF (ORCPT ); Fri, 28 Sep 2018 18:07:05 -0400 Received: by mail-wr1-f66.google.com with SMTP id u12-v6so6880076wrr.4 for ; Fri, 28 Sep 2018 08:42:45 -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; bh=WA8a1eE6/xDrpYjrzRivExvWBCE8QoKwcHcAGlCFyCU=; b=YWOQVs9FiBmEBtxnq1/ZEI1YWnnRRpIVse65iNOe/nptZd0keTy/BAIqhYGiChdWwh bEIWmByjBeftS7OtOvfqU/rqBizQrX624ozt/b8BFz1Mw7wMvjqEfWzST/kN6FIe1Pt6 yRPa9HPyfp0VY8Kq5TO41tJ7l1G+xiC1Zt6LBGlEZfgF8Zy1xzVHa1jlKsngNNgUEAR1 24DZaXft2YKsnjIapUwy8g2moMuuuMhLqxXizCh0R1Cf47olTroqxOvQRoQGMkcepo5w YFt0nU6SjVTAtcdMbTBoN6aHcPSJ9eeV2zA3eN4aDKSJ+xgHSuk+kk0zpi5sAGVrovxn G2yw== X-Gm-Message-State: ABuFfoguYGzLvVluJWdIeKJX15tg37LwKcJs+45jRICRVm1SwOrPsSpA RmQBGIb2j7NvnSNgTMfzX23LKRkojdQ= X-Google-Smtp-Source: ACcGV60aceeiePRbu8+zVhfncFCDGSg15mTdm2ToFXU5DavPNpBlCdIis5OO8cWIiovxmnzftI+PeA== X-Received: by 2002:adf:9af5:: with SMTP id a108-v6mr13192775wrc.125.1538149364116; Fri, 28 Sep 2018 08:42:44 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (catv-212-96-48-140.catv.broadband.hu. [212.96.48.140]) by smtp.gmail.com with ESMTPSA id v2-v6sm2009877wme.36.2018.09.28.08.42.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Sep 2018 08:42:43 -0700 (PDT) From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 3/9] fuse: extract fuse_emit() helper Date: Fri, 28 Sep 2018 17:42:28 +0200 Message-Id: <20180928154234.19270-4-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180928154234.19270-1-mszeredi@redhat.com> References: <20180928154234.19270-1-mszeredi@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Prepare for cache filling by introducing a helper for emitting a single directory entry. Signed-off-by: Miklos Szeredi --- fs/fuse/readdir.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/fs/fuse/readdir.c b/fs/fuse/readdir.c index 3e100e00e21e..65336c93c1f4 100644 --- a/fs/fuse/readdir.c +++ b/fs/fuse/readdir.c @@ -26,6 +26,13 @@ static bool fuse_use_readdirplus(struct inode *dir, struct dir_context *ctx) return false; } +static bool fuse_emit(struct file *file, struct dir_context *ctx, + struct fuse_dirent *dirent) +{ + return dir_emit(ctx, dirent->name, dirent->namelen, dirent->ino, + dirent->type); +} + static int parse_dirfile(char *buf, size_t nbytes, struct file *file, struct dir_context *ctx) { @@ -39,8 +46,7 @@ static int parse_dirfile(char *buf, size_t nbytes, struct file *file, if (memchr(dirent->name, '/', dirent->namelen) != NULL) return -EIO; - if (!dir_emit(ctx, dirent->name, dirent->namelen, - dirent->ino, dirent->type)) + if (!fuse_emit(file, ctx, dirent)) break; buf += reclen; @@ -183,8 +189,7 @@ static int parse_dirplusfile(char *buf, size_t nbytes, struct file *file, we need to send a FORGET for each of those which we did not link. */ - over = !dir_emit(ctx, dirent->name, dirent->namelen, - dirent->ino, dirent->type); + over = !fuse_emit(file, ctx, dirent); if (!over) ctx->pos = dirent->off; }