Skip to contentSkip to conversation

gfs2: make timeout values more explicit

PATCH In review Wolfram Sang 2 participants 2 messages May 7, 2024 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gfs2: make timeout values more explicit

'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.

---
 fs/gfs2/super.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/gfs2/super.c +2 -3
index e5f79466340d..6d0265ebb9d4 100644
@@ -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;
Signature · 1 line
2.43.0
#1 lore raw
Quoted 5 lines · Wolfram Sang

'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

Quoted 33 lines
---
 fs/gfs2/super.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/gfs2/super.c +2 -4
index e5f79466340d..6d0265ebb9d4 100644
@@ -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