fs: predict not having to do anything in fdput()
authorMateusz Guzik <mjguzik@gmail.com>
Sun, 6 Apr 2025 23:58:05 +0000 (01:58 +0200)
committerChristian Brauner <brauner@kernel.org>
Tue, 8 Apr 2025 08:28:07 +0000 (10:28 +0200)
This matches the annotation in fdget().

Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Link: https://lore.kernel.org/20250406235806.1637000-2-mjguzik@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
include/linux/file.h

index 302f11355b104c2b1806b2fc5ccfd7bae13c3058..af1768d934a010999fdce8bf71cb374bd7531dd5 100644 (file)
@@ -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));
 }