From 1f36caa3192328cf93f6422f58649eb81220cfbf Mon Sep 17 00:00:00 2001 From: tianzy Date: Tue, 10 Feb 2009 04:30:20 +0000 Subject: [PATCH] Branch HEAD 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 | 1 + lustre/lov/lov_obd.c | 2 ++ lustre/lov/lov_qos.c | 5 +---- lustre/lov/lproc_lov.c | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/lustre/include/obd.h b/lustre/include/obd.h index f4ee771..868e86f 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -640,6 +640,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. diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 00ce37d..88369ec2 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -805,6 +805,8 @@ int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg) 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); diff --git a/lustre/lov/lov_qos.c b/lustre/lov/lov_qos.c index 94539b3..8913d90 100644 --- a/lustre/lov/lov_qos.c +++ b/lustre/lov/lov_qos.c @@ -253,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; 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 } }; -- 1.8.3.1