You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[PATCH] RPC: skip over transport-specific heads automatically
Add a generic mechanism for skipping over transport-specific headers when constructing an RPC request. This removes another "xprt->stream" dependency. Test-plan: Write-intensive workload on a single mount point (try both UDP and TCP). Signed-off-by: Chuck Lever <cel@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
committed by
Trond Myklebust
parent
262965f53d
commit
808012fbb2
@@ -76,5 +76,30 @@ enum rpc_auth_stat {
|
||||
|
||||
#define RPC_MAXNETNAMELEN 256
|
||||
|
||||
/*
|
||||
* From RFC 1831:
|
||||
*
|
||||
* "A record is composed of one or more record fragments. A record
|
||||
* fragment is a four-byte header followed by 0 to (2**31) - 1 bytes of
|
||||
* fragment data. The bytes encode an unsigned binary number; as with
|
||||
* XDR integers, the byte order is from highest to lowest. The number
|
||||
* encodes two values -- a boolean which indicates whether the fragment
|
||||
* is the last fragment of the record (bit value 1 implies the fragment
|
||||
* is the last fragment) and a 31-bit unsigned binary value which is the
|
||||
* length in bytes of the fragment's data. The boolean value is the
|
||||
* highest-order bit of the header; the length is the 31 low-order bits.
|
||||
* (Note that this record specification is NOT in XDR standard form!)"
|
||||
*
|
||||
* The Linux RPC client always sends its requests in a single record
|
||||
* fragment, limiting the maximum payload size for stream transports to
|
||||
* 2GB.
|
||||
*/
|
||||
|
||||
typedef u32 rpc_fraghdr;
|
||||
|
||||
#define RPC_LAST_STREAM_FRAGMENT (1U << 31)
|
||||
#define RPC_FRAGMENT_SIZE_MASK (~RPC_LAST_STREAM_FRAGMENT)
|
||||
#define RPC_MAX_FRAGMENT_SIZE ((1U << 31) - 1)
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _LINUX_SUNRPC_MSGPROT_H_ */
|
||||
|
||||
@@ -155,6 +155,8 @@ struct rpc_xprt {
|
||||
|
||||
size_t max_payload; /* largest RPC payload size,
|
||||
in bytes */
|
||||
unsigned int tsh_size; /* size of transport specific
|
||||
header */
|
||||
|
||||
struct rpc_wait_queue sending; /* requests waiting to send */
|
||||
struct rpc_wait_queue resend; /* requests waiting to resend */
|
||||
@@ -236,6 +238,11 @@ int xprt_adjust_timeout(struct rpc_rqst *req);
|
||||
void xprt_release(struct rpc_task *task);
|
||||
int xprt_destroy(struct rpc_xprt *xprt);
|
||||
|
||||
static inline u32 *xprt_skip_transport_header(struct rpc_xprt *xprt, u32 *p)
|
||||
{
|
||||
return p + xprt->tsh_size;
|
||||
}
|
||||
|
||||
/*
|
||||
* Transport switch helper functions
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user