]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
lockd: Simplify cast_status() in svcproc.c
authorChuck Lever <chuck.lever@oracle.com>
Wed, 28 Jan 2026 15:19:22 +0000 (10:19 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 30 Mar 2026 01:25:09 +0000 (21:25 -0400)
Clean up: The svcproc.c file handles only NLM v1 and v3 requests.
NLMv4 requests are routed to a separate procedure table in
svc4proc.c, so rqstp->rq_vers can never be 4 in this context.

Remove the unused vers parameter and the dead "vers != 4" check from
cast_to_nlm(). This eliminates the need for the macro wrapper.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/lockd/svcproc.c

index 5817ef272332d9759895fb3f241bdbadf0387602..95c6bf7ab757473e7a6b9943e8aee05569c02633 100644 (file)
 #define NLMDBG_FACILITY                NLMDBG_CLIENT
 
 #ifdef CONFIG_LOCKD_V4
-static __be32
-cast_to_nlm(__be32 status, u32 vers)
+static inline __be32 cast_status(__be32 status)
 {
-       /* Note: status is assumed to be in network byte order !!! */
-       if (vers != 4){
-               switch (status) {
-               case nlm_granted:
-               case nlm_lck_denied:
-               case nlm_lck_denied_nolocks:
-               case nlm_lck_blocked:
-               case nlm_lck_denied_grace_period:
-               case nlm_drop_reply:
-                       break;
-               case nlm4_deadlock:
-                       status = nlm_lck_denied;
-                       break;
-               default:
-                       status = nlm_lck_denied_nolocks;
-               }
+       switch (status) {
+       case nlm_granted:
+       case nlm_lck_denied:
+       case nlm_lck_denied_nolocks:
+       case nlm_lck_blocked:
+       case nlm_lck_denied_grace_period:
+       case nlm_drop_reply:
+               break;
+       case nlm4_deadlock:
+               status = nlm_lck_denied;
+               break;
+       default:
+               status = nlm_lck_denied_nolocks;
        }
 
-       return (status);
+       return status;
 }
-#define        cast_status(status) (cast_to_nlm(status, rqstp->rq_vers))
 #else
-#define cast_status(status) (status)
+static inline __be32 cast_status(__be32 status)
+{
+       return status;
+}
 #endif
 
 /*