int lsm_unpackmd_v1(struct lov_obd *lov, struct lov_stripe_md *lsm, struct lov_mds_md_v1 *lmm) { struct lov_oinfo *loi; int i; __u64 stripe_maxbytes = OBD_OBJECT_EOF; lsm_unpackmd_common(lsm, lmm); for (i = 0; i < lsm->lsm_stripe_count; i++) { /* XXX LOV STACKING call down to osc_unpackmd() */ loi = lsm->lsm_oinfo[i]; ostid_le_to_cpu(&lmm->lmm_objects[i].l_ost_oi, &loi->loi_oi); loi->loi_ost_idx = le32_to_cpu(lmm->lmm_objects[i].l_ost_idx); loi->loi_ost_gen = le32_to_cpu(lmm->lmm_objects[i].l_ost_gen); if (loi->loi_ost_idx >= lov->desc.ld_tgt_count) { CERROR("OST index %d more than OST count %d\n", loi->loi_ost_idx, lov->desc.ld_tgt_count); lov_dump_lmm_v1(D_WARNING, lmm); return -EINVAL; } if (!lov->lov_tgts[loi->loi_ost_idx]) { CERROR("OST index %d missing\n", loi->loi_ost_idx); lov_dump_lmm_v1(D_WARNING, lmm); return -EINVAL; } /* calculate the minimum stripe max bytes */ lov_tgt_maxbytes(lov->lov_tgts[loi->loi_ost_idx], &stripe_maxbytes); } lsm->lsm_maxbytes = stripe_maxbytes * lsm->lsm_stripe_count; return 0; }
static int lsm_unpackmd_v3(struct lov_obd *lov, struct lov_stripe_md *lsm, struct lov_mds_md *lmmv1) { struct lov_mds_md_v3 *lmm; struct lov_oinfo *loi; int i; int stripe_count; __u64 stripe_maxbytes = OBD_OBJECT_EOF; int cplen = 0; lmm = (struct lov_mds_md_v3 *)lmmv1; lsm_unpackmd_common(lsm, (struct lov_mds_md_v1 *)lmm); stripe_count = lsm_is_released(lsm) ? 0 : lsm->lsm_stripe_count; cplen = strlcpy(lsm->lsm_pool_name, lmm->lmm_pool_name, sizeof(lsm->lsm_pool_name)); if (cplen >= sizeof(lsm->lsm_pool_name)) return -E2BIG; for (i = 0; i < stripe_count; i++) { /* XXX LOV STACKING call down to osc_unpackmd() */ loi = lsm->lsm_oinfo[i]; ostid_le_to_cpu(&lmm->lmm_objects[i].l_ost_oi, &loi->loi_oi); loi->loi_ost_idx = le32_to_cpu(lmm->lmm_objects[i].l_ost_idx); loi->loi_ost_gen = le32_to_cpu(lmm->lmm_objects[i].l_ost_gen); if (lov_oinfo_is_dummy(loi)) continue; if (loi->loi_ost_idx >= lov->desc.ld_tgt_count) { CERROR("OST index %d more than OST count %d\n", loi->loi_ost_idx, lov->desc.ld_tgt_count); lov_dump_lmm_v3(D_WARNING, lmm); return -EINVAL; } if (!lov->lov_tgts[loi->loi_ost_idx]) { CERROR("OST index %d missing\n", loi->loi_ost_idx); lov_dump_lmm_v3(D_WARNING, lmm); return -EINVAL; } /* calculate the minimum stripe max bytes */ lov_tgt_maxbytes(lov->lov_tgts[loi->loi_ost_idx], &stripe_maxbytes); } lsm->lsm_maxbytes = stripe_maxbytes * lsm->lsm_stripe_count; if (lsm->lsm_stripe_count == 0) lsm->lsm_maxbytes = stripe_maxbytes * lov->desc.ld_tgt_count; return 0; }
static int lsm_unpackmd_v3(struct lov_obd *lov, struct lov_stripe_md *lsm, struct lov_mds_md *lmm) { struct lov_mds_md_v3 *lmm_v3 = (struct lov_mds_md_v3 *)lmm; size_t cplen; int rc; rc = lsm_unpackmd_common(lov, lsm, lmm, lmm_v3->lmm_objects); if (rc != 0) return rc; cplen = strlcpy(lsm->lsm_pool_name, lmm_v3->lmm_pool_name, sizeof(lsm->lsm_pool_name)); if (cplen >= sizeof(lsm->lsm_pool_name)) return -E2BIG; return 0; }
static int lsm_unpackmd_v1(struct lov_obd *lov, struct lov_stripe_md *lsm, struct lov_mds_md_v1 *lmm) { return lsm_unpackmd_common(lov, lsm, lmm, lmm->lmm_objects); }