Skip to content

Commit 4f22ccc

Browse files
\"Talpey, Thomas\Trond Myklebust
authored andcommitted
SUNRPC: mark bulk read/write data in xdrbuf
Adds a flag word to the xdrbuf struct which indicates any bulk disposition of the data. This enables RPC transport providers to marshal it efficiently/appropriately, and may enable other optimizations. Signed-off-by: Tom Talpey <tmt@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
1 parent 20c71f5 commit 4f22ccc

5 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎fs/nfs/nfs2xdr.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ nfs_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args)
251251
replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS_readres_sz) << 2;
252252
xdr_inline_pages(&req->rq_rcv_buf, replen,
253253
args->pages, args->pgbase, count);
254+
req->rq_rcv_buf.flags |= XDRBUF_READ;
254255
return 0;
255256
}
256257

@@ -313,6 +314,7 @@ nfs_xdr_writeargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args)
313314

314315
/* Copy the page array */
315316
xdr_encode_pages(sndbuf, args->pages, args->pgbase, count);
317+
sndbuf->flags |= XDRBUF_WRITE;
316318
return 0;
317319
}
318320

‎fs/nfs/nfs3xdr.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ nfs3_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args)
346346
replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS3_readres_sz) << 2;
347347
xdr_inline_pages(&req->rq_rcv_buf, replen,
348348
args->pages, args->pgbase, count);
349+
req->rq_rcv_buf.flags |= XDRBUF_READ;
349350
return 0;
350351
}
351352

@@ -367,6 +368,7 @@ nfs3_xdr_writeargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args)
367368

368369
/* Copy the page array */
369370
xdr_encode_pages(sndbuf, args->pages, args->pgbase, count);
371+
sndbuf->flags |= XDRBUF_WRITE;
370372
return 0;
371373
}
372374

‎fs/nfs/nfs4xdr.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,6 +1856,7 @@ static int nfs4_xdr_enc_read(struct rpc_rqst *req, __be32 *p, struct nfs_readarg
18561856
replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_read_sz) << 2;
18571857
xdr_inline_pages(&req->rq_rcv_buf, replen,
18581858
args->pages, args->pgbase, args->count);
1859+
req->rq_rcv_buf.flags |= XDRBUF_READ;
18591860
out:
18601861
return status;
18611862
}
@@ -1932,6 +1933,7 @@ static int nfs4_xdr_enc_write(struct rpc_rqst *req, __be32 *p, struct nfs_writea
19321933
status = encode_write(&xdr, args);
19331934
if (status)
19341935
goto out;
1936+
req->rq_snd_buf.flags |= XDRBUF_WRITE;
19351937
status = encode_getfattr(&xdr, args->bitmask);
19361938
out:
19371939
return status;

‎include/linux/sunrpc/xdr.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ struct xdr_buf {
7070

7171
struct page ** pages; /* Array of contiguous pages */
7272
unsigned int page_base, /* Start of page data */
73-
page_len; /* Length of page data */
73+
page_len, /* Length of page data */
74+
flags; /* Flags for data disposition */
75+
#define XDRBUF_READ 0x01 /* target of file read */
76+
#define XDRBUF_WRITE 0x02 /* source of file write */
7477

7578
unsigned int buflen, /* Total length of storage buffer */
7679
len; /* Length of XDR encoded message */

‎net/sunrpc/clnt.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,7 @@ rpc_xdr_buf_init(struct xdr_buf *buf, void *start, size_t len)
874874
buf->head[0].iov_len = len;
875875
buf->tail[0].iov_len = 0;
876876
buf->page_len = 0;
877+
buf->flags = 0;
877878
buf->len = 0;
878879
buf->buflen = len;
879880
}

0 commit comments

Comments
 (0)