NFSD: Remove "inline" directives on op_rsize_bop helpers

[ Upstream commit 6604148cf961b57fc735e4204f8996536da9253c ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Chuck Lever 2022-09-12 17:23:25 -04:00 committed by Ksawlii
parent ad36491e05
commit b9f25e7749
2 changed files with 77 additions and 47 deletions

View file

@ -2759,28 +2759,33 @@ out:
#define op_encode_channel_attrs_maxsz (6 + 1 + 1) #define op_encode_channel_attrs_maxsz (6 + 1 + 1)
static inline u32 nfsd4_only_status_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_only_status_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size) * sizeof(__be32); return (op_encode_hdr_size) * sizeof(__be32);
} }
static inline u32 nfsd4_status_stateid_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_status_stateid_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + op_encode_stateid_maxsz)* sizeof(__be32); return (op_encode_hdr_size + op_encode_stateid_maxsz)* sizeof(__be32);
} }
static inline u32 nfsd4_access_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_access_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
/* ac_supported, ac_resp_access */ /* ac_supported, ac_resp_access */
return (op_encode_hdr_size + 2)* sizeof(__be32); return (op_encode_hdr_size + 2)* sizeof(__be32);
} }
static inline u32 nfsd4_commit_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_commit_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + op_encode_verifier_maxsz) * sizeof(__be32); return (op_encode_hdr_size + op_encode_verifier_maxsz) * sizeof(__be32);
} }
static inline u32 nfsd4_create_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_create_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + op_encode_change_info_maxsz return (op_encode_hdr_size + op_encode_change_info_maxsz
+ nfs4_fattr_bitmap_maxsz) * sizeof(__be32); + nfs4_fattr_bitmap_maxsz) * sizeof(__be32);
@ -2791,10 +2796,10 @@ static inline u32 nfsd4_create_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op
* the op prematurely if the estimate is too large. We may turn off splice * the op prematurely if the estimate is too large. We may turn off splice
* reads unnecessarily. * reads unnecessarily.
*/ */
static inline u32 nfsd4_getattr_rsize(struct svc_rqst *rqstp, static u32 nfsd4_getattr_rsize(const struct svc_rqst *rqstp,
struct nfsd4_op *op) const struct nfsd4_op *op)
{ {
u32 *bmap = op->u.getattr.ga_bmval; const u32 *bmap = op->u.getattr.ga_bmval;
u32 bmap0 = bmap[0], bmap1 = bmap[1], bmap2 = bmap[2]; u32 bmap0 = bmap[0], bmap1 = bmap[1], bmap2 = bmap[2];
u32 ret = 0; u32 ret = 0;
@ -2829,24 +2834,28 @@ static inline u32 nfsd4_getattr_rsize(struct svc_rqst *rqstp,
return ret; return ret;
} }
static inline u32 nfsd4_getfh_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_getfh_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + 1) * sizeof(__be32) + NFS4_FHSIZE; return (op_encode_hdr_size + 1) * sizeof(__be32) + NFS4_FHSIZE;
} }
static inline u32 nfsd4_link_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_link_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + op_encode_change_info_maxsz) return (op_encode_hdr_size + op_encode_change_info_maxsz)
* sizeof(__be32); * sizeof(__be32);
} }
static inline u32 nfsd4_lock_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_lock_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + op_encode_lock_denied_maxsz) return (op_encode_hdr_size + op_encode_lock_denied_maxsz)
* sizeof(__be32); * sizeof(__be32);
} }
static inline u32 nfsd4_open_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_open_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + op_encode_stateid_maxsz return (op_encode_hdr_size + op_encode_stateid_maxsz
+ op_encode_change_info_maxsz + 1 + op_encode_change_info_maxsz + 1
@ -2854,7 +2863,8 @@ static inline u32 nfsd4_open_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
+ op_encode_delegation_maxsz) * sizeof(__be32); + op_encode_delegation_maxsz) * sizeof(__be32);
} }
static inline u32 nfsd4_read_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_read_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
u32 maxcount = 0, rlen = 0; u32 maxcount = 0, rlen = 0;
@ -2864,7 +2874,8 @@ static inline u32 nfsd4_read_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
return (op_encode_hdr_size + 2 + XDR_QUADLEN(rlen)) * sizeof(__be32); return (op_encode_hdr_size + 2 + XDR_QUADLEN(rlen)) * sizeof(__be32);
} }
static inline u32 nfsd4_read_plus_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_read_plus_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
u32 maxcount = svc_max_payload(rqstp); u32 maxcount = svc_max_payload(rqstp);
u32 rlen = min(op->u.read.rd_length, maxcount); u32 rlen = min(op->u.read.rd_length, maxcount);
@ -2878,7 +2889,8 @@ static inline u32 nfsd4_read_plus_rsize(struct svc_rqst *rqstp, struct nfsd4_op
return (op_encode_hdr_size + 2 + seg_len + XDR_QUADLEN(rlen)) * sizeof(__be32); return (op_encode_hdr_size + 2 + seg_len + XDR_QUADLEN(rlen)) * sizeof(__be32);
} }
static inline u32 nfsd4_readdir_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_readdir_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
u32 maxcount = 0, rlen = 0; u32 maxcount = 0, rlen = 0;
@ -2889,59 +2901,68 @@ static inline u32 nfsd4_readdir_rsize(struct svc_rqst *rqstp, struct nfsd4_op *o
XDR_QUADLEN(rlen)) * sizeof(__be32); XDR_QUADLEN(rlen)) * sizeof(__be32);
} }
static inline u32 nfsd4_readlink_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_readlink_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + 1) * sizeof(__be32) + PAGE_SIZE; return (op_encode_hdr_size + 1) * sizeof(__be32) + PAGE_SIZE;
} }
static inline u32 nfsd4_remove_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_remove_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + op_encode_change_info_maxsz) return (op_encode_hdr_size + op_encode_change_info_maxsz)
* sizeof(__be32); * sizeof(__be32);
} }
static inline u32 nfsd4_rename_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_rename_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + op_encode_change_info_maxsz return (op_encode_hdr_size + op_encode_change_info_maxsz
+ op_encode_change_info_maxsz) * sizeof(__be32); + op_encode_change_info_maxsz) * sizeof(__be32);
} }
static inline u32 nfsd4_sequence_rsize(struct svc_rqst *rqstp, static u32 nfsd4_sequence_rsize(const struct svc_rqst *rqstp,
struct nfsd4_op *op) const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size return (op_encode_hdr_size
+ XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 5) * sizeof(__be32); + XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 5) * sizeof(__be32);
} }
static inline u32 nfsd4_test_stateid_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_test_stateid_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + 1 + op->u.test_stateid.ts_num_ids) return (op_encode_hdr_size + 1 + op->u.test_stateid.ts_num_ids)
* sizeof(__be32); * sizeof(__be32);
} }
static inline u32 nfsd4_setattr_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_setattr_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + nfs4_fattr_bitmap_maxsz) * sizeof(__be32); return (op_encode_hdr_size + nfs4_fattr_bitmap_maxsz) * sizeof(__be32);
} }
static inline u32 nfsd4_secinfo_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_secinfo_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + RPC_AUTH_MAXFLAVOR * return (op_encode_hdr_size + RPC_AUTH_MAXFLAVOR *
(4 + XDR_QUADLEN(GSS_OID_MAX_LEN))) * sizeof(__be32); (4 + XDR_QUADLEN(GSS_OID_MAX_LEN))) * sizeof(__be32);
} }
static inline u32 nfsd4_setclientid_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_setclientid_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + 2 + XDR_QUADLEN(NFS4_VERIFIER_SIZE)) * return (op_encode_hdr_size + 2 + XDR_QUADLEN(NFS4_VERIFIER_SIZE)) *
sizeof(__be32); sizeof(__be32);
} }
static inline u32 nfsd4_write_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_write_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + 2 + op_encode_verifier_maxsz) * sizeof(__be32); return (op_encode_hdr_size + 2 + op_encode_verifier_maxsz) * sizeof(__be32);
} }
static inline u32 nfsd4_exchange_id_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_exchange_id_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + 2 + 1 + /* eir_clientid, eir_sequenceid */\ return (op_encode_hdr_size + 2 + 1 + /* eir_clientid, eir_sequenceid */\
1 + 1 + /* eir_flags, spr_how */\ 1 + 1 + /* eir_flags, spr_how */\
@ -2955,14 +2976,16 @@ static inline u32 nfsd4_exchange_id_rsize(struct svc_rqst *rqstp, struct nfsd4_o
0 /* ignored eir_server_impl_id contents */) * sizeof(__be32); 0 /* ignored eir_server_impl_id contents */) * sizeof(__be32);
} }
static inline u32 nfsd4_bind_conn_to_session_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_bind_conn_to_session_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + \ return (op_encode_hdr_size + \
XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + /* bctsr_sessid */\ XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + /* bctsr_sessid */\
2 /* bctsr_dir, use_conn_in_rdma_mode */) * sizeof(__be32); 2 /* bctsr_dir, use_conn_in_rdma_mode */) * sizeof(__be32);
} }
static inline u32 nfsd4_create_session_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_create_session_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + \ return (op_encode_hdr_size + \
XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + /* sessionid */\ XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + /* sessionid */\
@ -2971,7 +2994,8 @@ static inline u32 nfsd4_create_session_rsize(struct svc_rqst *rqstp, struct nfsd
op_encode_channel_attrs_maxsz) * sizeof(__be32); op_encode_channel_attrs_maxsz) * sizeof(__be32);
} }
static inline u32 nfsd4_copy_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_copy_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + return (op_encode_hdr_size +
1 /* wr_callback */ + 1 /* wr_callback */ +
@ -2983,16 +3007,16 @@ static inline u32 nfsd4_copy_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
1 /* cr_synchronous */) * sizeof(__be32); 1 /* cr_synchronous */) * sizeof(__be32);
} }
static inline u32 nfsd4_offload_status_rsize(struct svc_rqst *rqstp, static u32 nfsd4_offload_status_rsize(const struct svc_rqst *rqstp,
struct nfsd4_op *op) const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + return (op_encode_hdr_size +
2 /* osr_count */ + 2 /* osr_count */ +
1 /* osr_complete<1> optional 0 for now */) * sizeof(__be32); 1 /* osr_complete<1> optional 0 for now */) * sizeof(__be32);
} }
static inline u32 nfsd4_copy_notify_rsize(struct svc_rqst *rqstp, static u32 nfsd4_copy_notify_rsize(const struct svc_rqst *rqstp,
struct nfsd4_op *op) const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + return (op_encode_hdr_size +
3 /* cnr_lease_time */ + 3 /* cnr_lease_time */ +
@ -3007,7 +3031,8 @@ static inline u32 nfsd4_copy_notify_rsize(struct svc_rqst *rqstp,
} }
#ifdef CONFIG_NFSD_PNFS #ifdef CONFIG_NFSD_PNFS
static inline u32 nfsd4_getdeviceinfo_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_getdeviceinfo_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
u32 maxcount = 0, rlen = 0; u32 maxcount = 0, rlen = 0;
@ -3025,7 +3050,8 @@ static inline u32 nfsd4_getdeviceinfo_rsize(struct svc_rqst *rqstp, struct nfsd4
* so we need to define an arbitrary upper bound here. * so we need to define an arbitrary upper bound here.
*/ */
#define MAX_LAYOUT_SIZE 128 #define MAX_LAYOUT_SIZE 128
static inline u32 nfsd4_layoutget_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_layoutget_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + return (op_encode_hdr_size +
1 /* logr_return_on_close */ + 1 /* logr_return_on_close */ +
@ -3034,14 +3060,16 @@ static inline u32 nfsd4_layoutget_rsize(struct svc_rqst *rqstp, struct nfsd4_op
MAX_LAYOUT_SIZE) * sizeof(__be32); MAX_LAYOUT_SIZE) * sizeof(__be32);
} }
static inline u32 nfsd4_layoutcommit_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_layoutcommit_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + return (op_encode_hdr_size +
1 /* locr_newsize */ + 1 /* locr_newsize */ +
2 /* ns_size */) * sizeof(__be32); 2 /* ns_size */) * sizeof(__be32);
} }
static inline u32 nfsd4_layoutreturn_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_layoutreturn_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + return (op_encode_hdr_size +
1 /* lrs_stateid */ + 1 /* lrs_stateid */ +
@ -3050,13 +3078,14 @@ static inline u32 nfsd4_layoutreturn_rsize(struct svc_rqst *rqstp, struct nfsd4_
#endif /* CONFIG_NFSD_PNFS */ #endif /* CONFIG_NFSD_PNFS */
static inline u32 nfsd4_seek_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static u32 nfsd4_seek_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + 3) * sizeof(__be32); return (op_encode_hdr_size + 3) * sizeof(__be32);
} }
static inline u32 nfsd4_getxattr_rsize(struct svc_rqst *rqstp, static u32 nfsd4_getxattr_rsize(const struct svc_rqst *rqstp,
struct nfsd4_op *op) const struct nfsd4_op *op)
{ {
u32 maxcount, rlen; u32 maxcount, rlen;
@ -3066,14 +3095,14 @@ static inline u32 nfsd4_getxattr_rsize(struct svc_rqst *rqstp,
return (op_encode_hdr_size + 1 + XDR_QUADLEN(rlen)) * sizeof(__be32); return (op_encode_hdr_size + 1 + XDR_QUADLEN(rlen)) * sizeof(__be32);
} }
static inline u32 nfsd4_setxattr_rsize(struct svc_rqst *rqstp, static u32 nfsd4_setxattr_rsize(const struct svc_rqst *rqstp,
struct nfsd4_op *op) const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + op_encode_change_info_maxsz) return (op_encode_hdr_size + op_encode_change_info_maxsz)
* sizeof(__be32); * sizeof(__be32);
} }
static inline u32 nfsd4_listxattrs_rsize(struct svc_rqst *rqstp, static u32 nfsd4_listxattrs_rsize(const struct svc_rqst *rqstp,
struct nfsd4_op *op) const struct nfsd4_op *op)
{ {
u32 maxcount, rlen; u32 maxcount, rlen;
@ -3083,8 +3112,8 @@ static inline u32 nfsd4_listxattrs_rsize(struct svc_rqst *rqstp,
return (op_encode_hdr_size + 4 + XDR_QUADLEN(rlen)) * sizeof(__be32); return (op_encode_hdr_size + 4 + XDR_QUADLEN(rlen)) * sizeof(__be32);
} }
static inline u32 nfsd4_removexattr_rsize(struct svc_rqst *rqstp, static u32 nfsd4_removexattr_rsize(const struct svc_rqst *rqstp,
struct nfsd4_op *op) const struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + op_encode_change_info_maxsz) return (op_encode_hdr_size + op_encode_change_info_maxsz)
* sizeof(__be32); * sizeof(__be32);

View file

@ -889,7 +889,8 @@ struct nfsd4_operation {
u32 op_flags; u32 op_flags;
char *op_name; char *op_name;
/* Try to get response size before operation */ /* Try to get response size before operation */
u32 (*op_rsize_bop)(struct svc_rqst *, struct nfsd4_op *); u32 (*op_rsize_bop)(const struct svc_rqst *rqstp,
const struct nfsd4_op *op);
void (*op_get_currentstateid)(struct nfsd4_compound_state *, void (*op_get_currentstateid)(struct nfsd4_compound_state *,
union nfsd4_op_u *); union nfsd4_op_u *);
void (*op_set_currentstateid)(struct nfsd4_compound_state *, void (*op_set_currentstateid)(struct nfsd4_compound_state *,