From: Mateusz Guzik <mjguzik@gmail.com>
To: brauner@kernel.org
Cc: viro@zeniv.linux.org.uk, jack@suse.cz,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
hughd@google.com, linux-ext4@vger.kernel.org, tytso@mit.edu,
linux-mm@kvack.org, Mateusz Guzik <mjguzik@gmail.com>
Subject: [PATCH v2 3/3] tmpfs: use inode_set_cached_link()
Date: Tue, 19 Nov 2024 10:45:55 +0100 [thread overview]
Message-ID: <20241119094555.660666-4-mjguzik@gmail.com> (raw)
In-Reply-To: <20241119094555.660666-1-mjguzik@gmail.com>
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
---
mm/shmem.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index 3d17753afd94..698a4bbdc21d 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3870,6 +3870,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)
@@ -3891,12 +3892,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;
--
2.43.0
next prev parent reply other threads:[~2024-11-19 9:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-19 9:45 [PATCH v2 0/3] symlink length caching Mateusz Guzik
2024-11-19 9:45 ` [PATCH v2 1/3] vfs: support caching symlink lengths in inodes Mateusz Guzik
2024-11-20 4:15 ` wangjianjian (C)
2024-11-20 5:01 ` Matthew Wilcox
2024-11-20 5:10 ` wangjianjian (C)
2024-11-19 9:45 ` [PATCH v2 2/3] ext4: use inode_set_cached_link() Mateusz Guzik
2024-11-19 9:45 ` Mateusz Guzik [this message]
2024-11-19 17:53 ` [PATCH v2 0/3] symlink length caching Theodore Ts'o
2024-11-19 18:07 ` Mateusz Guzik
2024-11-20 10:33 ` Christian Brauner
2024-11-20 10:42 ` Mateusz Guzik
2024-11-20 11:12 ` Christian Brauner
2024-11-20 19:47 ` Mateusz Guzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241119094555.660666-4-mjguzik@gmail.com \
--to=mjguzik@gmail.com \
--cc=brauner@kernel.org \
--cc=hughd@google.com \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.