fs: clarify the rerurn value check for inode_needs_update_time
PATCH 1/1 fs: clarify the rerurn value check for inode_needs_update_time
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 <[email protected]>
--- fs/inode.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
fs/inode.c +2 -5
@@ -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 ;
Signature · 1 line
2.24.4
Quoted 6 lines · Joseph Qi
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 <[email protected]>
OK, makes sense. Feel free to add:
Reviewed-by Jan Kara <[email protected]>
Honza
Quoted 39 lines
--- fs/inode.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)fs/inode.c +2
-5@@ -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 ;Signature · 1 line
2.24.4
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR