Просмотр исходного кода

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>
Linus Torvalds 14 лет назад
Родитель
Сommit
14067ff536
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      fs/namei.c

+ 1 - 1
fs/namei.c

@@ -235,7 +235,7 @@ static int acl_permission_check(struct inode *inode, int mask)
 	if (current_user_ns() != inode_userns(inode))
 	if (current_user_ns() != inode_userns(inode))
 		goto other_perms;
 		goto other_perms;
 
 
-	if (current_fsuid() == inode->i_uid)
+	if (likely(current_fsuid() == inode->i_uid))
 		mode >>= 6;
 		mode >>= 6;
 	else {
 	else {
 		if (IS_POSIXACL(inode) && (mode & S_IRWXG)) {
 		if (IS_POSIXACL(inode) && (mode & S_IRWXG)) {