From: Jan Kara <jack@suse.cz>
To: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: viro@zeniv.linux.org.uk, shr@fb.com, jack@suse.cz,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fs: clarify the rerurn value check for inode_needs_update_time
Date: Tue, 11 Oct 2022 18:02:37 +0200 [thread overview]
Message-ID: <20221011160237.rpjmcoxgmdxm4wpe@quack3> (raw)
In-Reply-To: <20221011020212.131100-1-joseph.qi@linux.alibaba.com>
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
prev parent reply other threads:[~2022-10-11 16:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
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=20221011160237.rpjmcoxgmdxm4wpe@quack3 \
--to=jack@suse.cz \
--cc=joseph.qi@linux.alibaba.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=shr@fb.com \
--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 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).