diff options
author | Boaz Harrosh <bharrosh@panasas.com> | 2011-05-22 12:54:13 -0400 |
---|---|---|
committer | Boaz Harrosh <bharrosh@panasas.com> | 2011-05-29 13:55:00 -0400 |
commit | a0fe8bf427f4987d7b82678292ca03cfd7331467 (patch) | |
tree | d995bd164b03dde89da24af979931c2490fe9414 /fs/nfs/objlayout/objlayout.c | |
parent | ac7db7264ac3314cae09893bc838fcb7e83267a4 (diff) |
pnfs-obj: objlayout_encode_layoutcommit implementation
* Define API for io-engines to report delta_space_used in IOs
* Encode the osd-layout specific information of the layoutcommit
XDR buffer.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Diffstat (limited to 'fs/nfs/objlayout/objlayout.c')
-rw-r--r-- | fs/nfs/objlayout/objlayout.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/fs/nfs/objlayout/objlayout.c b/fs/nfs/objlayout/objlayout.c index f7caecff6b4d..dc3956c0de80 100644 --- a/fs/nfs/objlayout/objlayout.c +++ b/fs/nfs/objlayout/objlayout.c | |||
@@ -225,6 +225,7 @@ objlayout_iodone(struct objlayout_io_state *state) | |||
225 | struct objlayout *objlay = OBJLAYOUT(state->lseg->pls_layout); | 225 | struct objlayout *objlay = OBJLAYOUT(state->lseg->pls_layout); |
226 | 226 | ||
227 | spin_lock(&objlay->lock); | 227 | spin_lock(&objlay->lock); |
228 | objlay->delta_space_valid = OBJ_DSU_INVALID; | ||
228 | list_add(&objlay->err_list, &state->err_list); | 229 | list_add(&objlay->err_list, &state->err_list); |
229 | spin_unlock(&objlay->lock); | 230 | spin_unlock(&objlay->lock); |
230 | } | 231 | } |
@@ -433,6 +434,35 @@ objlayout_write_pagelist(struct nfs_write_data *wdata, | |||
433 | return PNFS_ATTEMPTED; | 434 | return PNFS_ATTEMPTED; |
434 | } | 435 | } |
435 | 436 | ||
437 | void | ||
438 | objlayout_encode_layoutcommit(struct pnfs_layout_hdr *pnfslay, | ||
439 | struct xdr_stream *xdr, | ||
440 | const struct nfs4_layoutcommit_args *args) | ||
441 | { | ||
442 | struct objlayout *objlay = OBJLAYOUT(pnfslay); | ||
443 | struct pnfs_osd_layoutupdate lou; | ||
444 | __be32 *start; | ||
445 | |||
446 | dprintk("%s: Begin\n", __func__); | ||
447 | |||
448 | spin_lock(&objlay->lock); | ||
449 | lou.dsu_valid = (objlay->delta_space_valid == OBJ_DSU_VALID); | ||
450 | lou.dsu_delta = objlay->delta_space_used; | ||
451 | objlay->delta_space_used = 0; | ||
452 | objlay->delta_space_valid = OBJ_DSU_INIT; | ||
453 | lou.olu_ioerr_flag = !list_empty(&objlay->err_list); | ||
454 | spin_unlock(&objlay->lock); | ||
455 | |||
456 | start = xdr_reserve_space(xdr, 4); | ||
457 | |||
458 | BUG_ON(pnfs_osd_xdr_encode_layoutupdate(xdr, &lou)); | ||
459 | |||
460 | *start = cpu_to_be32((xdr->p - start - 1) * 4); | ||
461 | |||
462 | dprintk("%s: Return delta_space_used %lld err %d\n", __func__, | ||
463 | lou.dsu_delta, lou.olu_ioerr_flag); | ||
464 | } | ||
465 | |||
436 | static int | 466 | static int |
437 | err_prio(u32 oer_errno) | 467 | err_prio(u32 oer_errno) |
438 | { | 468 | { |