* [PATCH] fs: clarify the rerurn value check for inode_needs_update_time
@ 2022-10-11 2:02 Joseph Qi
2022-10-11 16:02 ` Jan Kara
0 siblings, 1 reply; 2+ messages in thread
From: Joseph Qi @ 2022-10-11 2:02 UTC (permalink / raw)
To: viro; +Cc: shr, jack, linux-fsdevel
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@linux.alibaba.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fs: clarify the rerurn value check for inode_needs_update_time
2022-10-11 2:02 [PATCH] fs: clarify the rerurn value check for inode_needs_update_time Joseph Qi
@ 2022-10-11 16:02 ` Jan Kara
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2022-10-11 16:02 UTC (permalink / raw)
To: Joseph Qi; +Cc: viro, shr, jack, linux-fsdevel
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@linux.alibaba.com>
OK, makes sense. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
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@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-11 16:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-11 2:02 [PATCH] fs: clarify the rerurn value check for inode_needs_update_time Joseph Qi
2022-10-11 16:02 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).