- loi++;
- }
-
- RETURN(0);
-}
-
-static int lsm_revalidate_join(struct lov_stripe_md *lsm,
- struct obd_device *obd)
-{
- struct llog_handle *llh;
- struct llog_ctxt *ctxt;
- struct lovea_unpack_args args;
- int rc, rc2;
- ENTRY;
-
- LASSERT(lsm->lsm_array != NULL);
-
- /*Revalidate lsm might be called from client or MDS server.
- *So the ctxt might be in different position
- */
- ctxt = llog_get_context(obd, LLOG_LOVEA_REPL_CTXT);
- if (!ctxt)
- ctxt = llog_get_context(obd, LLOG_LOVEA_ORIG_CTXT);
-
- LASSERT(ctxt);
-
- if (lsm->lsm_array && lsm->lsm_array->lai_ext_array)
- RETURN(0);
-
- CDEBUG(D_INFO, "get lsm logid: "LPU64":"LPU64"\n",
- lsm->lsm_array->lai_array_id.lgl_oid,
- lsm->lsm_array->lai_array_id.lgl_ogr);
- OBD_ALLOC(lsm->lsm_array->lai_ext_array,lsm->lsm_array->lai_ext_count *
- sizeof (struct lov_extent));
- if (!lsm->lsm_array->lai_ext_array)
- RETURN(-ENOMEM);
-
- CDEBUG(D_INFO, "get lsm logid: "LPU64":"LPU64"\n",
- lsm->lsm_array->lai_array_id.lgl_oid,
- lsm->lsm_array->lai_array_id.lgl_ogr);
-
- rc = llog_create(ctxt, &llh, &lsm->lsm_array->lai_array_id, NULL);
- if (rc)
- GOTO(out, rc);
-
- args.lsm = lsm;
- args.cursor = 0;
- rc = llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL);
- if (rc == 0)
- rc = llog_process(llh, lovea_unpack_array, &args, NULL);
- rc2 = llog_close(llh);
- if (rc == 0)
- rc = rc2;
-out:
- if (rc)
- lovea_free_array_info(lsm);
- RETURN(rc);
-}
-
-int lsm_destroy_join(struct lov_stripe_md *lsm, struct obdo *oa,
- struct obd_export *md_exp)
-{
- struct llog_ctxt *ctxt;
- struct llog_handle *llh;
- int rc = 0;
- ENTRY;
-
- LASSERT(md_exp != NULL);
- ctxt = llog_get_context(md_exp->exp_obd, LLOG_LOVEA_REPL_CTXT);
- if (!ctxt)
- GOTO(out, rc = -EINVAL);
-
- LASSERT(lsm->lsm_array != NULL);
- /*for those orphan inode, we should keep array id*/
- if (!(oa->o_valid & OBD_MD_FLCOOKIE))
- RETURN(0);
-
- LASSERT(ctxt != NULL);
- rc = llog_create(ctxt, &llh, &lsm->lsm_array->lai_array_id,
- NULL);
- if (rc)
- GOTO(out, rc);
-
- rc = llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL);
- if (rc == 0) {
- rc = llog_destroy(llh);
- }
- llog_free_handle(llh);
-out:
- RETURN(rc);
-}
-
-static int lsm_lmm_verify_join(struct lov_mds_md *lmm, int lmm_bytes,
- int *stripe_count)
-{
- struct lov_mds_md_join *lmmj = (struct lov_mds_md_join *)lmm;
-
- if (lmm_bytes < sizeof(*lmmj)) {
- CERROR("lov_mds_md too small: %d, need at least %d\n",
- lmm_bytes, (int)sizeof(*lmmj));
- return -EINVAL;
- }
-
- if (lmmj->lmmj_array_id.lgl_oid == 0) {
- CERROR("zero array object id\n");
- return -EINVAL;