diff options
author | J. Bruce Fields <bfields@redhat.com> | 2013-06-21 17:06:29 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2013-07-01 17:32:03 -0400 |
commit | 590b743143eae8db40abdfd1ab20bc51ee0ee5db (patch) | |
tree | 833e4d8b1825f4a07bb1719178af1f9d181217ec /fs/nfsd/nfs4xdr.c | |
parent | 247500820ebd02ad87525db5d9b199e5b66f6636 (diff) |
nfsd4: minor read_buf cleanup
The code to step to the next page seems reasonably self-contained.
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, 14 insertions, 10 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index e34f5ebfc811..c102d2509a2a 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -139,6 +139,19 @@ xdr_error: \ | |||
139 | } \ | 139 | } \ |
140 | } while (0) | 140 | } while (0) |
141 | 141 | ||
142 | static void next_decode_page(struct nfsd4_compoundargs *argp) | ||
143 | { | ||
144 | argp->pagelist++; | ||
145 | argp->p = page_address(argp->pagelist[0]); | ||
146 | if (argp->pagelen < PAGE_SIZE) { | ||
147 | argp->end = argp->p + (argp->pagelen>>2); | ||
148 | argp->pagelen = 0; | ||
149 | } else { | ||
150 | argp->end = argp->p + (PAGE_SIZE>>2); | ||
151 | argp->pagelen -= PAGE_SIZE; | ||
152 | } | ||
153 | } | ||
154 | |||
142 | static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32 nbytes) | 155 | static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32 nbytes) |
143 | { | 156 | { |
144 | /* We want more bytes than seem to be available. | 157 | /* We want more bytes than seem to be available. |
@@ -166,16 +179,7 @@ static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32 nbytes) | |||
166 | * guarantee p points to at least nbytes bytes. | 179 | * guarantee p points to at least nbytes bytes. |
167 | */ | 180 | */ |
168 | memcpy(p, argp->p, avail); | 181 | memcpy(p, argp->p, avail); |
169 | /* step to next page */ | 182 | next_decode_page(argp); |
170 | argp->pagelist++; | ||
171 | argp->p = page_address(argp->pagelist[0]); | ||
172 | if (argp->pagelen < PAGE_SIZE) { | ||
173 | argp->end = argp->p + (argp->pagelen>>2); | ||
174 | argp->pagelen = 0; | ||
175 | } else { | ||
176 | argp->end = argp->p + (PAGE_SIZE>>2); | ||
177 | argp->pagelen -= PAGE_SIZE; | ||
178 | } | ||
179 | memcpy(((char*)p)+avail, argp->p, (nbytes - avail)); | 183 | memcpy(((char*)p)+avail, argp->p, (nbytes - avail)); |
180 | argp->p += XDR_QUADLEN(nbytes - avail); | 184 | argp->p += XDR_QUADLEN(nbytes - avail); |
181 | return p; | 185 | return p; |