Skip to content

Commit

Permalink
vfs: micro-optimize acl_permission_check()
Browse files Browse the repository at this point in the history
It's a hot function, and we're better off not mixing types in the mask
calculations.  The compiler just ends up mixing 16-bit and 32-bit
operations, for no good reason.

So do everything in 'unsigned int' rather than mixing 'unsigned int'
masking with a 'umode_t' (16-bit) mode variable.

This, together with the parent commit (47a150e: "Cache user_ns in
struct cred") makes acl_permission_check() much nicer.

Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
torvalds committed May 13, 2011
1 parent 47a150e commit 26cf46b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ EXPORT_SYMBOL(putname);
static int acl_permission_check(struct inode *inode, int mask, unsigned int flags,
int (*check_acl)(struct inode *inode, int mask, unsigned int flags))
{
umode_t mode = inode->i_mode;
unsigned int mode = inode->i_mode;

mask &= MAY_READ | MAY_WRITE | MAY_EXEC;

Expand Down

0 comments on commit 26cf46b

Please sign in to comment.