From: tianzy Date: Tue, 10 Feb 2009 04:29:16 +0000 (+0000) Subject: Branch b1_6 X-Git-Tag: GIT_EPOCH_B1_6~2^5~194 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=cd0506153bc60cd4ecb23d1b0c796afcfb9ad669;p=fs%2Flustre-release.git Branch b1_6 add an entry under /proc to support what policy(RR or QOS) will be used. b=18334 i=nathan i=adilger --- diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 35b2979..9fd6322 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -607,6 +607,7 @@ struct lov_qos { __u32 *lq_rr_array; /* round-robin optimized list */ unsigned int lq_rr_size; /* rr array size */ unsigned int lq_prio_free; /* priority for free space */ + unsigned int lq_threshold_rr;/* priority for rr */ unsigned long lq_dirty:1, /* recalc qos data */ lq_dirty_rr:1, /* recalc round-robin list */ lq_same_space:1,/* the ost's all have approx. diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index c849d34..4241467 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -853,6 +853,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; lprocfs_lov_init_vars(&lvars); lprocfs_obd_setup(obd, lvars.obd_vars); diff --git a/lustre/lov/lov_qos.c b/lustre/lov/lov_qos.c index 4f26b9d..a301849 100644 --- a/lustre/lov/lov_qos.c +++ b/lustre/lov/lov_qos.c @@ -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; diff --git a/lustre/lov/lproc_lov.c b/lustre/lov/lproc_lov.c index 71ab80f..7526bd8 100644 --- a/lustre/lov/lproc_lov.c +++ b/lustre/lov/lproc_lov.c @@ -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 } };