static int qos_calc_weight(struct lov_obd *lov, int i)
{
__u64 temp, temp2;
-
+
/* Final ost weight = TGT_BAVAIL - ost_penalty - oss_penalty */
temp = TGT_BAVAIL(i);
temp2 = lov->lov_tgts[i]->ltd_qos.ltq_penalty +
lov->lov_tgts[index]->ltd_qos.ltq_usable = 0;
oss = lov->lov_tgts[index]->ltd_qos.ltq_oss;
-
+
/* Decay old penalty by half (we're adding max penalty, and don't
want it to run away.) */
lov->lov_tgts[index]->ltd_qos.ltq_penalty >>= 1;
lov->desc.ld_active_tgt_count;
oss->lqo_penalty += oss->lqo_penalty_per_obj *
lov->lov_qos.lq_active_oss_count;
-
+
/* Decrease all OSS penalties */
list_for_each_entry(oss, &lov->lov_qos.lq_oss_list, lqo_oss_list) {
if (oss->lqo_penalty < oss->lqo_penalty_per_obj)
list_for_each_entry(oss, &lov->lov_qos.lq_oss_list, lqo_oss_list) {
int j = 0;
for (i = 0; i < ost_count; i++) {
- LASSERT(lov->lov_tgts[i] != NULL);
- if (lov->lov_tgts[i]->ltd_qos.ltq_oss == oss) {
+ if(lov->lov_tgts[i] &&
+ lov->lov_tgts[i]->ltd_qos.ltq_oss == oss) {
/* Evenly space these OSTs across arrayspace */
int next = j * ost_count / oss->lqo_ost_count;
LASSERT(next < ost_count);
lov->lov_qos.lq_rr_array[next] = i;
j++;
placed++;
- }
+ }
}
LASSERT(j == oss->lqo_ost_count);
}
/* If we have allocated from all of the OSTs, slowly
precess the next start */
lov->lov_start_idx %= ost_count;
- if (stripe_cnt_min > 1 &&
- (ost_active_count % stripe_cnt_min) != 1)
+ if (*stripe_cnt > 1 && (ost_active_count % (*stripe_cnt)) != 1)
++lov->lov_offset_idx;
}
down_read(&lov->lov_qos.lq_rw_sem);
continue;
/* Drop slow OSCs if we can */
- if (obd_precreate(lov->lov_tgts[ost_idx]->ltd_exp, speed == 0) >
- speed)
+ if (obd_precreate(lov->lov_tgts[ost_idx]->ltd_exp) > speed)
continue;
*idx_pos = ost_idx;
continue;
/* Drop slow OSCs if we can */
- if (obd_precreate(lov->lov_tgts[ost_idx]->ltd_exp, speed == 0) >
- speed)
+ if ((obd_precreate(lov->lov_tgts[ost_idx]->ltd_exp) > speed) &&
+ (i != 0 || speed < 2))
continue;
*idx_pos = ost_idx;
*
* We can only get here if lsm_stripe_count was originally > 1.
*/
- CERROR("can't lstripe objid "LPX64": have "LPSZ" want %u\n",
- lsm->lsm_object_id, idx_pos - idx_arr, lsm->lsm_stripe_count);
+ CERROR("can't lstripe objid "LPX64": have %d want %u\n",
+ lsm->lsm_object_id, (int)(idx_pos - idx_arr),
+ lsm->lsm_stripe_count);
RETURN(-EFBIG);
}
GOTO(out_up_write, rc = -EAGAIN);
rc = qos_calc_ppo(exp->exp_obd);
- if (rc)
+ if (rc)
GOTO(out_up_write, rc);
-
+
total_bavail = 0;
good_osts = 0;
/* Warn users about zero available space/inode every 30 min */
/* Find all the OSTs that are valid stripe candidates */
for (i = 0; i < ost_count; i++) {
__u64 bavail;
-
+
if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_active)
continue;
bavail = TGT_BAVAIL(i);
if (OBD_FAIL_CHECK(OBD_FAIL_MDS_OSC_PRECREATE) && i == 0)
continue;
- if (obd_precreate(lov->lov_tgts[i]->ltd_exp, 1) >= 2)
+ if (obd_precreate(lov->lov_tgts[i]->ltd_exp) > 2)
continue;
lov->lov_tgts[i]->ltd_qos.ltq_usable = 1;
good_osts++;
}
+ if (good_osts < stripe_cnt_min)
+ GOTO(out_up_write, rc = -EAGAIN);
+
if (!total_bavail)
GOTO(out_up_write, rc = -ENOSPC);
- if (good_osts < stripe_cnt_min)
- GOTO(out_up_write, rc = -EAGAIN);
-
/* We have enough osts */
if (good_osts < *stripe_cnt)
*stripe_cnt = good_osts;
struct obdo *src_oa = set->set_oi->oi_oa;
struct obd_trans_info *oti = set->set_oti;
int i, stripes, rc = 0, newea = 0;
- int *idx_arr, idx_cnt = 0;
+ int *idx_arr = NULL, idx_cnt = 0;
int flag = LOV_USES_ASSIGNED_STRIPE;
ENTRY;
out_err:
if (newea && rc)
obd_free_memmd(exp, &set->set_oi->oi_md);
- free_idx_array(idx_arr, idx_cnt);
+ if (idx_arr)
+ free_idx_array(idx_arr, idx_cnt);
EXIT;
return rc;
}