예제 #1
0
int lov_setea(struct obd_export *exp, struct lov_stripe_md **lsmp,
              struct lov_user_md *lump)
{
    int i;
    int rc;
    struct obd_export *oexp;
    struct lov_obd *lov = &exp->exp_obd->u.lov;
    obd_id last_id = 0;
    struct lov_user_ost_data_v1 *lmm_objects;

    ENTRY;

    if (lump->lmm_magic == LOV_USER_MAGIC_V3)
        lmm_objects = ((struct lov_user_md_v3 *)lump)->lmm_objects;
    else
        lmm_objects = lump->lmm_objects;

    for (i = 0; i < lump->lmm_stripe_count; i++) {
        __u32 len = sizeof(last_id);
        oexp = lov->lov_tgts[lmm_objects[i].l_ost_idx]->ltd_exp;
        rc = obd_get_info(oexp, sizeof(KEY_LAST_ID), KEY_LAST_ID,
                          &len, &last_id, NULL);
        if (rc)
            RETURN(rc);
        if (lmm_objects[i].l_object_id > last_id) {
            CERROR("Setting EA for object > than last id on "
                   "ost idx %d "LPD64" > "LPD64" \n",
                   lmm_objects[i].l_ost_idx,
                   lmm_objects[i].l_object_id, last_id);
            RETURN(-EINVAL);
        }
    }

    rc = lov_setstripe(exp, 0, lsmp, lump);
    if (rc)
        RETURN(rc);

    for (i = 0; i < lump->lmm_stripe_count; i++) {
        (*lsmp)->lsm_oinfo[i]->loi_ost_idx =
            lmm_objects[i].l_ost_idx;
        (*lsmp)->lsm_oinfo[i]->loi_id = lmm_objects[i].l_object_id;
        (*lsmp)->lsm_oinfo[i]->loi_seq = lmm_objects[i].l_object_seq;
    }
    RETURN(0);
}
예제 #2
0
int lov_setea(struct obd_export *exp, struct lov_stripe_md **lsmp,
	      struct lov_user_md *lump)
{
	int i;
	int rc;
	struct obd_export *oexp;
	struct lov_obd *lov = &exp->exp_obd->u.lov;
	obd_id last_id = 0;
	struct lov_user_ost_data_v1 *lmm_objects;

	if (lump->lmm_magic == LOV_USER_MAGIC_V3)
		lmm_objects = ((struct lov_user_md_v3 *)lump)->lmm_objects;
	else
		lmm_objects = lump->lmm_objects;

	for (i = 0; i < lump->lmm_stripe_count; i++) {
		__u32 len = sizeof(last_id);
		oexp = lov->lov_tgts[lmm_objects[i].l_ost_idx]->ltd_exp;
		rc = obd_get_info(NULL, oexp, sizeof(KEY_LAST_ID), KEY_LAST_ID,
				  &len, &last_id, NULL);
		if (rc)
			return rc;
		if (ostid_id(&lmm_objects[i].l_ost_oi) > last_id) {
			CERROR("Setting EA for object > than last id on"
			       " ost idx %d "DOSTID" > %lld \n",
			       lmm_objects[i].l_ost_idx,
			       POSTID(&lmm_objects[i].l_ost_oi), last_id);
			return -EINVAL;
		}
	}

	rc = lov_setstripe(exp, 0, lsmp, lump);
	if (rc)
		return rc;

	for (i = 0; i < lump->lmm_stripe_count; i++) {
		(*lsmp)->lsm_oinfo[i]->loi_ost_idx =
			lmm_objects[i].l_ost_idx;
		(*lsmp)->lsm_oinfo[i]->loi_oi = lmm_objects[i].l_ost_oi;
	}
	return 0;
}