Skip to content
Commit 52732bb9 authored by Yu Ma's avatar Yu Ma Committed by Al Viro
Browse files

fs/file.c: remove sanity_check and add likely/unlikely in alloc_fd()



alloc_fd() has a sanity check inside to make sure the struct file mapping to the
allocated fd is NULL. Remove this sanity check since it can be assured by
exisitng zero initilization and NULL set when recycling fd. Meanwhile, add
likely/unlikely and expand_file() call avoidance to reduce the work under
file_lock.

Reviewed-by: default avatarJan Kara <jack@suse.cz>
Reviewed-by: default avatarTim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: default avatarYu Ma <yu.ma@intel.com>
Link: https://lore.kernel.org/r/20240717145018.3972922-2-yu.ma@intel.com


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent cab05152
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment