Whamcloud - gitweb
Branch b1_8
authortianzy <tianzy>
Tue, 10 Feb 2009 04:28:48 +0000 (04:28 +0000)
committertianzy <tianzy>
Tue, 10 Feb 2009 04:28:48 +0000 (04:28 +0000)
add an entry under /proc to support what policy(RR or QOS) will be used.
b=18334
i=nathan
i=adilger

lustre/include/obd.h
lustre/lov/lov_obd.c
lustre/lov/lov_qos.c
lustre/lov/lproc_lov.c

index 60a5d29..86a9b13 100644 (file)
@@ -652,6 +652,7 @@ struct lov_qos {
         struct rw_semaphore lq_rw_sem;
         __u32               lq_active_oss_count;
         unsigned int        lq_prio_free;   /* priority for free space */
+        unsigned int        lq_threshold_rr;/* priority for rr */
         struct lov_qos_rr   lq_rr;          /* round robin qos data */
         unsigned long       lq_dirty:1,     /* recalc qos data */
                             lq_same_space:1,/* the ost's all have approx.
index a88ed7b..3f1142d 100644 (file)
@@ -861,6 +861,8 @@ static int lov_setup(struct obd_device *obd, obd_count len, void *buf)
         lov->lov_qos.lq_reset = 1;
         /* Default priority is toward free space balance */
         lov->lov_qos.lq_prio_free = 232;
+        /* Default threshold for rr (roughly 17%) */
+        lov->lov_qos.lq_threshold_rr = 43;
 
         lov->lov_pools_hash_body = lustre_hash_init("POOLS", 7, 7,
                                                     &pool_hash_operations, 0);
index a371d30..61025ef 100644 (file)
@@ -251,10 +251,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;
index 71ab80f..7526bd8 100644 (file)
@@ -237,6 +237,40 @@ static int lov_wr_qos_priofree(struct file *file, const char *buffer,
         return count;
 }
 
+static int lov_rd_qos_thresholdrr(char *page, char **start, off_t off,
+                                  int count, int *eof, void *data)
+{
+        struct obd_device *dev = (struct obd_device*) data;
+        struct lov_obd *lov;
+
+        LASSERT(dev != NULL);
+        lov = &dev->u.lov;
+        *eof = 1;
+        return snprintf(page, count, "%d%%\n",
+                        (lov->lov_qos.lq_threshold_rr * 100) >> 8);
+}
+
+static int lov_wr_qos_thresholdrr(struct file *file, const char *buffer,
+                                  unsigned long count, void *data)
+{
+        struct obd_device *dev = (struct obd_device *)data;
+        struct lov_obd *lov;
+        int val, rc;
+        LASSERT(dev != NULL);
+
+        lov = &dev->u.lov;
+        rc = lprocfs_write_helper(buffer, count, &val);
+        if (rc)
+                return rc;
+
+        if (val > 100 || val < 0)
+                return -EINVAL;
+
+        lov->lov_qos.lq_threshold_rr = (val << 8) / 100;
+        lov->lov_qos.lq_dirty = 1;
+        return count;
+}
+
 static int lov_rd_qos_maxage(char *page, char **start, off_t off, int count,
                              int *eof, void *data)
 {
@@ -347,6 +381,7 @@ struct lprocfs_vars lprocfs_lov_obd_vars[] = {
         { "kbytesavail",  lprocfs_rd_kbytesavail, 0, 0 },
         { "desc_uuid",    lov_rd_desc_uuid,       0, 0 },
         { "qos_prio_free",lov_rd_qos_priofree,    lov_wr_qos_priofree, 0 },
+        { "qos_threshold_rr",  lov_rd_qos_thresholdrr, lov_wr_qos_thresholdrr, 0 },
         { "qos_maxage",   lov_rd_qos_maxage,      lov_wr_qos_maxage, 0 },
         { 0 }
 };