aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/objlayout
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
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')
-rw-r--r--fs/nfs/objlayout/objio_osd.c17
-rw-r--r--fs/nfs/objlayout/objlayout.c63
-rw-r--r--fs/nfs/objlayout/objlayout.h15
3 files changed, 48 insertions, 47 deletions
diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
index 48eb91aad554..2347e0ac63e6 100644
--- a/fs/nfs/objlayout/objio_osd.c
+++ b/fs/nfs/objlayout/objio_osd.c
@@ -146,7 +146,7 @@ typedef int (*objio_done_fn)(struct objio_state *ios);
146 146
147struct objio_state { 147struct objio_state {
148 /* Generic layer */ 148 /* Generic layer */
149 struct objlayout_io_state ol_state; 149 struct objlayout_io_res oir;
150 150
151 struct page **pages; 151 struct page **pages;
152 unsigned pgbase; 152 unsigned pgbase;
@@ -422,7 +422,7 @@ objio_alloc_io_state(struct pnfs_layout_hdr *pnfs_layout_type,
422 ios = &aos->objios; 422 ios = &aos->objios;
423 423
424 ios->layout = objio_seg; 424 ios->layout = objio_seg;
425 objlayout_init_ioerrs(&aos->objios.ol_state, objio_seg->num_comps, 425 objlayout_init_ioerrs(&aos->objios.oir, objio_seg->num_comps,
426 aos->ioerrs, rpcdata, pnfs_layout_type); 426 aos->ioerrs, rpcdata, pnfs_layout_type);
427 427
428 ios->pages = pages; 428 ios->pages = pages;
@@ -437,10 +437,9 @@ objio_alloc_io_state(struct pnfs_layout_hdr *pnfs_layout_type,
437 return 0; 437 return 0;
438} 438}
439 439
440void objio_free_result(struct objlayout_io_state *ol_state) 440void objio_free_result(struct objlayout_io_res *oir)
441{ 441{
442 struct objio_state *ios = container_of(ol_state, struct objio_state, 442 struct objio_state *ios = container_of(oir, struct objio_state, oir);
443 ol_state);
444 443
445 kfree(ios); 444 kfree(ios);
446} 445}
@@ -519,7 +518,7 @@ static int _io_check(struct objio_state *ios, bool is_write)
519 518
520 continue; /* we recovered */ 519 continue; /* we recovered */
521 } 520 }
522 objlayout_io_set_result(&ios->ol_state, i, 521 objlayout_io_set_result(&ios->oir, i,
523 &ios->layout->comps[i].oc_object_id, 522 &ios->layout->comps[i].oc_object_id,
524 osd_pri_2_pnfs_err(osi.osd_err_pri), 523 osd_pri_2_pnfs_err(osi.osd_err_pri),
525 ios->per_dev[i].offset, 524 ios->per_dev[i].offset,
@@ -812,7 +811,7 @@ static int _read_done(struct objio_state *ios)
812 else 811 else
813 status = ret; 812 status = ret;
814 813
815 objlayout_read_done(&ios->ol_state, status, ios->sync); 814 objlayout_read_done(&ios->oir, status, ios->sync);
816 return ret; 815 return ret;
817} 816}
818 817
@@ -906,13 +905,13 @@ static int _write_done(struct objio_state *ios)
906 if (likely(!ret)) { 905 if (likely(!ret)) {
907 /* FIXME: should be based on the OSD's persistence model 906 /* FIXME: should be based on the OSD's persistence model
908 * See OSD2r05 Section 4.13 Data persistence model */ 907 * See OSD2r05 Section 4.13 Data persistence model */
909 ios->ol_state.committed = NFS_FILE_SYNC; 908 ios->oir.committed = NFS_FILE_SYNC;
910 status = ios->length; 909 status = ios->length;
911 } else { 910 } else {
912 status = ret; 911 status = ret;
913 } 912 }
914 913
915 objlayout_write_done(&ios->ol_state, status, ios->sync); 914 objlayout_write_done(&ios->oir, status, ios->sync);
916 return ret; 915 return ret;
917} 916}
918 917
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);
diff --git a/fs/nfs/objlayout/objlayout.h b/fs/nfs/objlayout/objlayout.h
index d7b2ccfa2132..8ec34727ed21 100644
--- a/fs/nfs/objlayout/objlayout.h
+++ b/fs/nfs/objlayout/objlayout.h
@@ -74,7 +74,7 @@ OBJLAYOUT(struct pnfs_layout_hdr *lo)
74 * per-I/O operation state 74 * per-I/O operation state
75 * embedded in objects provider io_state data structure 75 * embedded in objects provider io_state data structure
76 */ 76 */
77struct objlayout_io_state { 77struct objlayout_io_res {
78 struct objlayout *objlay; 78 struct objlayout *objlay;
79 79
80 void *rpcdata; 80 void *rpcdata;
@@ -93,7 +93,7 @@ struct objlayout_io_state {
93}; 93};
94 94
95static inline 95static inline
96void objlayout_init_ioerrs(struct objlayout_io_state *oir, unsigned num_comps, 96void objlayout_init_ioerrs(struct objlayout_io_res *oir, unsigned num_comps,
97 struct pnfs_osd_ioerr *ioerrs, void *rpcdata, 97 struct pnfs_osd_ioerr *ioerrs, void *rpcdata,
98 struct pnfs_layout_hdr *pnfs_layout_type) 98 struct pnfs_layout_hdr *pnfs_layout_type)
99{ 99{
@@ -114,7 +114,10 @@ extern int objio_alloc_lseg(struct pnfs_layout_segment **outp,
114 gfp_t gfp_flags); 114 gfp_t gfp_flags);
115extern void objio_free_lseg(struct pnfs_layout_segment *lseg); 115extern void objio_free_lseg(struct pnfs_layout_segment *lseg);
116 116
117extern void objio_free_result(struct objlayout_io_state *state); 117/* objio_free_result will free these @oir structs recieved from
118 * objlayout_{read,write}_done
119 */
120extern void objio_free_result(struct objlayout_io_res *oir);
118 121
119extern int objio_read_pagelist(struct nfs_read_data *rdata); 122extern int objio_read_pagelist(struct nfs_read_data *rdata);
120extern int objio_write_pagelist(struct nfs_write_data *wdata, int how); 123extern int objio_write_pagelist(struct nfs_write_data *wdata, int how);
@@ -122,7 +125,7 @@ extern int objio_write_pagelist(struct nfs_write_data *wdata, int how);
122/* 125/*
123 * callback API 126 * callback API
124 */ 127 */
125extern void objlayout_io_set_result(struct objlayout_io_state *state, 128extern void objlayout_io_set_result(struct objlayout_io_res *oir,
126 unsigned index, struct pnfs_osd_objid *pooid, 129 unsigned index, struct pnfs_osd_objid *pooid,
127 int osd_error, u64 offset, u64 length, bool is_write); 130 int osd_error, u64 offset, u64 length, bool is_write);
128 131
@@ -141,9 +144,9 @@ objlayout_add_delta_space_used(struct objlayout *objlay, s64 space_used)
141 spin_unlock(&objlay->lock); 144 spin_unlock(&objlay->lock);
142} 145}
143 146
144extern void objlayout_read_done(struct objlayout_io_state *state, 147extern void objlayout_read_done(struct objlayout_io_res *oir,
145 ssize_t status, bool sync); 148 ssize_t status, bool sync);
146extern void objlayout_write_done(struct objlayout_io_state *state, 149extern void objlayout_write_done(struct objlayout_io_res *oir,
147 ssize_t status, bool sync); 150 ssize_t status, bool sync);
148 151
149extern int objlayout_get_deviceinfo(struct pnfs_layout_hdr *pnfslay, 152extern int objlayout_get_deviceinfo(struct pnfs_layout_hdr *pnfslay,