]> www.infradead.org Git - users/jedix/linux-maple.git/commit
vfs: link_path_walk: improve may_lookup() code generation
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 16 Jun 2024 22:00:35 +0000 (15:00 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 7 Jul 2024 17:27:22 +0000 (10:27 -0700)
commit58b0afa038bb404ff82b358b68db5ffa8f53c404
tree5433288bbb114d2aa5400ce06abbc7bdc4dde33f
parentba848a77c90800cb686a5c8cf725e9bdfdcccfc2
vfs: link_path_walk: improve may_lookup() code generation

Instead of having separate calls to 'inode_permission()' depending on
whether we're in RCU lookup or not, just share the first call.

Note that the initial "conditional" on LOOKUP_RCU really turns into just
a "convert the LOOKUP_RCU bit in the nameidata into the MAY_NOT_BLOCK
bit in the argument", which is just a trivial bitwise and and shift
operation.

So the initial conditional goes away entirely, and then the likely case
is that it will succeed independently of us being in RCU lookup or not,
and the possible "we may need to fall out of RCU and redo it all" fixups
that are needed afterwards all go in the unlikely path.

[ This also marks 'nd' restrict, because that means that the compiler
  can know that there is no other alias, and can cache the LOOKUP_RCU
  value over the call to inode_permission(). ]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/namei.c