diff options
author | Mateusz Guzik <mjguzik@gmail.com> | 2024-11-20 12:20:34 +0100 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2024-12-22 11:29:50 +0100 |
commit | ea382199071931d19aac5f688b543e07360e2b64 (patch) | |
tree | 375c9ad796a10c2e2abd39b3a766196f354a050b /security | |
parent | 135ec43eb29c68ed26e2d10f221d43f7d9139a8f (diff) | |
download | linux-ea382199071931d19aac5f688b543e07360e2b64.tar.gz linux-ea382199071931d19aac5f688b543e07360e2b64.tar.bz2 linux-ea382199071931d19aac5f688b543e07360e2b64.zip |
vfs: support caching symlink lengths in inodes
When utilized it dodges strlen() in vfs_readlink(), giving about 1.5%
speed up when issuing readlink on /initrd.img on ext4.
Filesystems opt in by calling inode_set_cached_link() when creating an
inode.
The size is stored in a new union utilizing the same space as i_devices,
thus avoiding growing the struct or taking up any more space.
Churn-wise the current readlink_copy() helper is patched to accept the
size instead of calculating it.
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Link: https://lore.kernel.org/r/20241120112037.822078-2-mjguzik@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'security')
-rw-r--r-- | security/apparmor/apparmorfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index 2c0185ebc900..c07d150685d7 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c @@ -2612,7 +2612,7 @@ static int policy_readlink(struct dentry *dentry, char __user *buffer, res = snprintf(name, sizeof(name), "%s:[%lu]", AAFS_NAME, d_inode(dentry)->i_ino); if (res > 0 && res < sizeof(name)) - res = readlink_copy(buffer, buflen, name); + res = readlink_copy(buffer, buflen, name, strlen(name)); else res = -ENOENT; |