mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-12 01:20:14 +00:00
fs: tidy up do_sys_openat2() with likely/unlikely
Otherwise gcc 13 generates conditional forward jumps (aka branch mispredict by default) for build_open_flags() being succesfull. Signed-off-by: Mateusz Guzik <mjguzik@gmail.com> Link: https://lore.kernel.org/r/20250320092331.1921700-1-mjguzik@gmail.com Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
9ae7e5a1cd
commit
d5a05a5a44
@ -1412,18 +1412,19 @@ static int do_sys_openat2(int dfd, const char __user *filename,
|
||||
struct open_how *how)
|
||||
{
|
||||
struct open_flags op;
|
||||
int fd = build_open_flags(how, &op);
|
||||
struct filename *tmp;
|
||||
int err, fd;
|
||||
|
||||
if (fd)
|
||||
return fd;
|
||||
err = build_open_flags(how, &op);
|
||||
if (unlikely(err))
|
||||
return err;
|
||||
|
||||
tmp = getname(filename);
|
||||
if (IS_ERR(tmp))
|
||||
return PTR_ERR(tmp);
|
||||
|
||||
fd = get_unused_fd_flags(how->flags);
|
||||
if (fd >= 0) {
|
||||
if (likely(fd >= 0)) {
|
||||
struct file *f = do_filp_open(dfd, tmp, &op);
|
||||
if (IS_ERR(f)) {
|
||||
put_unused_fd(fd);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user