From ada7df4076d1ea7ff54d73fd95f38acfc9c3bffe Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 15 Sep 2008 19:50:44 +0000 Subject: [PATCH] b=17054 i=adilger i=nathan use pools to calculate total weight --- lustre/lov/lov_qos.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lustre/lov/lov_qos.c b/lustre/lov/lov_qos.c index 6d4eff0..e913324 100644 --- a/lustre/lov/lov_qos.c +++ b/lustre/lov/lov_qos.c @@ -266,10 +266,11 @@ static int qos_calc_weight(struct lov_obd *lov, int i) } /* We just used this index for a stripe; adjust everyone's weights */ -static int qos_used(struct lov_obd *lov, __u32 index, __u64 *total_wt) +static int qos_used(struct lov_obd *lov, struct ost_pool *osts, + __u32 index, __u64 *total_wt) { struct lov_qos_oss *oss; - int i; + int j; ENTRY; /* Don't allocate from this stripe anymore, until the next alloc_qos */ @@ -299,7 +300,10 @@ static int qos_used(struct lov_obd *lov, __u32 index, __u64 *total_wt) *total_wt = 0; /* Decrease all OST penalties */ - for (i = 0; i < lov->desc.ld_tgt_count; i++) { + for (j = 0; j < osts->op_count; j++) { + int i; + + i = osts->op_array[j]; if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_active) continue; if (lov->lov_tgts[i]->ltd_qos.ltq_penalty < @@ -836,8 +840,9 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt, cur_weight += lov->lov_tgts[osts->op_array[i]]->ltd_qos.ltq_weight; #ifdef QOS_DEBUG - CDEBUG(D_QOS, "cur_weight="LPU64" rand="LPU64"\n", - cur_weight, rand); + CDEBUG(D_QOS, "stripe_cnt=%d nfound=%d cur_weight="LPU64 + " rand="LPU64" total_weight="LPU64"\n", + *stripe_cnt, nfound, cur_weight, rand, total_weight); #endif if (cur_weight >= rand) { #ifdef QOS_DEBUG @@ -845,7 +850,7 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt, nfound, osts->op_array[i]); #endif idx_arr[nfound++] = osts->op_array[i]; - qos_used(lov, osts->op_array[i], &total_weight); + qos_used(lov, osts, osts->op_array[i], &total_weight); rc = 0; break; } -- 1.8.3.1