diff options
author | Andy Adamson <andros@netapp.com> | 2009-06-15 21:20:50 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-06-18 21:33:57 -0400 |
commit | ef52bff8409bba78b042f1bcf33a0f49debc9774 (patch) | |
tree | 2ac3a07a7a4d1faff5201a4156693042bb3fd8c2 | |
parent | 6ddbbbfe52f35301ef5a1b595f912d8d2b3ec143 (diff) |
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>
-rw-r--r-- | fs/nfsd/nfs4callback.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index f4fab69a8c30..353eb4a0b847 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -140,8 +140,9 @@ struct nfs4_cb_compound_hdr { | |||
140 | int status; | 140 | int status; |
141 | u32 ident; | 141 | u32 ident; |
142 | u32 nops; | 142 | u32 nops; |
143 | __be32 *nops_p; | ||
143 | u32 taglen; | 144 | u32 taglen; |
144 | char * tag; | 145 | char *tag; |
145 | }; | 146 | }; |
146 | 147 | ||
147 | static struct { | 148 | static struct { |
@@ -201,7 +202,7 @@ nfs_cb_stat_to_errno(int stat) | |||
201 | * XDR encode | 202 | * XDR encode |
202 | */ | 203 | */ |
203 | 204 | ||
204 | static int | 205 | static void |
205 | encode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr) | 206 | encode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr) |
206 | { | 207 | { |
207 | __be32 * p; | 208 | __be32 * p; |
@@ -210,12 +211,18 @@ encode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr) | |||
210 | WRITE32(0); /* tag length is always 0 */ | 211 | WRITE32(0); /* tag length is always 0 */ |
211 | WRITE32(NFS4_MINOR_VERSION); | 212 | WRITE32(NFS4_MINOR_VERSION); |
212 | WRITE32(hdr->ident); | 213 | WRITE32(hdr->ident); |
214 | hdr->nops_p = p; | ||
213 | WRITE32(hdr->nops); | 215 | WRITE32(hdr->nops); |
214 | return 0; | ||
215 | } | 216 | } |
216 | 217 | ||
217 | static int | 218 | static void encode_cb_nops(struct nfs4_cb_compound_hdr *hdr) |
218 | encode_cb_recall(struct xdr_stream *xdr, struct nfs4_delegation *dp) | 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) | ||
219 | { | 226 | { |
220 | __be32 *p; | 227 | __be32 *p; |
221 | int len = dp->dl_fh.fh_size; | 228 | int len = dp->dl_fh.fh_size; |
@@ -227,7 +234,7 @@ encode_cb_recall(struct xdr_stream *xdr, struct nfs4_delegation *dp) | |||
227 | WRITE32(0); /* truncate optimization not implemented */ | 234 | WRITE32(0); /* truncate optimization not implemented */ |
228 | WRITE32(len); | 235 | WRITE32(len); |
229 | WRITEMEM(&dp->dl_fh.fh_base, len); | 236 | WRITEMEM(&dp->dl_fh.fh_base, len); |
230 | return 0; | 237 | hdr->nops++; |
231 | } | 238 | } |
232 | 239 | ||
233 | static int | 240 | static int |
@@ -246,12 +253,13 @@ nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, __be32 *p, struct nfs4_delegation * | |||
246 | struct xdr_stream xdr; | 253 | struct xdr_stream xdr; |
247 | struct nfs4_cb_compound_hdr hdr = { | 254 | struct nfs4_cb_compound_hdr hdr = { |
248 | .ident = args->dl_ident, | 255 | .ident = args->dl_ident, |
249 | .nops = 1, | ||
250 | }; | 256 | }; |
251 | 257 | ||
252 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 258 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
253 | encode_cb_compound_hdr(&xdr, &hdr); | 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 | ||