Skip to content

Commit 6604148

Browse files
committed
NFSD: Remove "inline" directives on op_rsize_bop helpers
These helpers are always invoked indirectly, so the compiler can't inline these anyway. While we're updating the synopses of these helpers, defensively convert their parameters to const pointers. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 9993a66 commit 6604148

2 files changed

Lines changed: 77 additions & 47 deletions

File tree

fs/nfsd/nfs4proc.c

Lines changed: 75 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2771,28 +2771,33 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
27712771

27722772
#define op_encode_channel_attrs_maxsz (6 + 1 + 1)
27732773

2774-
static inline u32 nfsd4_only_status_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2774+
static u32 nfsd4_only_status_rsize(const struct svc_rqst *rqstp,
2775+
const struct nfsd4_op *op)
27752776
{
27762777
return (op_encode_hdr_size) * sizeof(__be32);
27772778
}
27782779

2779-
static inline u32 nfsd4_status_stateid_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2780+
static u32 nfsd4_status_stateid_rsize(const struct svc_rqst *rqstp,
2781+
const struct nfsd4_op *op)
27802782
{
27812783
return (op_encode_hdr_size + op_encode_stateid_maxsz)* sizeof(__be32);
27822784
}
27832785

2784-
static inline u32 nfsd4_access_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2786+
static u32 nfsd4_access_rsize(const struct svc_rqst *rqstp,
2787+
const struct nfsd4_op *op)
27852788
{
27862789
/* ac_supported, ac_resp_access */
27872790
return (op_encode_hdr_size + 2)* sizeof(__be32);
27882791
}
27892792

2790-
static inline u32 nfsd4_commit_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2793+
static u32 nfsd4_commit_rsize(const struct svc_rqst *rqstp,
2794+
const struct nfsd4_op *op)
27912795
{
27922796
return (op_encode_hdr_size + op_encode_verifier_maxsz) * sizeof(__be32);
27932797
}
27942798

