}
}
-/* Save a large LOV EA into the request buffer so that it is available
+/**
+ * Save a large LOV EA into the request buffer so that it is available
* for replay. We don't do this in the initial request because the
* original request doesn't need this buffer (at most it sends just the
* lov_mds_md) and it is a waste of RAM/bandwidth to send the empty
* but this is incredibly unlikely, and questionable whether the client
* could do MDS recovery under OOM anyways...
*/
-int mdc_save_lovea(struct ptlrpc_request *req,
- const struct req_msg_field *field, void *data, u32 size)
+static int mdc_save_lovea(struct ptlrpc_request *req, void *data, u32 size)
{
struct req_capsule *pill = &req->rq_pill;
- struct lov_user_md *lmm;
+ void *lovea;
int rc = 0;
- if (req_capsule_get_size(pill, field, RCL_CLIENT) < size) {
- rc = sptlrpc_cli_enlarge_reqbuf(req, field, size);
+ if (req_capsule_get_size(pill, &RMF_EADATA, RCL_CLIENT) < size) {
+ rc = sptlrpc_cli_enlarge_reqbuf(req, &RMF_EADATA, size);
if (rc) {
CERROR("%s: Can't enlarge ea size to %d: rc = %d\n",
req->rq_export->exp_obd->obd_name,
return rc;
}
} else {
- req_capsule_shrink(pill, field, size, RCL_CLIENT);
+ req_capsule_shrink(pill, &RMF_EADATA, size, RCL_CLIENT);
}
- req_capsule_set_size(pill, field, RCL_CLIENT, size);
- lmm = req_capsule_client_get(pill, field);
- if (lmm) {
- memcpy(lmm, data, size);
- /* overwrite layout generation returned from the MDS */
- lmm->lmm_stripe_offset =
- (typeof(lmm->lmm_stripe_offset))LOV_OFFSET_DEFAULT;
+ req_capsule_set_size(pill, &RMF_EADATA, RCL_CLIENT, size);
+ lovea = req_capsule_client_get(pill, &RMF_EADATA);
+ if (lovea) {
+ memcpy(lovea, data, size);
+ lov_fix_ea_for_replay(lovea);
}
return rc;
* (for example error one).
*/
if ((it->it_op & IT_OPEN) && req->rq_replay) {
- rc = mdc_save_lovea(req, &RMF_EADATA, eadata,
+ rc = mdc_save_lovea(req, eadata,
body->mbo_eadatasize);
if (rc) {
body->mbo_valid &= ~OBD_MD_FLEASIZE;
* another set of OST objects).
*/
if (req->rq_transno)
- (void)mdc_save_lovea(req, &RMF_EADATA, lvb_data,
- lvb_len);
+ (void)mdc_save_lovea(req, lvb_data, lvb_len);
}
}