+/**
+ * Check whether we can create the object on the OST(refered by ost_idx)
+ * \retval:
+ * 0: create the object.
+ * other value: did not create the object.
+ */
+static int lov_check_and_create_object(struct lov_obd *lov, int ost_idx,
+ struct lov_stripe_md *lsm,
+ struct lov_request *req,
+ struct obd_trans_info *oti)
+{
+ __u16 stripe;
+ int rc = -EIO;
+ ENTRY;
+
+ CDEBUG(D_QOS, "Check and create on idx %d \n", ost_idx);
+ if (!lov->lov_tgts[ost_idx] ||
+ !lov->lov_tgts[ost_idx]->ltd_active)
+ RETURN(rc);
+
+ /* check if objects has been created on this ost */
+ for (stripe = 0; stripe < lsm->lsm_stripe_count; stripe++) {
+ /* already have object at this stripe */
+ if (ost_idx == lsm->lsm_oinfo[stripe]->loi_ost_idx)
+ break;
+ }
+
+ if (stripe >= lsm->lsm_stripe_count) {
+ req->rq_idx = ost_idx;
+ rc = obd_create(lov->lov_tgts[ost_idx]->ltd_exp,
+ req->rq_oi.oi_oa, &req->rq_oi.oi_md,
+ oti);
+ }
+ RETURN(rc);
+}
+