Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

lockd: Simplify cast_status() in svcproc.c

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>

+19 -21
+19 -21
fs/lockd/svcproc.c
··· 17 17 #define NLMDBG_FACILITY NLMDBG_CLIENT 18 18 19 19 #ifdef CONFIG_LOCKD_V4 20 - static __be32 21 - cast_to_nlm(__be32 status, u32 vers) 20 + static inline __be32 cast_status(__be32 status) 22 21 { 23 - /* Note: status is assumed to be in network byte order !!! */ 24 - if (vers != 4){ 25 - switch (status) { 26 - case nlm_granted: 27 - case nlm_lck_denied: 28 - case nlm_lck_denied_nolocks: 29 - case nlm_lck_blocked: 30 - case nlm_lck_denied_grace_period: 31 - case nlm_drop_reply: 32 - break; 33 - case nlm4_deadlock: 34 - status = nlm_lck_denied; 35 - break; 36 - default: 37 - status = nlm_lck_denied_nolocks; 38 - } 22 + switch (status) { 23 + case nlm_granted: 24 + case nlm_lck_denied: 25 + case nlm_lck_denied_nolocks: 26 + case nlm_lck_blocked: 27 + case nlm_lck_denied_grace_period: 28 + case nlm_drop_reply: 29 + break; 30 + case nlm4_deadlock: 31 + status = nlm_lck_denied; 32 + break; 33 + default: 34 + status = nlm_lck_denied_nolocks; 39 35 } 40 36 41 - return (status); 37 + return status; 42 38 } 43 - #define cast_status(status) (cast_to_nlm(status, rqstp->rq_vers)) 44 39 #else 45 - #define cast_status(status) (status) 40 + static inline __be32 cast_status(__be32 status) 41 + { 42 + return status; 43 + } 46 44 #endif 47 45 48 46 /*