nfsd4: cleanup: replace rq_resused count by rq_next_page pointer
It may be a matter of personal taste, but I find this makes the code clearer. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
@@ -886,7 +886,7 @@ nfsd_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
|
||||
struct splice_desc *sd)
|
||||
{
|
||||
struct svc_rqst *rqstp = sd->u.data;
|
||||
struct page **pp = rqstp->rq_respages + rqstp->rq_resused;
|
||||
struct page **pp = rqstp->rq_next_page;
|
||||
struct page *page = buf->page;
|
||||
size_t size;
|
||||
|
||||
@@ -894,17 +894,15 @@ nfsd_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
|
||||
|
||||
if (rqstp->rq_res.page_len == 0) {
|
||||
get_page(page);
|
||||
put_page(*pp);
|
||||
*pp = page;
|
||||
rqstp->rq_resused++;
|
||||
put_page(*rqstp->rq_next_page);
|
||||
*(rqstp->rq_next_page++) = page;
|
||||
rqstp->rq_res.page_base = buf->offset;
|
||||
rqstp->rq_res.page_len = size;
|
||||
} else if (page != pp[-1]) {
|
||||
get_page(page);
|
||||
if (*pp)
|
||||
put_page(*pp);
|
||||
*pp = page;
|
||||
rqstp->rq_resused++;
|
||||
if (*rqstp->rq_next_page)
|
||||
put_page(*rqstp->rq_next_page);
|
||||
*(rqstp->rq_next_page++) = page;
|
||||
rqstp->rq_res.page_len += size;
|
||||
} else
|
||||
rqstp->rq_res.page_len += size;
|
||||
@@ -936,8 +934,8 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
|
||||
.u.data = rqstp,
|
||||
};
|
||||
|
||||
WARN_ON_ONCE(rqstp->rq_resused != 1);
|
||||
rqstp->rq_resused = 1;
|
||||
WARN_ON_ONCE(rqstp->rq_next_page != rqstp->rq_respages + 1);
|
||||
rqstp->rq_next_page = rqstp->rq_respages + 1;
|
||||
host_err = splice_direct_to_actor(file, &sd, nfsd_direct_splice_actor);
|
||||
} else {
|
||||
oldfs = get_fs();
|
||||
|
Reference in New Issue
Block a user