Skip to contentSkip to conversation

fs: touch predicts in do_dentry_open()

PATCH Applied Mateusz Guzik 3 participants 3 messages Nov 9, 2025 – Nov 11, 2025 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: touch predicts in do_dentry_open()

Helps out some of the asm, the routine is still a mess.

---
 fs/open.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/open.c +3 -3
index 1d73a17192da..2a2cf9007900 100644
@@ -937,7 +937,7 @@ static int do_dentry_open(struct file *f,
 	}
 
 	error = security_file_open(f);
-	if (error)
+	if (unlikely(error))
 		goto cleanup_all;
 
 	/*
@@ -947,11 +947,11 @@ static int do_dentry_open(struct file *f,
 	 * pseudo file, this call will not change the mode.
 	 */
 	error = fsnotify_open_perm_and_set_mode(f);
-	if (error)
+	if (unlikely(error))
 		goto cleanup_all;
 
 	error = break_lease(file_inode(f), f->f_flags);
-	if (error)
+	if (unlikely(error))
 		goto cleanup_all;
 
 	/* normally all 3 are set; ->open() can clear them if needed */
Signature · 1 line
2.48.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Mateusz Guzik

Helps out some of the asm, the routine is still a mess.

Looks good. Feel free to add:

Honza

Quoted 34 lines
---
 fs/open.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/open.c +3 -3
index 1d73a17192da..2a2cf9007900 100644
@@ -937,7 +937,7 @@ static int do_dentry_open(struct file *f,
 	}
 
 	error = security_file_open(f);
-	if (error)
+	if (unlikely(error))
 		goto cleanup_all;
 
 	/*
@@ -947,11 +947,11 @@ static int do_dentry_open(struct file *f,
 	 * pseudo file, this call will not change the mode.
 	 */
 	error = fsnotify_open_perm_and_set_mode(f);
-	if (error)
+	if (unlikely(error))
 		goto cleanup_all;
 
 	error = break_lease(file_inode(f), f->f_flags);
-	if (error)
+	if (unlikely(error))
 		goto cleanup_all;
 
 	/* normally all 3 are set; ->open() can clear them if needed */
Signature · 1 line
2.48.1
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
maintainer Applied
#2 lore raw
In reply to Mateusz Guzik
Quoted 3 lines · Mateusz Guzik

Helps out some of the asm, the routine is still a mess.

Applied to the vfs-6.19.misc branch of the vfs/vfs.git tree. Patches in the vfs-6.19.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.19.misc

[1/1] fs: touch predicts in do_dentry_open()

      https://git.kernel.org/vfs/vfs/c/3717e71df8ef