From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) 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> In-Reply-To: <20180928154234.19270-1-mszeredi@redhat.com> References: <20180928154234.19270-1-mszeredi@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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