gfs2.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] gfs2: make timeout values more explicit
@ 2024-05-07  9:04 Wolfram Sang
  2024-05-07 10:43 ` Andreas Gruenbacher
  0 siblings, 1 reply; 2+ messages in thread
From: Wolfram Sang @ 2024-05-07  9:04 UTC (permalink / raw
  To: gfs2; +Cc: Wolfram Sang, Andreas Gruenbacher

'timeout' is a vague name for the return value of wait_event_*_timeout
because it actually returns the time left. Because the variable is never
used later, just drop the return value. Since variable 'timeout' is then
only used to carry a fixed timeout value, drop this in favor of a fixed
function argument as in the other call to wait_event_timeout() above.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 fs/gfs2/super.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index e5f79466340d..6d0265ebb9d4 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -1261,7 +1261,6 @@ static bool gfs2_upgrade_iopen_glock(struct inode *inode)
 	struct gfs2_inode *ip = GFS2_I(inode);
 	struct gfs2_sbd *sdp = GFS2_SB(inode);
 	struct gfs2_holder *gh = &ip->i_iopen_gh;
-	long timeout = 5 * HZ;
 	int error;
 
 	gh->gh_flags |= GL_NOCACHE;
@@ -1292,10 +1291,10 @@ static bool gfs2_upgrade_iopen_glock(struct inode *inode)
 	if (error)
 		return false;
 
-	timeout = wait_event_interruptible_timeout(sdp->sd_async_glock_wait,
+	wait_event_interruptible_timeout(sdp->sd_async_glock_wait,
 		!test_bit(HIF_WAIT, &gh->gh_iflags) ||
 		test_bit(GLF_DEMOTE, &ip->i_gl->gl_flags),
-		timeout);
+		5 * HZ);
 	if (!test_bit(HIF_HOLDER, &gh->gh_iflags)) {
 		gfs2_glock_dq(gh);
 		return false;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gfs2: make timeout values more explicit
  2024-05-07  9:04 [PATCH] gfs2: make timeout values more explicit Wolfram Sang
@ 2024-05-07 10:43 ` Andreas Gruenbacher
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Gruenbacher @ 2024-05-07 10:43 UTC (permalink / raw
  To: Wolfram Sang; +Cc: gfs2

On Tue, May 7, 2024 at 11:11 AM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> 'timeout' is a vague name for the return value of wait_event_*_timeout
> because it actually returns the time left. Because the variable is never
> used later, just drop the return value. Since variable 'timeout' is then
> only used to carry a fixed timeout value, drop this in favor of a fixed
> function argument as in the other call to wait_event_timeout() above.

Sure, applied.

Thanks,
Andreas

> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  fs/gfs2/super.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
> index e5f79466340d..6d0265ebb9d4 100644
> --- a/fs/gfs2/super.c
> +++ b/fs/gfs2/super.c
> @@ -1261,7 +1261,6 @@ static bool gfs2_upgrade_iopen_glock(struct inode *inode)
>         struct gfs2_inode *ip = GFS2_I(inode);
>         struct gfs2_sbd *sdp = GFS2_SB(inode);
>         struct gfs2_holder *gh = &ip->i_iopen_gh;
> -       long timeout = 5 * HZ;
>         int error;
>
>         gh->gh_flags |= GL_NOCACHE;
> @@ -1292,10 +1291,10 @@ static bool gfs2_upgrade_iopen_glock(struct inode *inode)
>         if (error)
>                 return false;
>
> -       timeout = wait_event_interruptible_timeout(sdp->sd_async_glock_wait,
> +       wait_event_interruptible_timeout(sdp->sd_async_glock_wait,
>                 !test_bit(HIF_WAIT, &gh->gh_iflags) ||
>                 test_bit(GLF_DEMOTE, &ip->i_gl->gl_flags),
> -               timeout);
> +               5 * HZ);
>         if (!test_bit(HIF_HOLDER, &gh->gh_iflags)) {
>                 gfs2_glock_dq(gh);
>                 return false;
> --
> 2.43.0
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-07 10:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-07  9:04 [PATCH] gfs2: make timeout values more explicit Wolfram Sang
2024-05-07 10:43 ` Andreas Gruenbacher

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 read-only IMAP folder(s) and NNTP newsgroup(s).