Re: [PATCH] fs: clarify the rerurn value check for inode_needs_update_time

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

 



On Tue 11-10-22 10:02:12, Joseph Qi wrote:
> inode_needs_update_time() can only returns >0 or 0, which means inode
> needs sync or not.
> So cleanup the callers return value check, and also cleanup redundant
> check in the function before return.
> 
> Signed-off-by: Joseph Qi <joseph.qi@xxxxxxxxxxxxxxxxx>

OK, makes sense. Feel free to add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

								Honza

> ---
>  fs/inode.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/inode.c b/fs/inode.c
> index b608528efd3a..d8f4ba98549a 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -2071,9 +2071,6 @@ static int inode_needs_update_time(struct inode *inode, struct timespec64 *now)
>  	if (IS_I_VERSION(inode) && inode_iversion_need_inc(inode))
>  		sync_it |= S_VERSION;
>  
> -	if (!sync_it)
> -		return 0;
> -
>  	return sync_it;
>  }
>  
> @@ -2113,7 +2110,7 @@ int file_update_time(struct file *file)
>  	struct timespec64 now = current_time(inode);
>  
>  	ret = inode_needs_update_time(inode, &now);
> -	if (ret <= 0)
> +	if (!ret)
>  		return ret;
>  
>  	return __file_update_time(file, &now, ret);
> @@ -2153,7 +2150,7 @@ static int file_modified_flags(struct file *file, int flags)
>  		return 0;
>  
>  	ret = inode_needs_update_time(inode, &now);
> -	if (ret <= 0)
> +	if (!ret)
>  		return ret;
>  	if (flags & IOCB_NOWAIT)
>  		return -EAGAIN;
> -- 
> 2.24.4
> 
-- 
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