Skip to content

Commit 14067ff

Browse files
committed
vfs: make gcc generate more obvious code for acl permission checking
The "fsuid is the inode owner" case is not necessarily always the likely case, but it's the case that doesn't do anything odd and that we want in straight-line code. Make gcc not generate random "jump around for the fun of it" code. This just helps me read profiles. That thing is one of the hottest parts of the whole pathname lookup. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 750e069 commit 14067ff

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎fs/namei.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ static int acl_permission_check(struct inode *inode, int mask)
235235
if (current_user_ns() != inode_userns(inode))
236236
goto other_perms;
237237

238-
if (current_fsuid() == inode->i_uid)
238+
if (likely(current_fsuid() == inode->i_uid))
239239
mode >>= 6;
240240
else {
241241
if (IS_POSIXACL(inode) && (mode & S_IRWXG)) {

0 commit comments

Comments
 (0)