Commit e2e04355 authored by Boaz Harrosh's avatar Boaz Harrosh Committed by Trond Myklebust

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: default avatarBoaz Harrosh <bharrosh@panasas.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 96218556
...@@ -146,7 +146,7 @@ typedef int (*objio_done_fn)(struct objio_state *ios); ...@@ -146,7 +146,7 @@ typedef int (*objio_done_fn)(struct objio_state *ios);
struct objio_state { struct objio_state {
/* Generic layer */ /* Generic layer */
struct objlayout_io_state ol_state; struct objlayout_io_res oir;
struct page **pages; struct page **pages;
unsigned pgbase; unsigned pgbase;
...@@ -422,7 +422,7 @@ objio_alloc_io_state(struct pnfs_layout_hdr *pnfs_layout_type, ...@@ -422,7 +422,7 @@ objio_alloc_io_state(struct pnfs_layout_hdr *pnfs_layout_type,
ios = &aos->objios; ios = &aos->objios;
ios->layout = objio_seg; ios->layout = objio_seg;
objlayout_init_ioerrs(&aos->objios.ol_state, objio_seg->num_comps, objlayout_init_ioerrs(&aos->objios.oir, objio_seg->num_comps,
aos->ioerrs, rpcdata, pnfs_layout_type); aos->ioerrs, rpcdata, pnfs_layout_type);
ios->pages = pages; ios->pages = pages;
...@@ -437,10 +437,9 @@ objio_alloc_io_state(struct pnfs_layout_hdr *pnfs_layout_type, ...@@ -437,10 +437,9 @@ objio_alloc_io_state(struct pnfs_layout_hdr *pnfs_layout_type,
return 0; return 0;
} }
void objio_free_result(struct objlayout_io_state *ol_state) void objio_free_result(struct objlayout_io_res *oir)
{ {
struct objio_state *ios = container_of(ol_state, struct objio_state, struct objio_state *ios = container_of(oir, struct objio_state, oir);
ol_state);
kfree(ios); kfree(ios);
} }
...@@ -519,7 +518,7 @@ static int _io_check(struct objio_state *ios, bool is_write) ...@@ -519,7 +518,7 @@ static int _io_check(struct objio_state *ios, bool is_write)
continue; /* we recovered */ continue; /* we recovered */
} }
objlayout_io_set_result(&ios->ol_state, i, objlayout_io_set_result(&ios->oir, i,
&ios->layout->comps[i].oc_object_id, &ios->layout->comps[i].oc_object_id,
osd_pri_2_pnfs_err(osi.osd_err_pri), osd_pri_2_pnfs_err(osi.osd_err_pri),
ios->per_dev[i].offset, ios->per_dev[i].offset,
...@@ -812,7 +811,7 @@ static int _read_done(struct objio_state *ios) ...@@ -812,7 +811,7 @@ static int _read_done(struct objio_state *ios)
else else
status = ret; status = ret;
objlayout_read_done(&ios->ol_state, status, ios->sync); objlayout_read_done(&ios->oir, status, ios->sync);
return ret; return ret;
} }
...@@ -906,13 +905,13 @@ static int _write_done(struct objio_state *ios) ...@@ -906,13 +905,13 @@ static int _write_done(struct objio_state *ios)
if (likely(!ret)) { if (likely(!ret)) {
/* FIXME: should be based on the OSD's persistence model /* FIXME: should be based on the OSD's persistence model
* See OSD2r05 Section 4.13 Data persistence model */ * See OSD2r05 Section 4.13 Data persistence model */
ios->ol_state.committed = NFS_FILE_SYNC; ios->oir.committed = NFS_FILE_SYNC;
status = ios->length; status = ios->length;
} else { } else {
status = ret; status = ret;
} }
objlayout_write_done(&ios->ol_state, status, ios->sync); objlayout_write_done(&ios->oir, status, ios->sync);
return ret; return ret;
} }
......
...@@ -179,16 +179,16 @@ void _fix_verify_io_params(struct pnfs_layout_segment *lseg, ...@@ -179,16 +179,16 @@ void _fix_verify_io_params(struct pnfs_layout_segment *lseg,
* I/O done common code * I/O done common code
*/ */
static void static void
objlayout_iodone(struct objlayout_io_state *state) objlayout_iodone(struct objlayout_io_res *oir)
{ {
if (likely(state->status >= 0)) { if (likely(oir->status >= 0)) {
objio_free_result(state); objio_free_result(oir);
} else { } else {
struct objlayout *objlay = state->objlay; struct objlayout *objlay = oir->objlay;
spin_lock(&objlay->lock); spin_lock(&objlay->lock);
objlay->delta_space_valid = OBJ_DSU_INVALID; objlay->delta_space_valid = OBJ_DSU_INVALID;
list_add(&objlay->err_list, &state->err_list); list_add(&objlay->err_list, &oir->err_list);
spin_unlock(&objlay->lock); spin_unlock(&objlay->lock);
} }
} }
...@@ -200,13 +200,13 @@ objlayout_iodone(struct objlayout_io_state *state) ...@@ -200,13 +200,13 @@ objlayout_iodone(struct objlayout_io_state *state)
* the error for later reporting at layout-return. * the error for later reporting at layout-return.
*/ */
void void
objlayout_io_set_result(struct objlayout_io_state *state, unsigned index, objlayout_io_set_result(struct objlayout_io_res *oir, unsigned index,
struct pnfs_osd_objid *pooid, int osd_error, struct pnfs_osd_objid *pooid, int osd_error,
u64 offset, u64 length, bool is_write) u64 offset, u64 length, bool is_write)
{ {
struct pnfs_osd_ioerr *ioerr = &state->ioerrs[index]; struct pnfs_osd_ioerr *ioerr = &oir->ioerrs[index];
BUG_ON(index >= state->num_comps); BUG_ON(index >= oir->num_comps);
if (osd_error) { if (osd_error) {
ioerr->oer_component = *pooid; ioerr->oer_component = *pooid;
ioerr->oer_comp_offset = offset; ioerr->oer_comp_offset = offset;
...@@ -247,15 +247,15 @@ static void _rpc_read_complete(struct work_struct *work) ...@@ -247,15 +247,15 @@ static void _rpc_read_complete(struct work_struct *work)
} }
void void
objlayout_read_done(struct objlayout_io_state *state, ssize_t status, bool sync) objlayout_read_done(struct objlayout_io_res *oir, ssize_t status, bool sync)
{ {
struct nfs_read_data *rdata = state->rpcdata; struct nfs_read_data *rdata = oir->rpcdata;
state->status = rdata->task.tk_status = status; oir->status = rdata->task.tk_status = status;
if (status >= 0) if (status >= 0)
rdata->res.count = status; rdata->res.count = status;
objlayout_iodone(state); objlayout_iodone(oir);
/* must not use state after this point */ /* must not use oir after this point */
dprintk("%s: Return status=%zd eof=%d sync=%d\n", __func__, dprintk("%s: Return status=%zd eof=%d sync=%d\n", __func__,
status, rdata->res.eof, sync); status, rdata->res.eof, sync);
...@@ -326,17 +326,16 @@ static void _rpc_write_complete(struct work_struct *work) ...@@ -326,17 +326,16 @@ static void _rpc_write_complete(struct work_struct *work)
} }
void void
objlayout_write_done(struct objlayout_io_state *state, ssize_t status, objlayout_write_done(struct objlayout_io_res *oir, ssize_t status, bool sync)
bool sync)
{ {
struct nfs_write_data *wdata = state->rpcdata; struct nfs_write_data *wdata = oir->rpcdata;
state->status = wdata->task.tk_status = status; oir->status = wdata->task.tk_status = status;
if (status >= 0) { if (status >= 0) {
wdata->res.count = status; wdata->res.count = status;
wdata->verf.committed = state->committed; wdata->verf.committed = oir->committed;
} }
objlayout_iodone(state); objlayout_iodone(oir);
/* must not use oir after this point */ /* must not use oir after this point */
dprintk("%s: Return status %zd committed %d sync=%d\n", __func__, dprintk("%s: Return status %zd committed %d sync=%d\n", __func__,
...@@ -475,14 +474,14 @@ merge_ioerr(struct pnfs_osd_ioerr *dest_err, ...@@ -475,14 +474,14 @@ merge_ioerr(struct pnfs_osd_ioerr *dest_err,
static void static void
encode_accumulated_error(struct objlayout *objlay, __be32 *p) encode_accumulated_error(struct objlayout *objlay, __be32 *p)
{ {
struct objlayout_io_state *state, *tmp; struct objlayout_io_res *oir, *tmp;
struct pnfs_osd_ioerr accumulated_err = {.oer_errno = 0}; struct pnfs_osd_ioerr accumulated_err = {.oer_errno = 0};
list_for_each_entry_safe(state, tmp, &objlay->err_list, err_list) { list_for_each_entry_safe(oir, tmp, &objlay->err_list, err_list) {
unsigned i; unsigned i;
for (i = 0; i < state->num_comps; i++) { for (i = 0; i < oir->num_comps; i++) {
struct pnfs_osd_ioerr *ioerr = &state->ioerrs[i]; struct pnfs_osd_ioerr *ioerr = &oir->ioerrs[i];
if (!ioerr->oer_errno) if (!ioerr->oer_errno)
continue; continue;
...@@ -501,8 +500,8 @@ encode_accumulated_error(struct objlayout *objlay, __be32 *p) ...@@ -501,8 +500,8 @@ encode_accumulated_error(struct objlayout *objlay, __be32 *p)
merge_ioerr(&accumulated_err, ioerr); merge_ioerr(&accumulated_err, ioerr);
} }
list_del(&state->err_list); list_del(&oir->err_list);
objio_free_result(state); objio_free_result(oir);
} }
pnfs_osd_xdr_encode_ioerr(p, &accumulated_err); pnfs_osd_xdr_encode_ioerr(p, &accumulated_err);
...@@ -514,7 +513,7 @@ objlayout_encode_layoutreturn(struct pnfs_layout_hdr *pnfslay, ...@@ -514,7 +513,7 @@ objlayout_encode_layoutreturn(struct pnfs_layout_hdr *pnfslay,
const struct nfs4_layoutreturn_args *args) const struct nfs4_layoutreturn_args *args)
{ {
struct objlayout *objlay = OBJLAYOUT(pnfslay); struct objlayout *objlay = OBJLAYOUT(pnfslay);
struct objlayout_io_state *state, *tmp; struct objlayout_io_res *oir, *tmp;
__be32 *start; __be32 *start;
dprintk("%s: Begin\n", __func__); dprintk("%s: Begin\n", __func__);
...@@ -523,13 +522,13 @@ objlayout_encode_layoutreturn(struct pnfs_layout_hdr *pnfslay, ...@@ -523,13 +522,13 @@ objlayout_encode_layoutreturn(struct pnfs_layout_hdr *pnfslay,
spin_lock(&objlay->lock); spin_lock(&objlay->lock);
list_for_each_entry_safe(state, tmp, &objlay->err_list, err_list) { list_for_each_entry_safe(oir, tmp, &objlay->err_list, err_list) {
__be32 *last_xdr = NULL, *p; __be32 *last_xdr = NULL, *p;
unsigned i; unsigned i;
int res = 0; int res = 0;
for (i = 0; i < state->num_comps; i++) { for (i = 0; i < oir->num_comps; i++) {
struct pnfs_osd_ioerr *ioerr = &state->ioerrs[i]; struct pnfs_osd_ioerr *ioerr = &oir->ioerrs[i];
if (!ioerr->oer_errno) if (!ioerr->oer_errno)
continue; continue;
...@@ -553,7 +552,7 @@ objlayout_encode_layoutreturn(struct pnfs_layout_hdr *pnfslay, ...@@ -553,7 +552,7 @@ objlayout_encode_layoutreturn(struct pnfs_layout_hdr *pnfslay,
} }
last_xdr = p; last_xdr = p;
pnfs_osd_xdr_encode_ioerr(p, &state->ioerrs[i]); pnfs_osd_xdr_encode_ioerr(p, &oir->ioerrs[i]);
} }
/* TODO: use xdr_write_pages */ /* TODO: use xdr_write_pages */
...@@ -569,8 +568,8 @@ objlayout_encode_layoutreturn(struct pnfs_layout_hdr *pnfslay, ...@@ -569,8 +568,8 @@ objlayout_encode_layoutreturn(struct pnfs_layout_hdr *pnfslay,
encode_accumulated_error(objlay, last_xdr); encode_accumulated_error(objlay, last_xdr);
goto loop_done; goto loop_done;
} }
list_del(&state->err_list); list_del(&oir->err_list);
objio_free_result(state); objio_free_result(oir);
} }
loop_done: loop_done:
spin_unlock(&objlay->lock); spin_unlock(&objlay->lock);
......
...@@ -74,7 +74,7 @@ OBJLAYOUT(struct pnfs_layout_hdr *lo) ...@@ -74,7 +74,7 @@ OBJLAYOUT(struct pnfs_layout_hdr *lo)
* per-I/O operation state * per-I/O operation state
* embedded in objects provider io_state data structure * embedded in objects provider io_state data structure
*/ */
struct objlayout_io_state { struct objlayout_io_res {
struct objlayout *objlay; struct objlayout *objlay;
void *rpcdata; void *rpcdata;
...@@ -93,7 +93,7 @@ struct objlayout_io_state { ...@@ -93,7 +93,7 @@ struct objlayout_io_state {
}; };
static inline static inline
void objlayout_init_ioerrs(struct objlayout_io_state *oir, unsigned num_comps, void objlayout_init_ioerrs(struct objlayout_io_res *oir, unsigned num_comps,
struct pnfs_osd_ioerr *ioerrs, void *rpcdata, struct pnfs_osd_ioerr *ioerrs, void *rpcdata,
struct pnfs_layout_hdr *pnfs_layout_type) struct pnfs_layout_hdr *pnfs_layout_type)
{ {
...@@ -114,7 +114,10 @@ extern int objio_alloc_lseg(struct pnfs_layout_segment **outp, ...@@ -114,7 +114,10 @@ extern int objio_alloc_lseg(struct pnfs_layout_segment **outp,
gfp_t gfp_flags); gfp_t gfp_flags);
extern void objio_free_lseg(struct pnfs_layout_segment *lseg); extern void objio_free_lseg(struct pnfs_layout_segment *lseg);
extern void objio_free_result(struct objlayout_io_state *state); /* objio_free_result will free these @oir structs recieved from
* objlayout_{read,write}_done
*/
extern void objio_free_result(struct objlayout_io_res *oir);
extern int objio_read_pagelist(struct nfs_read_data *rdata); extern int objio_read_pagelist(struct nfs_read_data *rdata);
extern int objio_write_pagelist(struct nfs_write_data *wdata, int how); extern 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,7 +125,7 @@ extern int objio_write_pagelist(struct nfs_write_data *wdata, int how);
/* /*
* callback API * callback API
*/ */
extern void objlayout_io_set_result(struct objlayout_io_state *state, extern void objlayout_io_set_result(struct objlayout_io_res *oir,
unsigned index, struct pnfs_osd_objid *pooid, unsigned index, struct pnfs_osd_objid *pooid,
int osd_error, u64 offset, u64 length, bool is_write); int osd_error, u64 offset, u64 length, bool is_write);
...@@ -141,9 +144,9 @@ objlayout_add_delta_space_used(struct objlayout *objlay, s64 space_used) ...@@ -141,9 +144,9 @@ objlayout_add_delta_space_used(struct objlayout *objlay, s64 space_used)
spin_unlock(&objlay->lock); spin_unlock(&objlay->lock);
} }
extern void objlayout_read_done(struct objlayout_io_state *state, extern void objlayout_read_done(struct objlayout_io_res *oir,
ssize_t status, bool sync); ssize_t status, bool sync);
extern void objlayout_write_done(struct objlayout_io_state *state, extern void objlayout_write_done(struct objlayout_io_res *oir,
ssize_t status, bool sync); ssize_t status, bool sync);
extern int objlayout_get_deviceinfo(struct pnfs_layout_hdr *pnfslay, extern int objlayout_get_deviceinfo(struct pnfs_layout_hdr *pnfslay,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment