Exemple #1
0
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;
}
Exemple #2
0
void lov_dump_lmm(int level, void *lmm)
{
    int magic;

    magic = ((struct lov_mds_md_v1 *)(lmm))->lmm_magic;
    switch (magic) {
    case LOV_MAGIC_V1:
        return lov_dump_lmm_v1(level, (struct lov_mds_md_v1 *)(lmm));
    case LOV_MAGIC_V3:
        return lov_dump_lmm_v3(level, (struct lov_mds_md_v3 *)(lmm));
    default:
        CERROR("Cannot recognize lmm_magic %x", magic);
    }
    return;
}
void lov_dump_lmm(int level, void *lmm)
{
	int magic;

	magic = le32_to_cpu(((struct lov_mds_md *)lmm)->lmm_magic);
	switch (magic) {
	case LOV_MAGIC_V1:
		lov_dump_lmm_v1(level, (struct lov_mds_md_v1 *)lmm);
		break;
	case LOV_MAGIC_V3:
		lov_dump_lmm_v3(level, (struct lov_mds_md_v3 *)lmm);
		break;
	default:
		CDEBUG(level, "unrecognized lmm_magic %x, assuming %x\n",
		       magic, LOV_MAGIC_V1);
		lov_dump_lmm_common(level, lmm);
		break;
	}
}
Exemple #4
0
static int lsm_unpackmd_common(struct lov_obd *lov,
			       struct lov_stripe_md *lsm,
			       struct lov_mds_md *lmm,
			       struct lov_ost_data_v1 *objects)
{
	struct lov_oinfo *loi;
	loff_t stripe_maxbytes = LLONG_MAX;
	unsigned int stripe_count;
	unsigned int i;

	/*
	 * This supposes lov_mds_md_v1/v3 first fields are
	 * are the same
	 */
	lmm_oi_le_to_cpu(&lsm->lsm_oi, &lmm->lmm_oi);
	lsm->lsm_stripe_size = le32_to_cpu(lmm->lmm_stripe_size);
	lsm->lsm_pattern = le32_to_cpu(lmm->lmm_pattern);
	lsm->lsm_layout_gen = le16_to_cpu(lmm->lmm_layout_gen);
	lsm->lsm_pool_name[0] = '\0';

	stripe_count = lsm_is_released(lsm) ? 0 : lsm->lsm_stripe_count;

	for (i = 0; i < stripe_count; i++) {
		loi = lsm->lsm_oinfo[i];
		ostid_le_to_cpu(&objects[i].l_ost_oi, &loi->loi_oi);
		loi->loi_ost_idx = le32_to_cpu(objects[i].l_ost_idx);
		loi->loi_ost_gen = le32_to_cpu(objects[i].l_ost_gen);
		if (lov_oinfo_is_dummy(loi))
			continue;

		if (loi->loi_ost_idx >= lov->desc.ld_tgt_count &&
		    !lov2obd(lov)->obd_process_conf) {
			CERROR("%s: OST index %d more than OST count %d\n",
			       (char*)lov->desc.ld_uuid.uuid,
			       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] == NULL) {
			CERROR("%s: OST index %d missing\n",
			       (char*)lov->desc.ld_uuid.uuid, loi->loi_ost_idx);
			lov_dump_lmm_v1(D_WARNING, lmm);
			continue;
		}

		stripe_maxbytes = min_t(loff_t, stripe_maxbytes,
					lov_tgt_maxbytes(
					lov->lov_tgts[loi->loi_ost_idx]));
	}

	if (stripe_maxbytes == LLONG_MAX)
		stripe_maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES;

	if (lsm->lsm_stripe_count == 0)
		lsm->lsm_maxbytes = stripe_maxbytes * lov->desc.ld_tgt_count;
	else
		lsm->lsm_maxbytes = stripe_maxbytes * lsm->lsm_stripe_count;

	return 0;
}