You probably ought to merge the two 'unlikely' tests.
Otherwise there'll be two conditionals in the 'hot path'.
(There probably always were.)
So something like:
if (unlikely(op->open_flag & (__O_TMPFILE | O_PATH))) {
file = alloc_empty_file(op->open_flag, current_cred());
if (IS_ERR(file))
return file;
if (op->open_flag & __O_TMFILE)
error = do_tmpfile(nd, flags, op, file);
else
error = do_o_path(nd, flags, file);
} else {
Copying op->open_flag to a local may also generate better code.Done this as well.