Commit a2c91753 authored by Chuck Lever's avatar Chuck Lever

NFSD: Modify NFSv4 to use nfsd_read_splice_ok()

Avoid the use of an atomic bitop, and prepare for adding a run-time
switch for using splice reads.
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent c21fd7a8
...@@ -970,8 +970,11 @@ nfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, ...@@ -970,8 +970,11 @@ nfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
* To ensure proper ordering, we therefore turn off zero copy if * To ensure proper ordering, we therefore turn off zero copy if
* the client wants us to do more in this compound: * the client wants us to do more in this compound:
*/ */
if (!nfsd4_last_compound_op(rqstp)) if (!nfsd4_last_compound_op(rqstp)) {
clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags); struct nfsd4_compoundargs *argp = rqstp->rq_argp;
argp->splice_ok = false;
}
/* check stateid */ /* check stateid */
status = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->current_fh, status = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->current_fh,
......
...@@ -2524,8 +2524,9 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) ...@@ -2524,8 +2524,9 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
svc_reserve(argp->rqstp, max_reply + readbytes); svc_reserve(argp->rqstp, max_reply + readbytes);
argp->rqstp->rq_cachetype = cachethis ? RC_REPLBUFF : RC_NOCACHE; argp->rqstp->rq_cachetype = cachethis ? RC_REPLBUFF : RC_NOCACHE;
argp->splice_ok = nfsd_read_splice_ok(argp->rqstp);
if (readcount > 1 || max_reply > PAGE_SIZE - auth_slack) if (readcount > 1 || max_reply > PAGE_SIZE - auth_slack)
clear_bit(RQ_SPLICE_OK, &argp->rqstp->rq_flags); argp->splice_ok = false;
return true; return true;
} }
...@@ -4375,12 +4376,13 @@ static __be32 ...@@ -4375,12 +4376,13 @@ static __be32
nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr, nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
union nfsd4_op_u *u) union nfsd4_op_u *u)
{ {
struct nfsd4_compoundargs *argp = resp->rqstp->rq_argp;
struct nfsd4_read *read = &u->read; struct nfsd4_read *read = &u->read;
bool splice_ok = test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags);
unsigned long maxcount;
struct xdr_stream *xdr = resp->xdr; struct xdr_stream *xdr = resp->xdr;
struct file *file;
int starting_len = xdr->buf->len; int starting_len = xdr->buf->len;
bool splice_ok = argp->splice_ok;
unsigned long maxcount;
struct file *file;
__be32 *p; __be32 *p;
if (nfserr) if (nfserr)
...@@ -5201,9 +5203,10 @@ static __be32 ...@@ -5201,9 +5203,10 @@ static __be32
nfsd4_encode_read_plus_data(struct nfsd4_compoundres *resp, nfsd4_encode_read_plus_data(struct nfsd4_compoundres *resp,
struct nfsd4_read *read) struct nfsd4_read *read)
{ {
bool splice_ok = test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags); struct nfsd4_compoundargs *argp = resp->rqstp->rq_argp;
struct file *file = read->rd_nf->nf_file; struct file *file = read->rd_nf->nf_file;
struct xdr_stream *xdr = resp->xdr; struct xdr_stream *xdr = resp->xdr;
bool splice_ok = argp->splice_ok;
unsigned long maxcount; unsigned long maxcount;
__be32 nfserr, *p; __be32 nfserr, *p;
......
...@@ -840,6 +840,7 @@ struct nfsd4_compoundargs { ...@@ -840,6 +840,7 @@ struct nfsd4_compoundargs {
u32 minorversion; u32 minorversion;
u32 client_opcnt; u32 client_opcnt;
u32 opcnt; u32 opcnt;
bool splice_ok;
struct nfsd4_op *ops; struct nfsd4_op *ops;
struct nfsd4_op iops[8]; struct nfsd4_op iops[8];
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment