Skip to contentSkip to conversation

fuse: use min_not_zero() in fuse_init_server_timeout()

PATCH Applied Sang-Heon Jeon 3 participants 3 messages Jul 31 – Aug 18 FUSE filesystem core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fuse: use min_not_zero() in fuse_init_server_timeout()

fuse_init_server_timeout() limits timeout to fuse_max_req_timeout with the same logic as min_not_zero(), and returns early exactly when the computed timeout would be zero.

So use min_not_zero() instead and return when the computed timeout is zero.

No functional change.

---
 fs/fuse/req_timeout.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
fs/fuse/req_timeout.c +3 -9
index 6cc6fc491343..95a1acd7bc08 100644
@@ -128,18 +128,12 @@ static void set_request_timeout(struct fuse_chan *fch, unsigned int timeout)
 
 void fuse_init_server_timeout(struct fuse_chan *fch, unsigned int timeout)
 {
-	if (!timeout && !fuse_max_req_timeout && !fuse_default_req_timeout)
-		return;
-
 	if (!timeout)
 		timeout = fuse_default_req_timeout;
 
-	if (fuse_max_req_timeout) {
-		if (timeout)
-			timeout = min(fuse_max_req_timeout, timeout);
-		else
-			timeout = fuse_max_req_timeout;
-	}
+	timeout = min_not_zero(timeout, fuse_max_req_timeout);
+	if (!timeout)
+		return;
 
 	timeout = max(FUSE_TIMEOUT_TIMER_FREQ, timeout);
 
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Sang-Heon Jeon

fuse_init_server_timeout() limits timeout to fuse_max_req_timeout with the same logic as min_not_zero(), and returns early exactly when the computed timeout would be zero.

So use min_not_zero() instead and return when the computed timeout is zero.

No functional change.

maintainer Applied
#2 lore raw
In reply to Sang-Heon Jeon
Quoted 7 lines · Sang-Heon Jeon

fuse_init_server_timeout() limits timeout to fuse_max_req_timeout with the same logic as min_not_zero(), and returns early exactly when the computed timeout would be zero.

So use min_not_zero() instead and return when the computed timeout is zero.

Applied, thanks.

Miklos