X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fptlrpc%2Flayout.c;fp=lustre%2Fptlrpc%2Flayout.c;h=7abd6318af45a5cc0748fc44e29ad785b7a6efb3;hp=04ffea85cbb68d26d15ef033598eb72ea013c2a3;hb=f75d2a1fc9b17b384bbcbc13bcb80ba10412cf29;hpb=bb60caa1c6e7c14c201916dc0423442d10c86a27 diff --git a/lustre/ptlrpc/layout.c b/lustre/ptlrpc/layout.c index 04ffea8..7abd631 100644 --- a/lustre/ptlrpc/layout.c +++ b/lustre/ptlrpc/layout.c @@ -1861,13 +1861,13 @@ void req_capsule_init(struct req_capsule *pill, if (req != NULL && pill == &req->rq_pill && req->rq_pill_init) return; - memset(pill, 0, sizeof *pill); + pill->rc_fmt = NULL; pill->rc_req = req; pill->rc_loc = location; - req_capsule_init_area(pill); + req_capsule_init_area(pill); - if (req != NULL && pill == &req->rq_pill) - req->rq_pill_init = 1; + if (req != NULL && pill == &req->rq_pill) + req->rq_pill_init = 1; } EXPORT_SYMBOL(req_capsule_init); @@ -1885,10 +1885,7 @@ static int __req_format_is_sane(const struct req_format *fmt) static struct lustre_msg *__req_msg(const struct req_capsule *pill, enum req_location loc) { - struct ptlrpc_request *req; - - req = pill->rc_req; - return loc == RCL_CLIENT ? req->rq_reqmsg : req->rq_repmsg; + return loc == RCL_CLIENT ? pill->rc_reqmsg : pill->rc_repmsg; } /** @@ -1989,6 +1986,26 @@ __u32 __req_capsule_offset(const struct req_capsule *pill, return offset; } +void req_capsule_set_swabbed(struct req_capsule *pill, enum req_location loc, + __u32 index) +{ + if (loc == RCL_CLIENT) + req_capsule_set_req_swabbed(pill, index); + else + req_capsule_set_rep_swabbed(pill, index); +} + +bool req_capsule_need_swab(struct req_capsule *pill, enum req_location loc, + __u32 index) +{ + if (loc == RCL_CLIENT) + return (req_capsule_req_need_swab(pill) && + !req_capsule_req_swabbed(pill, index)); + + return (req_capsule_rep_need_swab(pill) && + !req_capsule_rep_swabbed(pill, index)); +} + /** * Helper for __req_capsule_get(); swabs value / array of values and/or dumps * them if desired. @@ -2006,12 +2023,11 @@ swabber_dumper_helper(struct req_capsule *pill, int size; int rc = 0; bool do_swab; - bool inout = loc == RCL_CLIENT; bool array = field->rmf_flags & RMF_F_STRUCT_ARRAY; swabber = swabber ?: field->rmf_swabber; - if (ptlrpc_buf_need_swab(pill->rc_req, inout, offset) && + if (req_capsule_need_swab(pill, loc, offset) && (swabber != NULL || field->rmf_swab_len != NULL) && value != NULL) do_swab = true; else @@ -2072,7 +2088,7 @@ swabber_dumper_helper(struct req_capsule *pill, } } if (do_swab) - ptlrpc_buf_set_swabbed(pill->rc_req, inout, offset); + req_capsule_set_swabbed(pill, loc, offset); return rc; }