Commit ef52bff8409bba78b042f1bcf33a0f49debc9774
Committed by
J. Bruce Fields
1 parent
6ddbbbfe52
nfsd41: Backchannel: cleanup nfs4.0 callback encode routines
Mimic the client and prepare to share the back channel xdr with NFSv4.1. Bump the number of operations in each encode routine, then backfill the number of operations. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Showing 1 changed file with 16 additions and 8 deletions Side-by-side Diff
fs/nfsd/nfs4callback.c
... | ... | @@ -140,8 +140,9 @@ |
140 | 140 | int status; |
141 | 141 | u32 ident; |
142 | 142 | u32 nops; |
143 | + __be32 *nops_p; | |
143 | 144 | u32 taglen; |
144 | - char * tag; | |
145 | + char *tag; | |
145 | 146 | }; |
146 | 147 | |
147 | 148 | static struct { |
... | ... | @@ -201,7 +202,7 @@ |
201 | 202 | * XDR encode |
202 | 203 | */ |
203 | 204 | |
204 | -static int | |
205 | +static void | |
205 | 206 | encode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr) |
206 | 207 | { |
207 | 208 | __be32 * p; |
208 | 209 | |
209 | 210 | |
210 | 211 | |
... | ... | @@ -210,13 +211,19 @@ |
210 | 211 | WRITE32(0); /* tag length is always 0 */ |
211 | 212 | WRITE32(NFS4_MINOR_VERSION); |
212 | 213 | WRITE32(hdr->ident); |
214 | + hdr->nops_p = p; | |
213 | 215 | WRITE32(hdr->nops); |
214 | - return 0; | |
215 | 216 | } |
216 | 217 | |
217 | -static int | |
218 | -encode_cb_recall(struct xdr_stream *xdr, struct nfs4_delegation *dp) | |
218 | +static void encode_cb_nops(struct nfs4_cb_compound_hdr *hdr) | |
219 | 219 | { |
220 | + *hdr->nops_p = htonl(hdr->nops); | |
221 | +} | |
222 | + | |
223 | +static void | |
224 | +encode_cb_recall(struct xdr_stream *xdr, struct nfs4_delegation *dp, | |
225 | + struct nfs4_cb_compound_hdr *hdr) | |
226 | +{ | |
220 | 227 | __be32 *p; |
221 | 228 | int len = dp->dl_fh.fh_size; |
222 | 229 | |
... | ... | @@ -227,7 +234,7 @@ |
227 | 234 | WRITE32(0); /* truncate optimization not implemented */ |
228 | 235 | WRITE32(len); |
229 | 236 | WRITEMEM(&dp->dl_fh.fh_base, len); |
230 | - return 0; | |
237 | + hdr->nops++; | |
231 | 238 | } |
232 | 239 | |
233 | 240 | static int |
234 | 241 | |
... | ... | @@ -246,12 +253,13 @@ |
246 | 253 | struct xdr_stream xdr; |
247 | 254 | struct nfs4_cb_compound_hdr hdr = { |
248 | 255 | .ident = args->dl_ident, |
249 | - .nops = 1, | |
250 | 256 | }; |
251 | 257 | |
252 | 258 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
253 | 259 | encode_cb_compound_hdr(&xdr, &hdr); |
254 | - return (encode_cb_recall(&xdr, args)); | |
260 | + encode_cb_recall(&xdr, args, &hdr); | |
261 | + encode_cb_nops(&hdr); | |
262 | + return 0; | |
255 | 263 | } |
256 | 264 | |
257 | 265 |