diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-06-08 11:56:09 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-06-28 17:20:50 -0400 |
commit | 2f2c63bc221c5fcded24de2704575d0abf96b910 (patch) | |
tree | dacf9f2bdbd101de6525a53571f0f1e48a75902e /fs/nfs | |
parent | 98d9452448122486f81030c6c70f29471f65e1ce (diff) |
NFS: Cleanup - only store the write verifier in struct nfs_page
The 'committed' field is not needed once we have put the struct nfs_page
on the right list.
Also correct the type of the verifier: it is not an array of __be32, but
simply an 8 byte long opaque array.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/nfs3xdr.c | 12 | ||||
-rw-r--r-- | fs/nfs/nfs4filelayout.c | 6 | ||||
-rw-r--r-- | fs/nfs/nfs4xdr.c | 12 | ||||
-rw-r--r-- | fs/nfs/write.c | 4 |
4 files changed, 20 insertions, 14 deletions
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c index 5013bdd85ab9..6cbe89400dfc 100644 --- a/fs/nfs/nfs3xdr.c +++ b/fs/nfs/nfs3xdr.c | |||
@@ -325,14 +325,14 @@ static void encode_createverf3(struct xdr_stream *xdr, const __be32 *verifier) | |||
325 | memcpy(p, verifier, NFS3_CREATEVERFSIZE); | 325 | memcpy(p, verifier, NFS3_CREATEVERFSIZE); |
326 | } | 326 | } |
327 | 327 | ||
328 | static int decode_writeverf3(struct xdr_stream *xdr, __be32 *verifier) | 328 | static int decode_writeverf3(struct xdr_stream *xdr, struct nfs_write_verifier *verifier) |
329 | { | 329 | { |
330 | __be32 *p; | 330 | __be32 *p; |
331 | 331 | ||
332 | p = xdr_inline_decode(xdr, NFS3_WRITEVERFSIZE); | 332 | p = xdr_inline_decode(xdr, NFS3_WRITEVERFSIZE); |
333 | if (unlikely(p == NULL)) | 333 | if (unlikely(p == NULL)) |
334 | goto out_overflow; | 334 | goto out_overflow; |
335 | memcpy(verifier, p, NFS3_WRITEVERFSIZE); | 335 | memcpy(verifier->data, p, NFS3_WRITEVERFSIZE); |
336 | return 0; | 336 | return 0; |
337 | out_overflow: | 337 | out_overflow: |
338 | print_overflow_msg(__func__, xdr); | 338 | print_overflow_msg(__func__, xdr); |
@@ -1668,20 +1668,22 @@ static int decode_write3resok(struct xdr_stream *xdr, | |||
1668 | { | 1668 | { |
1669 | __be32 *p; | 1669 | __be32 *p; |
1670 | 1670 | ||
1671 | p = xdr_inline_decode(xdr, 4 + 4 + NFS3_WRITEVERFSIZE); | 1671 | p = xdr_inline_decode(xdr, 4 + 4); |
1672 | if (unlikely(p == NULL)) | 1672 | if (unlikely(p == NULL)) |
1673 | goto out_overflow; | 1673 | goto out_overflow; |
1674 | result->count = be32_to_cpup(p++); | 1674 | result->count = be32_to_cpup(p++); |
1675 | result->verf->committed = be32_to_cpup(p++); | 1675 | result->verf->committed = be32_to_cpup(p++); |
1676 | if (unlikely(result->verf->committed > NFS_FILE_SYNC)) | 1676 | if (unlikely(result->verf->committed > NFS_FILE_SYNC)) |
1677 | goto out_badvalue; | 1677 | goto out_badvalue; |
1678 | memcpy(result->verf->verifier, p, NFS3_WRITEVERFSIZE); | 1678 | if (decode_writeverf3(xdr, &result->verf->verifier)) |
1679 | goto out_eio; | ||
1679 | return result->count; | 1680 | return result->count; |
1680 | out_badvalue: | 1681 | out_badvalue: |
1681 | dprintk("NFS: bad stable_how value: %u\n", result->verf->committed); | 1682 | dprintk("NFS: bad stable_how value: %u\n", result->verf->committed); |
1682 | return -EIO; | 1683 | return -EIO; |
1683 | out_overflow: | 1684 | out_overflow: |
1684 | print_overflow_msg(__func__, xdr); | 1685 | print_overflow_msg(__func__, xdr); |
1686 | out_eio: | ||
1685 | return -EIO; | 1687 | return -EIO; |
1686 | } | 1688 | } |
1687 | 1689 | ||
@@ -2314,7 +2316,7 @@ static int nfs3_xdr_dec_commit3res(struct rpc_rqst *req, | |||
2314 | goto out; | 2316 | goto out; |
2315 | if (status != NFS3_OK) | 2317 | if (status != NFS3_OK) |
2316 | goto out_status; | 2318 | goto out_status; |
2317 | error = decode_writeverf3(xdr, result->verf->verifier); | 2319 | error = decode_writeverf3(xdr, &result->verf->verifier); |
2318 | out: | 2320 | out: |
2319 | return error; | 2321 | return error; |
2320 | out_status: | 2322 | out_status: |
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c index e1340293872c..85b70639921b 100644 --- a/fs/nfs/nfs4filelayout.c +++ b/fs/nfs/nfs4filelayout.c | |||
@@ -351,9 +351,9 @@ static void prepare_to_resend_writes(struct nfs_commit_data *data) | |||
351 | struct nfs_page *first = nfs_list_entry(data->pages.next); | 351 | struct nfs_page *first = nfs_list_entry(data->pages.next); |
352 | 352 | ||
353 | data->task.tk_status = 0; | 353 | data->task.tk_status = 0; |
354 | memcpy(data->verf.verifier, first->wb_verf.verifier, | 354 | memcpy(&data->verf.verifier, &first->wb_verf, |
355 | sizeof(first->wb_verf.verifier)); | 355 | sizeof(data->verf.verifier)); |
356 | data->verf.verifier[0]++; /* ensure verifier mismatch */ | 356 | data->verf.verifier.data[0]++; /* ensure verifier mismatch */ |
357 | } | 357 | } |
358 | 358 | ||
359 | static int filelayout_commit_done_cb(struct rpc_task *task, | 359 | static int filelayout_commit_done_cb(struct rpc_task *task, |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 1e2c47b3889d..610ebccbde5d 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -4158,13 +4158,18 @@ static int decode_verifier(struct xdr_stream *xdr, void *verifier) | |||
4158 | return decode_opaque_fixed(xdr, verifier, NFS4_VERIFIER_SIZE); | 4158 | return decode_opaque_fixed(xdr, verifier, NFS4_VERIFIER_SIZE); |
4159 | } | 4159 | } |
4160 | 4160 | ||
4161 | static int decode_write_verifier(struct xdr_stream *xdr, struct nfs_write_verifier *verifier) | ||
4162 | { | ||
4163 | return decode_opaque_fixed(xdr, verifier->data, NFS4_VERIFIER_SIZE); | ||
4164 | } | ||
4165 | |||
4161 | static int decode_commit(struct xdr_stream *xdr, struct nfs_commitres *res) | 4166 | static int decode_commit(struct xdr_stream *xdr, struct nfs_commitres *res) |
4162 | { | 4167 | { |
4163 | int status; | 4168 | int status; |
4164 | 4169 | ||
4165 | status = decode_op_hdr(xdr, OP_COMMIT); | 4170 | status = decode_op_hdr(xdr, OP_COMMIT); |
4166 | if (!status) | 4171 | if (!status) |
4167 | status = decode_verifier(xdr, res->verf->verifier); | 4172 | status = decode_write_verifier(xdr, &res->verf->verifier); |
4168 | return status; | 4173 | return status; |
4169 | } | 4174 | } |
4170 | 4175 | ||
@@ -5192,13 +5197,12 @@ static int decode_write(struct xdr_stream *xdr, struct nfs_writeres *res) | |||
5192 | if (status) | 5197 | if (status) |
5193 | return status; | 5198 | return status; |
5194 | 5199 | ||
5195 | p = xdr_inline_decode(xdr, 16); | 5200 | p = xdr_inline_decode(xdr, 8); |
5196 | if (unlikely(!p)) | 5201 | if (unlikely(!p)) |
5197 | goto out_overflow; | 5202 | goto out_overflow; |
5198 | res->count = be32_to_cpup(p++); | 5203 | res->count = be32_to_cpup(p++); |
5199 | res->verf->committed = be32_to_cpup(p++); | 5204 | res->verf->committed = be32_to_cpup(p++); |
5200 | memcpy(res->verf->verifier, p, NFS4_VERIFIER_SIZE); | 5205 | return decode_write_verifier(xdr, &res->verf->verifier); |
5201 | return 0; | ||
5202 | out_overflow: | 5206 | out_overflow: |
5203 | print_overflow_msg(__func__, xdr); | 5207 | print_overflow_msg(__func__, xdr); |
5204 | return -EIO; | 5208 | return -EIO; |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 4d6861c0dc14..ee929e5e1f7b 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -620,7 +620,7 @@ static void nfs_write_completion(struct nfs_pgio_header *hdr) | |||
620 | goto next; | 620 | goto next; |
621 | } | 621 | } |
622 | if (test_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags)) { | 622 | if (test_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags)) { |
623 | memcpy(&req->wb_verf, hdr->verf, sizeof(req->wb_verf)); | 623 | memcpy(&req->wb_verf, &hdr->verf->verifier, sizeof(req->wb_verf)); |
624 | nfs_mark_request_commit(req, hdr->lseg, &cinfo); | 624 | nfs_mark_request_commit(req, hdr->lseg, &cinfo); |
625 | goto next; | 625 | goto next; |
626 | } | 626 | } |
@@ -1547,7 +1547,7 @@ static void nfs_commit_release_pages(struct nfs_commit_data *data) | |||
1547 | 1547 | ||
1548 | /* Okay, COMMIT succeeded, apparently. Check the verifier | 1548 | /* Okay, COMMIT succeeded, apparently. Check the verifier |
1549 | * returned by the server against all stored verfs. */ | 1549 | * returned by the server against all stored verfs. */ |
1550 | if (!memcmp(req->wb_verf.verifier, data->verf.verifier, sizeof(data->verf.verifier))) { | 1550 | if (!memcmp(&req->wb_verf, &data->verf.verifier, sizeof(req->wb_verf))) { |
1551 | /* We have a match */ | 1551 | /* We have a match */ |
1552 | nfs_inode_remove_request(req); | 1552 | nfs_inode_remove_request(req); |
1553 | dprintk(" OK\n"); | 1553 | dprintk(" OK\n"); |