aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/objlayout/objlayout.c
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2011-10-31 18:03:35 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-11-02 23:56:06 -0400
commite2e04355d9647305c666462a49223f2942a635f0 (patch)
treeecfe8fb11a29a11d2728c1cdd8d5e2d82c724e41 /fs/nfs/objlayout/objlayout.c
parent96218556b03d3c6505e2880a097338bf277fd783 (diff)
pnfs-obj: Rename objlayout_io_state => objlayout_io_res
* All instances of objlayout_io_state => objlayout_io_res * All instances of state => oir; * All instances of ol_state => oir; Big but nothing to it Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/objlayout/objlayout.c')
-rw-r--r--fs/nfs/objlayout/objlayout.c63
1 files changed, 31 insertions, 32 deletions
diff --git a/fs/nfs/objlayout/objlayout.c b/fs/nfs/objlayout/objlayout.c
index a82053ae5595..72074e3a04f9 100644
--- a/fs/nfs/objlayout/objlayout.c
+++ b/fs/nfs/objlayout/objlayout.c
@@ -179,16 +179,16 @@ void _fix_verify_io_params(struct pnfs_layout_segment *lseg,
179 * I/O done common code 179 * I/O done common code
180 */ 180 */
181static void 181static void
182objlayout_iodone(struct objlayout_io_state *state) 182objlayout_iodone(struct objlayout_io_res *oir)
183{ 183{
184 if (likely(state->status >= 0)) { 184 if (likely(oir->status >= 0)) {
185 objio_free_result(state); 185 objio_free_result(oir);
186 } else { 186 } else {
187 struct objlayout *objlay = state->objlay; 187 struct objlayout *objlay = oir->objlay;
188 188
189 spin_lock(&objlay->lock); 189 spin_lock(&objlay->lock);
190 objlay->delta_space_valid = OBJ_DSU_INVALID; 190 objlay->delta_space_valid = OBJ_DSU_INVALID;
191 list_add(&objlay->err_list, &state->err_list); 191 list_add(&objlay->err_list, &oir->err_list);
192 spin_unlock(&objlay->lock); 192 spin_unlock(&objlay->lock);
193 } 193 }
194} 194}
@@ -200,13 +200,13 @@ objlayout_iodone(struct objlayout_io_state *state)
200 * the error for later reporting at layout-return. 200 * the error for later reporting at layout-return.
201 */ 201 */
202void 202void
203objlayout_io_set_result(struct objlayout_io_state *state, unsigned index, 203objlayout_io_set_result(struct objlayout_io_res *oir, unsigned index,
204 struct pnfs_osd_objid *pooid, int osd_error, 204 struct pnfs_osd_objid *pooid, int osd_error,
205 u64 offset, u64 length, bool is_write) 205 u64 offset, u64 length, bool is_write)
206{ 206{
207 struct pnfs_osd_ioerr *ioerr = &state->ioerrs[index]; 207 struct pnfs_osd_ioerr *ioerr = &oir->ioerrs[index];
208 208
209 BUG_ON(index >= state->num_comps); 209 BUG_ON(index >= oir->num_comps);
210 if (osd_error) { 210 if (osd_error) {
211 ioerr->oer_component = *pooid; 211 ioerr->oer_component = *pooid;
212 ioerr->oer_comp_offset = offset; 212 ioerr->oer_comp_offset = offset;
@@ -247,15 +247,15 @@ static void _rpc_read_complete(struct work_struct *work)
247} 247}
248 248
249void 249void
250objlayout_read_done(struct objlayout_io_state *state, ssize_t status, bool sync) 250objlayout_read_done(struct objlayout_io_res *oir, ssize_t status, bool sync)
251{ 251{
252 struct nfs_read_data *rdata = state->rpcdata; 252 struct nfs_read_data *rdata = oir->rpcdata;
253 253
254 state->status = rdata->task.tk_status = status; 254 oir->status = rdata->task.tk_status = status;
255 if (status >= 0) 255 if (status >= 0)
256 rdata->res.count = status; 256 rdata->res.count = status;
257 objlayout_iodone(state); 257 objlayout_iodone(oir);
258 /* must not use state after this point */ 258 /* must not use oir after this point */
259 259
260 dprintk("%s: Return status=%zd eof=%d sync=%d\n", __func__, 260 dprintk("%s: Return status=%zd eof=%d sync=%d\n", __func__,
261 status, rdata->res.eof, sync); 261 status, rdata->res.eof, sync);
@@ -326,17 +326,16 @@ static void _rpc_write_complete(struct work_struct *work)
326} 326}
327 327
328void 328void
329objlayout_write_done(struct objlayout_io_state *state, ssize_t status, 329objlayout_write_done(struct objlayout_io_res *oir, ssize_t status, bool sync)
330 bool sync)
331{ 330{
332 struct nfs_write_data *wdata = state->rpcdata; 331 struct nfs_write_data *wdata = oir->rpcdata;
333 332
334 state->status = wdata->task.tk_status = status; 333 oir->status = wdata->task.tk_status = status;
335 if (status >= 0) { 334 if (status >= 0) {
336 wdata->res.count = status; 335 wdata->res.count = status;
337 wdata->verf.committed = state->committed; 336 wdata->verf.committed = oir->committed;
338 } 337 }
339 objlayout_iodone(state); 338 objlayout_iodone(oir);
340 /* must not use oir after this point */ 339 /* must not use oir after this point */
341 340
342 dprintk("%s: Return status %zd committed %d sync=%d\n", __func__, 341 dprintk("%s: Return status %zd committed %d sync=%d\n", __func__,
@@ -475,14 +474,14 @@ merge_ioerr(struct pnfs_osd_ioerr *dest_err,
475static void 474static void
476encode_accumulated_error(struct objlayout *objlay, __be32 *p) 475encode_accumulated_error(struct objlayout *objlay, __be32 *p)
477{ 476{
478 struct objlayout_io_state *state, *tmp; 477 struct objlayout_io_res *oir, *tmp;
479 struct pnfs_osd_ioerr accumulated_err = {.oer_errno = 0}; 478 struct pnfs_osd_ioerr accumulated_err = {.oer_errno = 0};
480 479
481 list_for_each_entry_safe(state, tmp, &objlay->err_list, err_list) { 480 list_for_each_entry_safe(oir, tmp, &objlay->err_list, err_list) {
482 unsigned i; 481 unsigned i;
483 482
484 for (i = 0; i < state->num_comps; i++) { 483 for (i = 0; i < oir->num_comps; i++) {
485 struct pnfs_osd_ioerr *ioerr = &state->ioerrs[i]; 484 struct pnfs_osd_ioerr *ioerr = &oir->ioerrs[i];
486 485
487 if (!ioerr->oer_errno) 486 if (!ioerr->oer_errno)
488 continue; 487 continue;
@@ -501,8 +500,8 @@ encode_accumulated_error(struct objlayout *objlay, __be32 *p)
501 500
502 merge_ioerr(&accumulated_err, ioerr); 501 merge_ioerr(&accumulated_err, ioerr);
503 } 502 }
504 list_del(&state->err_list); 503 list_del(&oir->err_list);
505 objio_free_result(state); 504 objio_free_result(oir);
506 } 505 }
507 506
508 pnfs_osd_xdr_encode_ioerr(p, &accumulated_err); 507 pnfs_osd_xdr_encode_ioerr(p, &accumulated_err);
@@ -514,7 +513,7 @@ objlayout_encode_layoutreturn(struct pnfs_layout_hdr *pnfslay,
514 const struct nfs4_layoutreturn_args *args) 513 const struct nfs4_layoutreturn_args *args)
515{ 514{
516 struct objlayout *objlay = OBJLAYOUT(pnfslay); 515 struct objlayout *objlay = OBJLAYOUT(pnfslay);
517 struct objlayout_io_state *state, *tmp; 516 struct objlayout_io_res *oir, *tmp;
518 __be32 *start; 517 __be32 *start;
519 518
520 dprintk("%s: Begin\n", __func__); 519 dprintk("%s: Begin\n", __func__);
@@ -523,13 +522,13 @@ objlayout_encode_layoutreturn(struct pnfs_layout_hdr *pnfslay,
523 522
524 spin_lock(&objlay->lock); 523 spin_lock(&objlay->lock);
525 524
526 list_for_each_entry_safe(state, tmp, &objlay->err_list, err_list) { 525 list_for_each_entry_safe(oir, tmp, &objlay->err_list, err_list) {
527 __be32 *last_xdr = NULL, *p; 526 __be32 *last_xdr = NULL, *p;
528 unsigned i; 527 unsigned i;
529 int res = 0; 528 int res = 0;
530 529
531 for (i = 0; i < state->num_comps; i++) { 530 for (i = 0; i < oir->num_comps; i++) {
532 struct pnfs_osd_ioerr *ioerr = &state->ioerrs[i]; 531 struct pnfs_osd_ioerr *ioerr = &oir->ioerrs[i];
533 532
534 if (!ioerr->oer_errno) 533 if (!ioerr->oer_errno)
535 continue; 534 continue;
@@ -553,7 +552,7 @@ objlayout_encode_layoutreturn(struct pnfs_layout_hdr *pnfslay,
553 } 552 }
554 553
555 last_xdr = p; 554 last_xdr = p;
556 pnfs_osd_xdr_encode_ioerr(p, &state->ioerrs[i]); 555 pnfs_osd_xdr_encode_ioerr(p, &oir->ioerrs[i]);
557 } 556 }
558 557
559 /* TODO: use xdr_write_pages */ 558 /* TODO: use xdr_write_pages */
@@ -569,8 +568,8 @@ objlayout_encode_layoutreturn(struct pnfs_layout_hdr *pnfslay,
569 encode_accumulated_error(objlay, last_xdr); 568 encode_accumulated_error(objlay, last_xdr);
570 goto loop_done; 569 goto loop_done;
571 } 570 }
572 list_del(&state->err_list); 571 list_del(&oir->err_list);
573 objio_free_result(state); 572 objio_free_result(oir);
574 } 573 }
575loop_done: 574loop_done:
576 spin_unlock(&objlay->lock); 575 spin_unlock(&objlay->lock);