Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp909898imm; Fri, 28 Sep 2018 08:45:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV62A8qgIzfIfLOwUT+ilrWjrMhHvnlkdC9S1V38HPgNwufzqJ9eE/vOzSYLdffDPiqIsq9Ab X-Received: by 2002:a63:844:: with SMTP id 65-v6mr15849360pgi.144.1538149537139; Fri, 28 Sep 2018 08:45:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538149537; cv=none; d=google.com; s=arc-20160816; b=VCwuJILGsnliBHv71P7XCxm9uDyp2fUFHQMvMT7ILc0VfenFZ2QA9Nxbz0e5ZZuueZ KM3W3t7B3Sm5CzxUr4whR77bZ5HUPl4c84EeeVBWhqHo+fi9GNBQf75/c170f/DuJxJr mlmQhDGkIHffgdfAzRTM4jA6xHXAPeSAlGalWMYCIkZXxVjrvtVNQOdp4sEOXmI/LbQF 86v0lMUss39Nc5+AgPUjlseJytbYJ6zN434lzBQIT244A/AbJgF+Thq5E+HzQ1q4ziME nkbyVjg0X2HQBSbjG6SdP/uZsGRaLFlg0NYbpFZO0qIh8a8l3cqYcJS10UJoK+Egaz5I toWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=WA8a1eE6/xDrpYjrzRivExvWBCE8QoKwcHcAGlCFyCU=; b=U0QxnDwIvmyI67K8AWbv4wpujKneVAUxLgHiTyGKip0YTvDRhcgC3LDSLcdifkyeP4 TIugy/xP2G618mnLfWFk4svVVVK0BU6ua6AhBif+migNNQbTiuEIlbxNMfgAR+yn83VC JZLDIl7Xvtq1hW3XbYtQdVCUbT09IF6zOXECUZt0E0ZxAr4rhNfgiF2qf3uDHDEWIrYz bKwkqGtFwO/OOk8Av/8ATTkf/UHqZDa5ZSeQ6EAynOTu2aKCcksk9uhDcP5qSdtvyonM Jm3RSuCYd5Yht63MJN6Vb7QVYyC3c9EXIscCYvROTUF4Wry4tgfTtXSOozLVYjslafRw yVsQ== 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 c20-v6si5504389pfc.18.2018.09.28.08.45.21; Fri, 28 Sep 2018 08:45:37 -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 S1729607AbeI1WHE (ORCPT + 99 others); Fri, 28 Sep 2018 18:07:04 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:39260 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729464AbeI1WHE (ORCPT ); Fri, 28 Sep 2018 18:07:04 -0400 Received: by mail-wr1-f65.google.com with SMTP id s14-v6so6888807wrw.6 for ; Fri, 28 Sep 2018 08:42:44 -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=n/X1WvGnCW5cpl7sCz3xNRNt5hUSt2GDcy9JdGenuev2ZHUl/fPVG2D/IkTnMAkjOj Lj7gj34TgiqjIe8wxCYN71aoxPVeZ0uWQtp+EI+j6CYhpDBUq0pRYp/OFUyXX0UhNFCy YGVEJWVAcmeg+ClDkjX5B0NY2ugXoZ5dB+ZqUT81XywvxtZC5j7jhpHJuDyW/e3F5GXp wtwOuVIytPxAfZGxCAm3AM/yhJ7X+3MN/i4RAtBI5rwtWuEcy77h4+QX734Dtbl54QLj JdTZHkJeA06Aq3PJWuYTQqkFFY0fcYoYn/NCYNmu7a4dMfBwT8jniZN9Q6fa3Su5QpGi oamA== X-Gm-Message-State: ABuFfohpKhzzBqC4BFeVMxyrTNEP1iQgHy3dZs13wfIEH1ptgQbIO95b 123QH5/EgS1R4LQPeD5BnA+UZw== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 2.14.3