mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
btrfs: utilize IOP_FASTPERM_MAY_EXEC
Root filesystem was ext4, btrfs was mounted on /testfs.
Then issuing access(2) in a loop on /testfs/repos/linux/include/linux/fs.h
on Sapphire Rapids (ops/s):
before: 3447976
after: 3620879 (+5%)
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Link: https://patch.msgid.link/20251107142149.989998-3-mjguzik@gmail.com
Acked-by: David Sterba <dsterba@suse.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
committed by
Christian Brauner
parent
e631df89cd
commit
3e18f6256e
@@ -5837,6 +5837,8 @@ struct btrfs_inode *btrfs_iget(u64 ino, struct btrfs_root *root)
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
if (S_ISDIR(inode->vfs_inode.i_mode))
|
||||
inode->vfs_inode.i_opflags |= IOP_FASTPERM_MAY_EXEC;
|
||||
unlock_new_inode(&inode->vfs_inode);
|
||||
return inode;
|
||||
}
|
||||
@@ -6788,8 +6790,11 @@ static int btrfs_create_common(struct inode *dir, struct dentry *dentry,
|
||||
}
|
||||
|
||||
ret = btrfs_create_new_inode(trans, &new_inode_args);
|
||||
if (!ret)
|
||||
if (!ret) {
|
||||
if (S_ISDIR(inode->i_mode))
|
||||
inode->i_opflags |= IOP_FASTPERM_MAY_EXEC;
|
||||
d_instantiate_new(dentry, inode);
|
||||
}
|
||||
|
||||
btrfs_end_transaction(trans);
|
||||
btrfs_btree_balance_dirty(fs_info);
|
||||
@@ -9169,6 +9174,11 @@ int btrfs_prealloc_file_range_trans(struct inode *inode,
|
||||
min_size, actual_len, alloc_hint, trans);
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: in case you are adding MAY_EXEC check for directories:
|
||||
* we are marking them with IOP_FASTPERM_MAY_EXEC, allowing path lookup to
|
||||
* elide calls here.
|
||||
*/
|
||||
static int btrfs_permission(struct mnt_idmap *idmap,
|
||||
struct inode *inode, int mask)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user