lov->lov_qos.lq_rr_array[next] = i;
j++;
placed++;
- }
+ }
}
LASSERT(j == oss->lqo_ost_count);
}
} else if (stripe_cnt_min >= ost_active_count ||
lov->lov_start_idx > ost_count) {
/* If we have allocated from all of the OSTs, slowly
- precess the next start */
+ * precess the next start if the OST/stripe count isn't
+ * already doing this for us. */
lov->lov_start_idx %= ost_count;
- ++lov->lov_offset_idx;
+ if (*stripe_cnt > 1 && (ost_active_count % (*stripe_cnt)) != 1)
+ ++lov->lov_offset_idx;
}
down_read(&lov->lov_qos.lq_rw_sem);
ost_start_idx_temp = lov->lov_start_idx;
array_idx = (lov->lov_start_idx + lov->lov_offset_idx) % ost_count;
idx_pos = idx_arr;
#ifdef QOS_DEBUG
- CDEBUG(D_QOS, "want %d startidx %d startcnt %d offset %d arrayidx %d\n",
- stripe_cnt_min, lov->lov_start_idx, lov->lov_start_count,
- lov->lov_offset_idx, array_idx);
+ CDEBUG(D_QOS, "want %d startidx %d startcnt %d offset %d active %d "
+ "count %d arrayidx %d\n",
+ stripe_cnt, lov->lov_start_idx, lov->lov_start_count,
+ lov->lov_offset_idx, ost_active_count, ost_count, array_idx);
#endif
for (i = 0; i < ost_count; i++, array_idx=(array_idx + 1) % ost_count) {
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;
if (OBD_FAIL_CHECK(OBD_FAIL_MDS_OSC_PRECREATE) && ost_idx == 0)
continue;
- /* Drop slow OSCs if we can */
- if (obd_precreate(lov->lov_tgts[ost_idx]->ltd_exp, speed == 0) >
- speed)
+ /* Drop slow OSCs if we can, but not for requested start idx */
+ if (obd_precreate(lov->lov_tgts[ost_idx]->ltd_exp) > speed &&
+ (i != 0 || speed < 2))
continue;
*idx_pos = ost_idx;
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 (!total_bavail)
- GOTO(out, rc = -ENOSPC);
-
if (good_osts < stripe_cnt_min)
GOTO(out, rc = -EAGAIN);
+ if (!total_bavail)
+ GOTO(out, rc = -ENOSPC);
+
/* We have enough osts */
if (good_osts < *stripe_cnt)
*stripe_cnt = good_osts;
struct obd_trans_info *oti = set->set_oti;
int i, stripes, rc = 0, newea = 0;
int flag = LOV_USES_ASSIGNED_STRIPE;
- int *idx_arr, idx_cnt = 0;
+ int *idx_arr = NULL, idx_cnt = 0;
ENTRY;
LASSERT(src_oa->o_valid & OBD_MD_FLID);