2795-
static inline u32 nfsd4_create_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2799+
static u32 nfsd4_create_rsize(const struct svc_rqst *rqstp,
2800+
const struct nfsd4_op *op)
27962801
{
27972802
return (op_encode_hdr_size + op_encode_change_info_maxsz
27982803
+ nfs4_fattr_bitmap_maxsz) * sizeof(__be32);
@@ -2803,10 +2808,10 @@ static inline u32 nfsd4_create_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op
28032808
* the op prematurely if the estimate is too large. We may turn off splice
28042809
* reads unnecessarily.
28052810
*/
2806-
static inline u32 nfsd4_getattr_rsize(struct svc_rqst *rqstp,
2807-
struct nfsd4_op *op)
2811+
static u32 nfsd4_getattr_rsize(const struct svc_rqst *rqstp,
2812+
const struct nfsd4_op *op)
28082813
{
2809-
u32 *bmap = op->u.getattr.ga_bmval;
2814+
const u32 *bmap = op->u.getattr.ga_bmval;
28102815
u32 bmap0 = bmap[0], bmap1 = bmap[1], bmap2 = bmap[2];
28112816
u32 ret = 0;
28122817

@@ -2841,32 +2846,37 @@ static inline u32 nfsd4_getattr_rsize(struct svc_rqst *rqstp,
28412846
return ret;
28422847
}
28432848

2844-
static inline u32 nfsd4_getfh_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2849+
static u32 nfsd4_getfh_rsize(const struct svc_rqst *rqstp,
2850+
const struct nfsd4_op *op)
28452851
{
28462852
return (op_encode_hdr_size + 1) * sizeof(__be32) + NFS4_FHSIZE;
28472853
}
28482854

2849-
static inline u32 nfsd4_link_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2855+
static u32 nfsd4_link_rsize(const struct svc_rqst *rqstp,
2856+
const struct nfsd4_op *op)
28502857
{
28512858
return (op_encode_hdr_size + op_encode_change_info_maxsz)
28522859
* sizeof(__be32);
28532860
}
28542861

2855-
static inline u32 nfsd4_lock_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2862+
static u32 nfsd4_lock_rsize(const struct svc_rqst *rqstp,
2863+
const struct nfsd4_op *op)
28562864
{
28572865
return (op_encode_hdr_size + op_encode_lock_denied_maxsz)
28582866
* sizeof(__be32);
28592867
}
28602868

2861-
static inline u32 nfsd4_open_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2869+
static u32 nfsd4_open_rsize(const struct svc_rqst *rqstp,
2870+
const struct nfsd4_op *op)
28622871
{
28632872
return (op_encode_hdr_size + op_encode_stateid_maxsz
28642873
+ op_encode_change_info_maxsz + 1
28652874
+ nfs4_fattr_bitmap_maxsz
28662875
+ op_encode_delegation_maxsz) * sizeof(__be32);
28672876
}
28682877

2869-
static inline u32 nfsd4_read_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2878+
static u32 nfsd4_read_rsize(const struct svc_rqst *rqstp,
2879+
const struct nfsd4_op *op)
28702880
{
28712881
u32 maxcount = 0, rlen = 0;
28722882

@@ -2876,7 +2886,8 @@ static inline u32 nfsd4_read_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
28762886
return (op_encode_hdr_size + 2 + XDR_QUADLEN(rlen)) * sizeof(__be32);
28772887
}
28782888

2879-
static inline u32 nfsd4_read_plus_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2889+
static u32 nfsd4_read_plus_rsize(const struct svc_rqst *rqstp,
2890+
const struct nfsd4_op *op)
28802891
{
28812892
u32 maxcount = svc_max_payload(rqstp);
28822893
u32 rlen = min(op->u.read.rd_length, maxcount);
@@ -2890,7 +2901,8 @@ static inline u32 nfsd4_read_plus_rsize(struct svc_rqst *rqstp, struct nfsd4_op
28902901
return (op_encode_hdr_size + 2 + seg_len + XDR_QUADLEN(rlen)) * sizeof(__be32);
28912902
}
28922903

2893-
static inline u32 nfsd4_readdir_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2904+
static u32 nfsd4_readdir_rsize(const struct svc_rqst *rqstp,
2905+
const struct nfsd4_op *op)
28942906
{
28952907
u32 maxcount = 0, rlen = 0;
28962908

@@ -2901,59 +2913,68 @@ static inline u32 nfsd4_readdir_rsize(struct svc_rqst *rqstp, struct nfsd4_op *o
29012913
XDR_QUADLEN(rlen)) * sizeof(__be32);
29022914
}
29032915

2904-
static inline u32 nfsd4_readlink_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2916+
static u32 nfsd4_readlink_rsize(const struct svc_rqst *rqstp,
2917+
const struct nfsd4_op *op)
29052918
{
29062919
return (op_encode_hdr_size + 1) * sizeof(__be32) + PAGE_SIZE;
29072920
}
29082921

2909-
static inline u32 nfsd4_remove_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2922+
static u32 nfsd4_remove_rsize(const struct svc_rqst *rqstp,
2923+
const struct nfsd4_op *op)
29102924
{
29112925
return (op_encode_hdr_size + op_encode_change_info_maxsz)
29122926
* sizeof(__be32);
29132927
}
29142928

2915-
static inline u32 nfsd4_rename_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2929+
static u32 nfsd4_rename_rsize(const struct svc_rqst *rqstp,
2930+
const struct nfsd4_op *op)
29162931
{
29172932
return (op_encode_hdr_size + op_encode_change_info_maxsz
29182933
+ op_encode_change_info_maxsz) * sizeof(__be32);
29192934
}
29202935

2921-
static inline u32 nfsd4_sequence_rsize(struct svc_rqst *rqstp,
2922-
struct nfsd4_op *op)
2936+
static u32 nfsd4_sequence_rsize(const struct svc_rqst *rqstp,
2937+
const struct nfsd4_op *op)
29232938
{
29242939
return (op_encode_hdr_size
29252940
+ XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 5) * sizeof(__be32);
29262941
}
29272942

2928-
static inline u32 nfsd4_test_stateid_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2943+
static u32 nfsd4_test_stateid_rsize(const struct svc_rqst *rqstp,
2944+
const struct nfsd4_op *op)
29292945
{
29302946
return (op_encode_hdr_size + 1 + op->u.test_stateid.ts_num_ids)
29312947
* sizeof(__be32);
29322948
}
29332949

2934-
static inline u32 nfsd4_setattr_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2950+
static u32 nfsd4_setattr_rsize(const struct svc_rqst *rqstp,
2951+
const struct nfsd4_op *op)
29352952
{
29362953
return (op_encode_hdr_size + nfs4_fattr_bitmap_maxsz) * sizeof(__be32);
29372954
}
29382955

2939-
static inline u32 nfsd4_secinfo_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2956+
static u32 nfsd4_secinfo_rsize(const struct svc_rqst *rqstp,
2957+
const struct nfsd4_op *op)
29402958
{
29412959
return (op_encode_hdr_size + RPC_AUTH_MAXFLAVOR *
29422960
(4 + XDR_QUADLEN(GSS_OID_MAX_LEN))) * sizeof(__be32);
29432961
}
29442962

2945-
static inline u32 nfsd4_setclientid_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2963+
static u32 nfsd4_setclientid_rsize(const struct svc_rqst *rqstp,
2964+
const struct nfsd4_op *op)
29462965
{
29472966
return (op_encode_hdr_size + 2 + XDR_QUADLEN(NFS4_VERIFIER_SIZE)) *
29482967
sizeof(__be32);
29492968
}
29502969

2951-
static inline u32 nfsd4_write_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2970+
static u32 nfsd4_write_rsize(const struct svc_rqst *rqstp,
2971+
const struct nfsd4_op *op)
29522972
{
29532973
return (op_encode_hdr_size + 2 + op_encode_verifier_maxsz) * sizeof(__be32);
29542974
}
29552975

2956-
static inline u32 nfsd4_exchange_id_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2976+
static u32 nfsd4_exchange_id_rsize(const struct svc_rqst *rqstp,
2977+
const struct nfsd4_op *op)
29572978
{
29582979
return (op_encode_hdr_size + 2 + 1 + /* eir_clientid, eir_sequenceid */\
29592980
1 + 1 + /* eir_flags, spr_how */\
@@ -2967,14 +2988,16 @@ static inline u32 nfsd4_exchange_id_rsize(struct svc_rqst *rqstp, struct nfsd4_o
29672988
0 /* ignored eir_server_impl_id contents */) * sizeof(__be32);
29682989
}
29692990

2970-
static inline u32 nfsd4_bind_conn_to_session_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2991+
static u32 nfsd4_bind_conn_to_session_rsize(const struct svc_rqst *rqstp,
2992+
const struct nfsd4_op *op)
29712993
{
29722994
return (op_encode_hdr_size + \
29732995
XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + /* bctsr_sessid */\
29742996
2 /* bctsr_dir, use_conn_in_rdma_mode */) * sizeof(__be32);
29752997
}
29762998

2977-
static inline u32 nfsd4_create_session_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2999+
static u32 nfsd4_create_session_rsize(const struct svc_rqst *rqstp,
3000+
const struct nfsd4_op *op)
29783001
{
29793002
return (op_encode_hdr_size + \
29803003
XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + /* sessionid */\
@@ -2983,7 +3006,8 @@ static inline u32 nfsd4_create_session_rsize(struct svc_rqst *rqstp, struct nfsd
29833006
op_encode_channel_attrs_maxsz) * sizeof(__be32);
29843007
}
29853008

2986-
static inline u32 nfsd4_copy_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
3009+
static u32 nfsd4_copy_rsize(const struct svc_rqst *rqstp,
3010+
const struct nfsd4_op *op)
29873011
{
29883012
return (op_encode_hdr_size +
29893013
1 /* wr_callback */ +
@@ -2995,16 +3019,16 @@ static inline u32 nfsd4_copy_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
29953019
1 /* cr_synchronous */) * sizeof(__be32);
29963020
}
29973021

2998-
static inline u32 nfsd4_offload_status_rsize(struct svc_rqst *rqstp,
2999-
struct nfsd4_op *op)
3022+
static u32 nfsd4_offload_status_rsize(const struct svc_rqst *rqstp,
3023+
const struct nfsd4_op *op)
30003024
{
30013025
return (op_encode_hdr_size +
30023026
2 /* osr_count */ +
30033027
1 /* osr_complete<1> optional 0 for now */) * sizeof(__be32);
30043028
}
30053029

3006-
static inline u32 nfsd4_copy_notify_rsize(struct svc_rqst *rqstp,
3007-
struct nfsd4_op *op)
3030+
static u32 nfsd4_copy_notify_rsize(const struct svc_rqst *rqstp,
3031+
const struct nfsd4_op *op)
30083032
{
30093033
return (op_encode_hdr_size +
30103034
3 /* cnr_lease_time */ +
@@ -3019,7 +3043,8 @@ static inline u32 nfsd4_copy_notify_rsize(struct svc_rqst *rqstp,
30193043
}
30203044

30213045
#ifdef CONFIG_NFSD_PNFS
3022-
static inline u32 nfsd4_getdeviceinfo_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
3046+
static u32 nfsd4_getdeviceinfo_rsize(const struct svc_rqst *rqstp,
3047+
const struct nfsd4_op *op)
30233048
{
30243049
u32 maxcount = 0, rlen = 0;
30253050

@@ -3037,7 +3062,8 @@ static inline u32 nfsd4_getdeviceinfo_rsize(struct svc_rqst *rqstp, struct nfsd4
30373062
* so we need to define an arbitrary upper bound here.
30383063
*/
30393064
#define MAX_LAYOUT_SIZE 128
3040-
static inline u32 nfsd4_layoutget_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
3065+
static u32 nfsd4_layoutget_rsize(const struct svc_rqst *rqstp,
3066+
const struct nfsd4_op *op)
30413067
{
30423068
return (op_encode_hdr_size +
30433069
1 /* logr_return_on_close */ +
@@ -3046,14 +3072,16 @@ static inline u32 nfsd4_layoutget_rsize(struct svc_rqst *rqstp, struct nfsd4_op
30463072
MAX_LAYOUT_SIZE) * sizeof(__be32);
30473073
}
30483074

3049-
static inline u32 nfsd4_layoutcommit_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
3075+
static u32 nfsd4_layoutcommit_rsize(const struct svc_rqst *rqstp,
3076+
const struct nfsd4_op *op)
30503077
{
30513078
return (op_encode_hdr_size +
30523079
1 /* locr_newsize */ +
30533080
2 /* ns_size */) * sizeof(__be32);
30543081
}
30553082

3056-
static inline u32 nfsd4_layoutreturn_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
3083+
static u32 nfsd4_layoutreturn_rsize(const struct svc_rqst *rqstp,
3084+
const struct nfsd4_op *op)
30573085
{
30583086
return (op_encode_hdr_size +
30593087
1 /* lrs_stateid */ +
@@ -3062,13 +3090,14 @@ static inline u32 nfsd4_layoutreturn_rsize(struct svc_rqst *rqstp, struct nfsd4_
30623090
#endif /* CONFIG_NFSD_PNFS */
30633091

30643092

3065-
static inline u32 nfsd4_seek_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
3093+
static u32 nfsd4_seek_rsize(const struct svc_rqst *rqstp,
3094+
const struct nfsd4_op *op)
30663095
{
30673096
return (op_encode_hdr_size + 3) * sizeof(__be32);
30683097
}
30693098

3070-
static inline u32 nfsd4_getxattr_rsize(struct svc_rqst *rqstp,
3071-
struct nfsd4_op *op)
3099+
static u32 nfsd4_getxattr_rsize(const struct svc_rqst *rqstp,
3100+
const struct nfsd4_op *op)
30723101
{
30733102
u32 maxcount, rlen;
30743103

@@ -3078,14 +3107,14 @@ static inline u32 nfsd4_getxattr_rsize(struct svc_rqst *rqstp,
30783107
return (op_encode_hdr_size + 1 + XDR_QUADLEN(rlen)) * sizeof(__be32);
30793108
}
30803109

3081-
static inline u32 nfsd4_setxattr_rsize(struct svc_rqst *rqstp,
3082-
struct nfsd4_op *op)
3110+
static u32 nfsd4_setxattr_rsize(const struct svc_rqst *rqstp,
3111+
const struct nfsd4_op *op)
30833112
{
30843113
return (op_encode_hdr_size + op_encode_change_info_maxsz)
30853114
* sizeof(__be32);
30863115
}
3087-
static inline u32 nfsd4_listxattrs_rsize(struct svc_rqst *rqstp,
3088-
struct nfsd4_op *op)
3116+
static u32 nfsd4_listxattrs_rsize(const struct svc_rqst *rqstp,
3117+
const struct nfsd4_op *op)
30893118
{
30903119
u32 maxcount, rlen;
30913120

@@ -3095,8 +3124,8 @@ static inline u32 nfsd4_listxattrs_rsize(struct svc_rqst *rqstp,
30953124
return (op_encode_hdr_size + 4 + XDR_QUADLEN(rlen)) * sizeof(__be32);
30963125
}
30973126

3098-
static inline u32 nfsd4_removexattr_rsize(struct svc_rqst *rqstp,
3099-
struct nfsd4_op *op)
3127+
static u32 nfsd4_removexattr_rsize(const struct svc_rqst *rqstp,
3128+
const struct nfsd4_op *op)
31003129
{
31013130
return (op_encode_hdr_size + op_encode_change_info_maxsz)
31023131
* sizeof(__be32);

fs/nfsd/xdr4.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,8 @@ struct nfsd4_operation {
889889
u32 op_flags;
890890
char *op_name;
891891
/* Try to get response size before operation */
892-
u32 (*op_rsize_bop)(struct svc_rqst *, struct nfsd4_op *);
892+
u32 (*op_rsize_bop)(const struct svc_rqst *rqstp,
893+
const struct nfsd4_op *op);
893894
void (*op_get_currentstateid)(struct nfsd4_compound_state *,
894895
union nfsd4_op_u *);
895896
void (*op_set_currentstateid)(struct nfsd4_compound_state *,

0 commit comments

Comments
 (0)