* [PATCH] fs: unconditionally use atime_needs_update() in pick_link()
@ 2025-04-08 7:36 Mateusz Guzik
2025-04-08 9:09 ` Christian Brauner
2025-04-08 12:07 ` Jan Kara
0 siblings, 2 replies; 3+ messages in thread
From: Mateusz Guzik @ 2025-04-08 7:36 UTC (permalink / raw)
To: brauner; +Cc: viro, jack, linux-kernel, linux-fsdevel, Mateusz Guzik
Vast majority of the time the func returns false.
This avoids a branch to determine whether we are in RCU mode.
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
---
fs/namei.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index 360a86ca1f02..ae2643ff14dc 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1905,13 +1905,13 @@ static const char *pick_link(struct nameidata *nd, struct path *link,
unlikely(link->mnt->mnt_flags & MNT_NOSYMFOLLOW))
return ERR_PTR(-ELOOP);
- if (!(nd->flags & LOOKUP_RCU)) {
+ if (unlikely(atime_needs_update(&last->link, inode))) {
+ if (nd->flags & LOOKUP_RCU) {
+ if (!try_to_unlazy(nd))
+ return ERR_PTR(-ECHILD);
+ }
touch_atime(&last->link);
cond_resched();
- } else if (atime_needs_update(&last->link, inode)) {
- if (!try_to_unlazy(nd))
- return ERR_PTR(-ECHILD);
- touch_atime(&last->link);
}
error = security_inode_follow_link(link->dentry, inode,
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fs: unconditionally use atime_needs_update() in pick_link()
2025-04-08 7:36 [PATCH] fs: unconditionally use atime_needs_update() in pick_link() Mateusz Guzik
@ 2025-04-08 9:09 ` Christian Brauner
2025-04-08 12:07 ` Jan Kara
1 sibling, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2025-04-08 9:09 UTC (permalink / raw)
To: Mateusz Guzik; +Cc: Christian Brauner, viro, jack, linux-kernel, linux-fsdevel
On Tue, 08 Apr 2025 09:36:41 +0200, Mateusz Guzik wrote:
> Vast majority of the time the func returns false.
>
> This avoids a branch to determine whether we are in RCU mode.
>
>
Applied to the vfs-6.16.misc branch of the vfs/vfs.git tree.
Patches in the vfs-6.16.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.16.misc
[1/1] fs: unconditionally use atime_needs_update() in pick_link()
https://git.kernel.org/vfs/vfs/c/e45960c279b0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fs: unconditionally use atime_needs_update() in pick_link()
2025-04-08 7:36 [PATCH] fs: unconditionally use atime_needs_update() in pick_link() Mateusz Guzik
2025-04-08 9:09 ` Christian Brauner
@ 2025-04-08 12:07 ` Jan Kara
1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2025-04-08 12:07 UTC (permalink / raw)
To: Mateusz Guzik; +Cc: brauner, viro, jack, linux-kernel, linux-fsdevel
On Tue 08-04-25 09:36:41, Mateusz Guzik wrote:
> Vast majority of the time the func returns false.
>
> This avoids a branch to determine whether we are in RCU mode.
>
> Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Looks good! Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/namei.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/fs/namei.c b/fs/namei.c
> index 360a86ca1f02..ae2643ff14dc 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -1905,13 +1905,13 @@ static const char *pick_link(struct nameidata *nd, struct path *link,
> unlikely(link->mnt->mnt_flags & MNT_NOSYMFOLLOW))
> return ERR_PTR(-ELOOP);
>
> - if (!(nd->flags & LOOKUP_RCU)) {
> + if (unlikely(atime_needs_update(&last->link, inode))) {
> + if (nd->flags & LOOKUP_RCU) {
> + if (!try_to_unlazy(nd))
> + return ERR_PTR(-ECHILD);
> + }
> touch_atime(&last->link);
> cond_resched();
> - } else if (atime_needs_update(&last->link, inode)) {
> - if (!try_to_unlazy(nd))
> - return ERR_PTR(-ECHILD);
> - touch_atime(&last->link);
> }
>
> error = security_inode_follow_link(link->dentry, inode,
> --
> 2.43.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-08 12:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-08 7:36 [PATCH] fs: unconditionally use atime_needs_update() in pick_link() Mateusz Guzik
2025-04-08 9:09 ` Christian Brauner
2025-04-08 12:07 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox