diff mbox series

[2/3] fs: predict not having to do anything in fdput()

Message ID 20250406235806.1637000-2-mjguzik@gmail.com (mailing list archive)
State New
Headers show
Series [1/3] fs: sort out cosmetic differences between stat funcs and add predicts | expand

Commit Message

Mateusz Guzik April 6, 2025, 11:58 p.m. UTC
This matches the annotation in fdget().

Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
---
 include/linux/file.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jan Kara April 8, 2025, 10:16 a.m. UTC | #1
On Mon 07-04-25 01:58:05, Mateusz Guzik wrote:
> This matches the annotation in fdget().
> 
> Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>

Looks good. Feel free to add:

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

								Honza

> ---
>  include/linux/file.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/file.h b/include/linux/file.h
> index 302f11355b10..af1768d934a0 100644
> --- a/include/linux/file.h
> +++ b/include/linux/file.h
> @@ -59,7 +59,7 @@ static inline struct fd CLONED_FD(struct file *f)
>  
>  static inline void fdput(struct fd fd)
>  {
> -	if (fd.word & FDPUT_FPUT)
> +	if (unlikely(fd.word & FDPUT_FPUT))
>  		fput(fd_file(fd));
>  }
>  
> -- 
> 2.43.0
>
diff mbox series

Patch

diff --git a/include/linux/file.h b/include/linux/file.h
index 302f11355b10..af1768d934a0 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -59,7 +59,7 @@  static inline struct fd CLONED_FD(struct file *f)
 
 static inline void fdput(struct fd fd)
 {
-	if (fd.word & FDPUT_FPUT)
+	if (unlikely(fd.word & FDPUT_FPUT))
 		fput(fd_file(fd));
 }