mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 02:05:33 +00:00
tmpfs: use inode_set_cached_link()
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com> Link: https://lore.kernel.org/r/20241120112037.822078-4-mjguzik@gmail.com Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
bae80473f7
commit
657e726e0c
@ -3914,6 +3914,7 @@ static int shmem_symlink(struct mnt_idmap *idmap, struct inode *dir,
|
||||
int len;
|
||||
struct inode *inode;
|
||||
struct folio *folio;
|
||||
char *link;
|
||||
|
||||
len = strlen(symname) + 1;
|
||||
if (len > PAGE_SIZE)
|
||||
@ -3935,12 +3936,13 @@ static int shmem_symlink(struct mnt_idmap *idmap, struct inode *dir,
|
||||
|
||||
inode->i_size = len-1;
|
||||
if (len <= SHORT_SYMLINK_LEN) {
|
||||
inode->i_link = kmemdup(symname, len, GFP_KERNEL);
|
||||
if (!inode->i_link) {
|
||||
link = kmemdup(symname, len, GFP_KERNEL);
|
||||
if (!link) {
|
||||
error = -ENOMEM;
|
||||
goto out_remove_offset;
|
||||
}
|
||||
inode->i_op = &shmem_short_symlink_operations;
|
||||
inode_set_cached_link(inode, link, len - 1);
|
||||
} else {
|
||||
inode_nohighmem(inode);
|
||||
inode->i_mapping->a_ops = &shmem_aops;
|
||||
|
Loading…
x
Reference in New Issue
Block a user