@@ -1503,6 +1503,7 @@ struct lu_tgt_desc_idx {
};
/* QoS data for LOD/LMV */
+#define QOS_THRESHOLD_MAX 256 /* should be power of two */
struct lu_qos {
struct list_head lq_svr_list; /* lu_svr_qos list */
struct rw_semaphore lq_rw_sem;
@@ -158,7 +158,8 @@ static ssize_t qos_threshold_rr_show(struct kobject *kobj,
obd_kset.kobj);
return scnprintf(buf, PAGE_SIZE, "%u%%\n",
- (obd->u.lmv.lmv_qos.lq_threshold_rr * 100 + 255) >> 8);
+ (obd->u.lmv.lmv_qos.lq_threshold_rr * 100 +
+ (QOS_THRESHOLD_MAX - 1)) / QOS_THRESHOLD_MAX);
}
static ssize_t qos_threshold_rr_store(struct kobject *kobj,
@@ -190,7 +191,7 @@ static ssize_t qos_threshold_rr_store(struct kobject *kobj,
if (val > 100)
return -EINVAL;
- lmv->lmv_qos.lq_threshold_rr = (val << 8) / 100;
+ lmv->lmv_qos.lq_threshold_rr = (val * QOS_THRESHOLD_MAX) / 100;
set_bit(LQ_DIRTY, &lmv->lmv_qos.lq_flags);
return count;
@@ -275,11 +275,13 @@ int lu_tgt_descs_init(struct lu_tgt_descs *ltd, bool is_mdt)
ltd->ltd_lmv_desc.ld_pattern = LMV_HASH_TYPE_DEFAULT;
ltd->ltd_qos.lq_prio_free = LMV_QOS_DEF_PRIO_FREE * 256 / 100;
ltd->ltd_qos.lq_threshold_rr =
- LMV_QOS_DEF_THRESHOLD_RR_PCT * 256 / 100;
+ LMV_QOS_DEF_THRESHOLD_RR_PCT *
+ QOS_THRESHOLD_MAX / 100;
} else {
ltd->ltd_qos.lq_prio_free = LOV_QOS_DEF_PRIO_FREE * 256 / 100;
ltd->ltd_qos.lq_threshold_rr =
- LOV_QOS_DEF_THRESHOLD_RR_PCT * 256 / 100;
+ LOV_QOS_DEF_THRESHOLD_RR_PCT *
+ QOS_THRESHOLD_MAX / 100;
}
return 0;
@@ -568,8 +570,10 @@ int ltd_qos_penalties_calc(struct lu_tgt_descs *ltd)
* creation performance
*/
clear_bit(LQ_SAME_SPACE, &qos->lq_flags);
- if ((ba_max * (256 - qos->lq_threshold_rr)) >> 8 < ba_min &&
- (ia_max * (256 - qos->lq_threshold_rr)) >> 8 < ia_min) {
+ if (((ba_max * (QOS_THRESHOLD_MAX - qos->lq_threshold_rr)) /
+ QOS_THRESHOLD_MAX) < ba_min &&
+ ((ia_max * (QOS_THRESHOLD_MAX - qos->lq_threshold_rr)) /
+ QOS_THRESHOLD_MAX) < ia_min) {
set_bit(LQ_SAME_SPACE, &qos->lq_flags);
/* Reset weights for the next time we enter qos mode */
set_bit(LQ_RESET, &qos->lq_flags);