FILESYSTEM IN USERSPACE (FUSE) development
 help / color / mirror / Atom feed
From: Joanne Koong <joannelkoong@gmail.com>
To: miklos@szeredi.hu, fuse-devel@lists.linux.dev
Subject: [PATCH v1 03/13] fuse: clean up fuse_lookup()
Date: Thu, 23 Apr 2026 18:16:36 -0700	[thread overview]
Message-ID: <20260424011646.457682-4-joannelkoong@gmail.com> (raw)
In-Reply-To: <20260424011646.457682-1-joannelkoong@gmail.com>

Remove gotos with direct returns and simplify the d_splice_alias error
path. No functional changes.

Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
---
 fs/fuse/dir.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 31dc87cfa1af..112d979c49c5 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -625,21 +625,19 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
 	err = fuse_lookup_name(dir->i_sb, get_node_id(dir), &entry->d_name,
 			       &outarg, &inode);
 	fuse_unlock_inode(dir, locked);
-	if (err == -ENOENT) {
+	if (err == -ENOENT)
 		outarg_valid = false;
-		err = 0;
-	}
-	if (err)
-		goto out_err;
+	else if (err)
+		return ERR_PTR(err);
 
-	err = -EIO;
-	if (inode && get_node_id(inode) == FUSE_ROOT_ID)
-		goto out_iput;
+	if (inode && get_node_id(inode) == FUSE_ROOT_ID) {
+		iput(inode);
+		return ERR_PTR(-EIO);
+	}
 
 	newent = d_splice_alias(inode, entry);
-	err = PTR_ERR(newent);
 	if (IS_ERR(newent))
-		goto out_err;
+		return newent;
 
 	entry = newent ? newent : entry;
 	entry->d_time = epoch;
@@ -651,11 +649,6 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
 	if (inode)
 		fuse_advise_use_readdirplus(dir);
 	return newent;
-
- out_iput:
-	iput(inode);
- out_err:
-	return ERR_PTR(err);
 }
 
 static int get_security_context(struct dentry *entry, umode_t mode,
-- 
2.52.0


  parent reply	other threads:[~2026-04-24  1:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-24  1:16 [PATCH v1 00/13] fuse: dir.c cleanups Joanne Koong
2026-04-24  1:16 ` [PATCH v1 01/13] fuse: fix missing forget requests in error paths Joanne Koong
2026-04-24  8:18   ` Amir Goldstein
2026-04-24 17:43     ` Joanne Koong
2026-04-24  1:16 ` [PATCH v1 02/13] fuse: clean up fuse_lookup_name() Joanne Koong
2026-04-24  1:16 ` Joanne Koong [this message]
2026-04-24  1:16 ` [PATCH v1 04/13] fuse: clean up fuse_dentry_revalidate() Joanne Koong
2026-04-24  8:20   ` Amir Goldstein
2026-04-24  1:16 ` [PATCH v1 05/13] fuse: clean up fuse_create_open() Joanne Koong
2026-04-24  1:16 ` [PATCH v1 06/13] fuse: clean up fuse_rename2() Joanne Koong
2026-04-24  1:16 ` [PATCH v1 07/13] fuse: clean up fuse_time_to_jiffies() Joanne Koong
2026-04-24  1:16 ` [PATCH v1 08/13] fuse: clean up fuse_link() Joanne Koong
2026-04-24  1:16 ` [PATCH v1 09/13] fuse: clean up fuse_do_getattr() Joanne Koong
2026-04-24  1:16 ` [PATCH v1 10/13] fuse: clean up fuse_update_get_attr() Joanne Koong
2026-04-24  1:16 ` [PATCH v1 11/13] fuse: clean up fuse_get_link() Joanne Koong
2026-04-24  1:16 ` [PATCH v1 12/13] fuse: clean up fuse_dir_open() Joanne Koong
2026-04-24  1:16 ` [PATCH v1 13/13] fuse: clean up setattr() Joanne Koong
2026-04-24  7:51 ` [PATCH v1 00/13] fuse: dir.c cleanups Amir Goldstein
2026-04-24 17:27   ` Joanne Koong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260424011646.457682-4-joannelkoong@gmail.com \
    --to=joannelkoong@gmail.com \
    --cc=fuse-devel@lists.linux.dev \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox