diff options
author | J. Bruce Fields <bfields@redhat.com> | 2012-12-10 18:01:37 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-12-17 22:00:16 -0500 |
commit | afc59400d6c65bad66d4ad0b2daf879cbff8e23e (patch) | |
tree | cc4c1c4dcf01106259d4f18d637cb2d1115ef980 /fs/nfsd/nfs4xdr.c | |
parent | 79f77bf9a4e3dd5ead006b8f17e7c4ff07d8374e (diff) |
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>
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index d7a3be5ab777..0dc11586682f 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -2906,7 +2906,8 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr, | |||
2906 | struct nfsd4_read *read) | 2906 | struct nfsd4_read *read) |
2907 | { | 2907 | { |
2908 | u32 eof; | 2908 | u32 eof; |
2909 | int v, pn; | 2909 | int v; |
2910 | struct page *page; | ||
2910 | unsigned long maxcount; | 2911 | unsigned long maxcount; |
2911 | long len; | 2912 | long len; |
2912 | __be32 *p; | 2913 | __be32 *p; |
@@ -2925,16 +2926,15 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr, | |||
2925 | len = maxcount; | 2926 | len = maxcount; |
2926 | v = 0; | 2927 | v = 0; |
2927 | while (len > 0) { | 2928 | while (len > 0) { |
2928 | pn = resp->rqstp->rq_resused; | 2929 | page = *(resp->rqstp->rq_next_page); |
2929 | if (!resp->rqstp->rq_respages[pn]) { /* ran out of pages */ | 2930 | if (!page) { /* ran out of pages */ |
2930 | maxcount -= len; | 2931 | maxcount -= len; |
2931 | break; | 2932 | break; |
2932 | } | 2933 | } |
2933 | resp->rqstp->rq_vec[v].iov_base = | 2934 | resp->rqstp->rq_vec[v].iov_base = page_address(page); |
2934 | page_address(resp->rqstp->rq_respages[pn]); | ||
2935 | resp->rqstp->rq_vec[v].iov_len = | 2935 | resp->rqstp->rq_vec[v].iov_len = |
2936 | len < PAGE_SIZE ? len : PAGE_SIZE; | 2936 | len < PAGE_SIZE ? len : PAGE_SIZE; |
2937 | resp->rqstp->rq_resused++; | 2937 | resp->rqstp->rq_next_page++; |
2938 | v++; | 2938 | v++; |
2939 | len -= PAGE_SIZE; | 2939 | len -= PAGE_SIZE; |
2940 | } | 2940 | } |
@@ -2980,10 +2980,10 @@ nfsd4_encode_readlink(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd | |||
2980 | return nfserr; | 2980 | return nfserr; |
2981 | if (resp->xbuf->page_len) | 2981 | if (resp->xbuf->page_len) |
2982 | return nfserr_resource; | 2982 | return nfserr_resource; |
2983 | if (!resp->rqstp->rq_respages[resp->rqstp->rq_resused]) | 2983 | if (!*resp->rqstp->rq_next_page) |
2984 | return nfserr_resource; | 2984 | return nfserr_resource; |
2985 | 2985 | ||
2986 | page = page_address(resp->rqstp->rq_respages[resp->rqstp->rq_resused++]); | 2986 | page = page_address(*(resp->rqstp->rq_next_page++)); |
2987 | 2987 | ||
2988 | maxcount = PAGE_SIZE; | 2988 | maxcount = PAGE_SIZE; |
2989 | RESERVE_SPACE(4); | 2989 | RESERVE_SPACE(4); |
@@ -3031,7 +3031,7 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4 | |||
3031 | return nfserr; | 3031 | return nfserr; |
3032 | if (resp->xbuf->page_len) | 3032 | if (resp->xbuf->page_len) |
3033 | return nfserr_resource; | 3033 | return nfserr_resource; |
3034 | if (!resp->rqstp->rq_respages[resp->rqstp->rq_resused]) | 3034 | if (!*resp->rqstp->rq_next_page) |
3035 | return nfserr_resource; | 3035 | return nfserr_resource; |
3036 | 3036 | ||
3037 | RESERVE_SPACE(NFS4_VERIFIER_SIZE); | 3037 | RESERVE_SPACE(NFS4_VERIFIER_SIZE); |
@@ -3059,7 +3059,7 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4 | |||
3059 | goto err_no_verf; | 3059 | goto err_no_verf; |
3060 | } | 3060 | } |
3061 | 3061 | ||
3062 | page = page_address(resp->rqstp->rq_respages[resp->rqstp->rq_resused++]); | 3062 | page = page_address(*(resp->rqstp->rq_next_page++)); |
3063 | readdir->common.err = 0; | 3063 | readdir->common.err = 0; |
3064 | readdir->buflen = maxcount; | 3064 | readdir->buflen = maxcount; |
3065 | readdir->buffer = page; | 3065 | readdir->buffer = page; |
@@ -3082,8 +3082,8 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4 | |||
3082 | p = readdir->buffer; | 3082 | p = readdir->buffer; |
3083 | *p++ = 0; /* no more entries */ | 3083 | *p++ = 0; /* no more entries */ |
3084 | *p++ = htonl(readdir->common.err == nfserr_eof); | 3084 | *p++ = htonl(readdir->common.err == nfserr_eof); |
3085 | resp->xbuf->page_len = ((char*)p) - (char*)page_address( | 3085 | resp->xbuf->page_len = ((char*)p) - |
3086 | resp->rqstp->rq_respages[resp->rqstp->rq_resused-1]); | 3086 | (char*)page_address(*(resp->rqstp->rq_next_page-1)); |
3087 | 3087 | ||
3088 | /* Use rest of head for padding and remaining ops: */ | 3088 | /* Use rest of head for padding and remaining ops: */ |
3089 | resp->xbuf->tail[0].iov_base = tailbase; | 3089 | resp->xbuf->tail[0].iov_base = tailbase; |