- ost_idx = lsm->lsm_oinfo[0]->loi_ost_idx;
- for (i = 0; i < ost_count; i++, ost_idx = (ost_idx + 1) % ost_count) {
+ pool = lov_find_pool(lov, lsm->lsm_pool_name);
+ if (pool == NULL) {
+ osts = &(lov->lov_packed);
+ } else {
+ read_lock(&pool_tgt_rwlock(pool));
+ osts = &(pool->pool_obds);
+ }
+
+ ost_count = osts->op_count;
+
+repeat_find:
+ /* search loi_ost_idx in ost array */
+ array_idx = 0;
+ for (i = 0; i < ost_count; i++) {
+ if (osts->op_array[i] == lsm->lsm_oinfo[0]->loi_ost_idx) {
+ array_idx = i;
+ break;
+ }
+ }
+ if (i == ost_count) {
+ CERROR("Start index %d not found in pool '%s'\n",
+ lsm->lsm_oinfo[0]->loi_ost_idx, lsm->lsm_pool_name);
+ GOTO(out, rc = -EINVAL);
+ }
+
+ idx_pos = idx_arr;
+ for (i = 0; i < ost_count;
+ i++, array_idx = (array_idx + 1) % ost_count) {
+ ost_idx = osts->op_array[array_idx];
+