diff options
Diffstat (limited to 'fs/nfs/objlayout/objlayout.h')
-rw-r--r-- | fs/nfs/objlayout/objlayout.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/fs/nfs/objlayout/objlayout.h b/fs/nfs/objlayout/objlayout.h index b0bb975058e4..a8244c8e042d 100644 --- a/fs/nfs/objlayout/objlayout.h +++ b/fs/nfs/objlayout/objlayout.h | |||
@@ -51,6 +51,14 @@ | |||
51 | struct objlayout { | 51 | struct objlayout { |
52 | struct pnfs_layout_hdr pnfs_layout; | 52 | struct pnfs_layout_hdr pnfs_layout; |
53 | 53 | ||
54 | /* for layout_commit */ | ||
55 | enum osd_delta_space_valid_enum { | ||
56 | OBJ_DSU_INIT = 0, | ||
57 | OBJ_DSU_VALID, | ||
58 | OBJ_DSU_INVALID, | ||
59 | } delta_space_valid; | ||
60 | s64 delta_space_used; /* consumed by write ops */ | ||
61 | |||
54 | /* for layout_return */ | 62 | /* for layout_return */ |
55 | spinlock_t lock; | 63 | spinlock_t lock; |
56 | struct list_head err_list; | 64 | struct list_head err_list; |
@@ -119,6 +127,23 @@ extern void objlayout_io_set_result(struct objlayout_io_state *state, | |||
119 | unsigned index, struct pnfs_osd_objid *pooid, | 127 | unsigned index, struct pnfs_osd_objid *pooid, |
120 | int osd_error, u64 offset, u64 length, bool is_write); | 128 | int osd_error, u64 offset, u64 length, bool is_write); |
121 | 129 | ||
130 | static inline void | ||
131 | objlayout_add_delta_space_used(struct objlayout_io_state *state, s64 space_used) | ||
132 | { | ||
133 | struct objlayout *objlay = OBJLAYOUT(state->lseg->pls_layout); | ||
134 | |||
135 | /* If one of the I/Os errored out and the delta_space_used was | ||
136 | * invalid we render the complete report as invalid. Protocol mandate | ||
137 | * the DSU be accurate or not reported. | ||
138 | */ | ||
139 | spin_lock(&objlay->lock); | ||
140 | if (objlay->delta_space_valid != OBJ_DSU_INVALID) { | ||
141 | objlay->delta_space_valid = OBJ_DSU_VALID; | ||
142 | objlay->delta_space_used += space_used; | ||
143 | } | ||
144 | spin_unlock(&objlay->lock); | ||
145 | } | ||
146 | |||
122 | extern void objlayout_read_done(struct objlayout_io_state *state, | 147 | extern void objlayout_read_done(struct objlayout_io_state *state, |
123 | ssize_t status, bool sync); | 148 | ssize_t status, bool sync); |
124 | extern void objlayout_write_done(struct objlayout_io_state *state, | 149 | extern void objlayout_write_done(struct objlayout_io_state *state, |
@@ -149,6 +174,11 @@ extern enum pnfs_try_status objlayout_write_pagelist( | |||
149 | struct nfs_write_data *, | 174 | struct nfs_write_data *, |
150 | int how); | 175 | int how); |
151 | 176 | ||
177 | extern void objlayout_encode_layoutcommit( | ||
178 | struct pnfs_layout_hdr *, | ||
179 | struct xdr_stream *, | ||
180 | const struct nfs4_layoutcommit_args *); | ||
181 | |||
152 | extern void objlayout_encode_layoutreturn( | 182 | extern void objlayout_encode_layoutreturn( |
153 | struct pnfs_layout_hdr *, | 183 | struct pnfs_layout_hdr *, |
154 | struct xdr_stream *, | 184 | struct xdr_stream *, |