Whamcloud - gitweb
OBD_SLAB_ALLOC_PTR_SAFE() is a new OBD_ macro for slab allocation that uses CFS_ALLOC...
[fs/lustre-release.git] / lustre / lov / lov_qos.c
index 45245ed..8913d90 100644 (file)
@@ -121,19 +121,16 @@ out:
         RETURN(rc);
 }
 
-int qos_del_tgt(struct obd_device *obd, __u32 index)
+int qos_del_tgt(struct obd_device *obd, struct lov_tgt_desc *tgt)
 {
         struct lov_obd *lov = &obd->u.lov;
         struct lov_qos_oss *oss;
         int rc = 0;
         ENTRY;
 
-        if (!lov->lov_tgts[index])
-                RETURN(0);
-
         down_write(&lov->lov_qos.lq_rw_sem);
 
-        oss = lov->lov_tgts[index]->ltd_qos.ltq_oss;
+        oss = tgt->ltd_qos.ltq_oss;
         if (!oss)
                 GOTO(out, rc = -ENOENT);
 
@@ -256,10 +253,7 @@ static int qos_calc_ppo(struct obd_device *obd)
         /* If each ost has almost same free space,
          * do rr allocation for better creation performance */
         lov->lov_qos.lq_same_space = 0;
-        temp = ba_max - ba_min;
-        ba_min = (ba_min * 51) >> 8;     /* 51/256 = .20 */
-        if (temp < ba_min) {
-                /* Difference is less than 20% */
+        if ((ba_max * (256 - lov->lov_qos.lq_threshold_rr)) >> 8 < ba_min) {
                 lov->lov_qos.lq_same_space = 1;
                 /* Reset weights for the next time we enter qos mode */
                 lov->lov_qos.lq_reset = 1;
@@ -640,7 +634,7 @@ out:
         if (pool != NULL) {
                 up_read(&pool_tgt_rw_sem(pool));
                 /* put back ref got by lov_find_pool() */
-                lh_put(lov->lov_pools_hash_body, &pool->pool_hash);
+                lov_pool_putref(pool);
         }
 
         RETURN(rc);
@@ -732,7 +726,7 @@ out:
         if (pool != NULL) {
                 up_read(&pool_tgt_rw_sem(pool));
                 /* put back ref got by lov_find_pool() */
-                lh_put(lov->lov_pools_hash_body, &pool->pool_hash);
+                lov_pool_putref(pool);
         }
 
         RETURN(rc);
@@ -927,7 +921,7 @@ out_nolock:
         if (pool != NULL) {
                 up_read(&pool_tgt_rw_sem(pool));
                 /* put back ref got by lov_find_pool() */
-                lh_put(lov->lov_pools_hash_body, &pool->pool_hash);
+                lov_pool_putref(pool);
         }
 
         if (rc == -EAGAIN)