from freeing lov_create data.
- encapsulate checking no_lov_create flag inside mdd_lov_create
*/
/* Replay creates has objects already */
+#if 0
if (spec->u.sp_ea.no_lov_create) {
CDEBUG(D_INFO, "we already have lov ea\n");
rc = mdd_lov_set_md(env, mdd_pobj, son,
(struct lov_mds_md *)spec->u.sp_ea.eadata,
spec->u.sp_ea.eadatalen, handle, 0);
} else
+#endif
rc = mdd_lov_set_md(env, mdd_pobj, son, lmm,
lmm_size, handle, 0);
if (rc == 0)
rc = mdd_attr_get_internal_locked(env, son, ma);
+ /* update lov_objid data, must be before transaction stop! */
+ if (rc == 0)
+ mdd_lov_objid_update(env, mdd);
+
mdd_trans_stop(env, mdd, rc, handle);
out_free:
/* Finish mdd_lov_create() stuff. */
- mdd_lov_create_finish(env, mdd, rc);
- if (lmm)
- OBD_FREE(lmm, lmm_size);
+ mdd_lov_create_finish(env, mdd, lmm, lmm_size, spec);
RETURN(rc);
}
inserted = 1;
/* Replay creates has objects already. */
+#if 0
if (spec->u.sp_ea.no_lov_create) {
CDEBUG(D_INFO, "we already have lov ea\n");
LASSERT(lmm == NULL);
lmm = (struct lov_mds_md *)spec->u.sp_ea.eadata;
lmm_size = spec->u.sp_ea.eadatalen;
}
+#endif
rc = mdd_lov_set_md(env, mdd_pobj, son, lmm, lmm_size, handle, 0);
if (rc) {
CERROR("error on stripe info copy %d \n", rc);
}
}
+ /* update lov_objid data, must be before transaction stop! */
+ if (rc == 0)
+ mdd_lov_objid_update(env, mdd);
+
mdd_pdo_write_unlock(env, mdd_pobj, dlh);
out_trans:
mdd_trans_stop(env, mdd, rc, handle);
out_free:
- if (lmm && !spec->u.sp_ea.no_lov_create)
- OBD_FREE(lmm, lmm_size);
- /* Finish mdd_lov_create() stuff */
- mdd_lov_create_finish(env, mdd, rc);
+ /* finis lov_create stuff, free all temporary data */
+ mdd_lov_create_finish(env, mdd, lmm, lmm_size, spec);
mdd_lprocfs_time_end(mdd, &start, LPROC_MDD_CREATE);
return rc;
}
struct mdd_object *parent, struct mdd_object *child,
struct lov_mds_md **lmm, int *lmm_size,
const struct md_op_spec *spec, struct lu_attr *la);
-void mdd_lov_create_finish(const struct lu_env *env,
- struct mdd_device *mdd, int rc);
+void mdd_lov_objid_update(const struct lu_env *env, struct mdd_device *mdd);
+void mdd_lov_create_finish(const struct lu_env *env, struct mdd_device *mdd,
+ struct lov_mds_md *lmm, int lmm_size,
+ const struct md_op_spec *spec);
int mdd_get_md(const struct lu_env *env, struct mdd_object *obj,
void *md, int *md_size, const char *name);
int mdd_get_md_locked(const struct lu_env *env, struct mdd_object *obj,
return (info->mti_oti.oti_objid == NULL ? -ENOMEM : 0);
}
-static void mdd_lov_objid_update(const struct lu_env *env,
- struct mdd_device *mdd)
+void mdd_lov_objid_update(const struct lu_env *env, struct mdd_device *mdd)
{
struct mdd_thread_info *info = mdd_env_info(env);
- mds_lov_update_objids(mdd->mdd_obd_dev, info->mti_oti.oti_objid);
+ if (info->mti_oti.oti_objid != NULL)
+ mds_lov_update_objids(mdd->mdd_obd_dev,
+ info->mti_oti.oti_objid);
}
static void mdd_lov_objid_from_lmm(const struct lu_env *env,
info->mti_oti.oti_objid = NULL;
}
-void mdd_lov_create_finish(const struct lu_env *env,
- struct mdd_device *mdd, int rc)
+void mdd_lov_create_finish(const struct lu_env *env, struct mdd_device *mdd,
+ struct lov_mds_md *lmm, int lmm_size,
+ const struct md_op_spec *spec)
{
struct mdd_thread_info *info = mdd_env_info(env);
- if (info->mti_oti.oti_objid != NULL) {
- if (rc == 0)
- mdd_lov_objid_update(env, mdd);
+ if (lmm && !spec->u.sp_ea.no_lov_create)
+ OBD_FREE(lmm, lmm_size);
+
+ if (info->mti_oti.oti_objid != NULL)
mdd_lov_objid_free(env, mdd);
- }
}
int mdd_lov_create(const struct lu_env *env, struct mdd_device *mdd,
/* replay case, should get lov from eadata */
if (spec->u.sp_ea.no_lov_create != 0) {
- mdd_lov_objid_from_lmm(env, mdd, (struct lov_mds_md *)eadata);
+ *lmm = (struct lov_mds_md *)spec->u.sp_ea.eadata;
+ *lmm_size = spec->u.sp_ea.eadatalen;
+ mdd_lov_objid_from_lmm(env, mdd, *lmm);
RETURN(0);
}