Whamcloud - gitweb
Prepare for Build 33
[fs/lustre-release.git] / lustre / lov / lov_qos.c
index 7842f8f..eaa2eb1 100644 (file)
@@ -55,7 +55,6 @@
 
 #define TGT_BAVAIL(i) (lov->lov_tgts[i]->ltd_exp->exp_obd->obd_osfs.os_bavail *\
                        lov->lov_tgts[i]->ltd_exp->exp_obd->obd_osfs.os_bsize)
-#define TGT_FFREE(i)  (lov->lov_tgts[i]->ltd_exp->exp_obd->obd_osfs.os_ffree)
 
 
 int qos_add_tgt(struct obd_device *obd, __u32 index)
@@ -509,12 +508,13 @@ int qos_remedy_create(struct lov_request_set *set, struct lov_request *req)
                         continue;
                 /* check if objects has been created on this ost */
                 for (stripe = 0; stripe < lsm->lsm_stripe_count; stripe++) {
+                        /* we try send create to this ost but he is failed */
                         if (stripe == req->rq_stripe)
                                 continue;
+                        /* 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,
@@ -741,10 +741,8 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt,
                      char *poolname, int flags)
 {
         struct lov_obd *lov = &exp->exp_obd->u.lov;
-        static time_t last_warn = 0;
-        time_t now = cfs_time_current_sec();
-        __u64 total_bavail, total_weight = 0;
-        int nfound, good_osts, i, warn = 0, rc = 0;
+        __u64 total_weight = 0;
+        int nfound, good_osts, i, rc = 0;
         int stripe_cnt_min = min_stripe_count(*stripe_cnt, flags);
         struct pool_desc *pool;
         struct ost_pool *osts;
@@ -764,7 +762,7 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt,
                 lqr = &(pool->pool_rr);
         }
 
-        lov_getref(exp->exp_obd);
+        obd_getref(exp->exp_obd);
 
         /* wait for fresh statfs info if needed, the rpcs are sent in
          * lov_create() */
@@ -792,35 +790,12 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt,
         if (rc)
                 GOTO(out, rc);
 
-        total_bavail = 0;
         good_osts = 0;
-        /* Warn users about zero available space/inode every 30 min */
-        if (cfs_time_sub(now, last_warn) > 60 * 30)
-                warn = 1;
         /* Find all the OSTs that are valid stripe candidates */
         for (i = 0; i < osts->op_count; i++) {
-                __u64 bavail;
-
                 if (!lov->lov_tgts[osts->op_array[i]] ||
                     !lov->lov_tgts[osts->op_array[i]]->ltd_active)
                         continue;
-                bavail = TGT_BAVAIL(osts->op_array[i]);
-                if (!bavail) {
-                        if (warn) {
-                                CDEBUG(D_QOS, "no free space on %s\n",
-                                     obd_uuid2str(&lov->lov_tgts[osts->op_array[i]]->ltd_uuid));
-                                last_warn = now;
-                        }
-                        continue;
-                }
-                if (!TGT_FFREE(osts->op_array[i])) {
-                        if (warn) {
-                                CDEBUG(D_QOS, "no free inodes on %s\n",
-                                     obd_uuid2str(&lov->lov_tgts[osts->op_array[i]]->ltd_uuid));
-                                last_warn = now;
-                        }
-                        continue;
-                }
 
                 /* Fail Check before osc_precreate() is called
                    so we can only 'fail' single OSC. */
@@ -832,7 +807,6 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt,
 
                 lov->lov_tgts[osts->op_array[i]]->ltd_qos.ltq_usable = 1;
                 qos_calc_weight(lov, osts->op_array[i]);
-                total_bavail += bavail;
                 total_weight += lov->lov_tgts[osts->op_array[i]]->ltd_qos.ltq_weight;
 
                 good_osts++;
@@ -845,9 +819,6 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt,
         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;
@@ -933,7 +904,7 @@ out_nolock:
         if (rc == -EAGAIN)
                 rc = alloc_rr(lov, idx_arr, stripe_cnt, poolname, flags);
 
-        lov_putref(exp->exp_obd);
+        obd_putref(exp->exp_obd);
         RETURN(rc);
 }
 
@@ -1071,6 +1042,7 @@ int qos_prep_create(struct obd_export *exp, struct lov_request_set *set)
                 req->rq_stripe = i;
                 /* create data objects with "parent" OA */
                 memcpy(req->rq_oi.oi_oa, src_oa, sizeof(*req->rq_oi.oi_oa));
+                req->rq_oi.oi_cb_up = cb_create_update;
 
                 /* XXX When we start creating objects on demand, we need to
                  *     make sure that we always create the object on the