]> www.infradead.org Git - users/jedix/linux-maple.git/commit
vfs: support caching symlink lengths in inodes
authorMateusz Guzik <mjguzik@gmail.com>
Wed, 20 Nov 2024 11:20:34 +0000 (12:20 +0100)
committerChristian Brauner <brauner@kernel.org>
Sun, 22 Dec 2024 10:29:50 +0000 (11:29 +0100)
commitea382199071931d19aac5f688b543e07360e2b64
tree375c9ad796a10c2e2abd39b3a766196f354a050b
parent135ec43eb29c68ed26e2d10f221d43f7d9139a8f
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>
fs/namei.c
fs/proc/namespaces.c
include/linux/fs.h
security/apparmor/apparmorfs.c