Re: [PATCH] fs: unconditionally use atime_needs_update() in pick_link()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>

Looks good! Feel free to add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

								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@xxxxxxxx>
SUSE Labs, CR




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux