[PATCH] fs: touch predicts in do_dentry_open()

Mateusz Guzik posted 1 patch 1 month, 1 week ago
fs/open.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH] fs: touch predicts in do_dentry_open()
Posted by Mateusz Guzik 1 month, 1 week ago
Helps out some of the asm, the routine is still a mess.

Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
---
 fs/open.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/open.c b/fs/open.c
index 1d73a17192da..2a2cf9007900 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -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 */
-- 
2.48.1
Re: [PATCH] fs: touch predicts in do_dentry_open()
Posted by Christian Brauner 1 month, 1 week ago
On Sun, 09 Nov 2025 13:52:54 +0100, Mateusz Guzik wrote:
> 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
Re: [PATCH] fs: touch predicts in do_dentry_open()
Posted by Jan Kara 1 month, 1 week ago
On Sun 09-11-25 13:52:54, Mateusz Guzik wrote:
> Helps out some of the asm, the routine is still a mess.
> 
> Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/open.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/open.c b/fs/open.c
> index 1d73a17192da..2a2cf9007900 100644
> --- a/fs/open.c
> +++ b/fs/open.c
> @@ -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 */
> -- 
> 2.48.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR