From 10c67dbf2bc57311798e57622705245c7a6db234 Mon Sep 17 00:00:00 2001 From: ericm Date: Thu, 2 Mar 2006 04:50:13 +0000 Subject: [PATCH] branch: b1_5 several qos fixes for last commit, from Andreas & Niu. --- lustre/include/lustre_lib.h | 7 ------- lustre/lov/lov_obd.c | 6 +++--- lustre/lov/lov_qos.c | 16 +++++++++------- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/lustre/include/lustre_lib.h b/lustre/include/lustre_lib.h index 90a90d3..13ceaef 100644 --- a/lustre/include/lustre_lib.h +++ b/lustre/include/lustre_lib.h @@ -479,13 +479,6 @@ static inline void obd_ioctl_freedata(char *buf, int len) #define POISON_BULK 0 -static inline int ll_insecure_random_int(void) -{ - struct timeval t; - do_gettimeofday(&t); - return (int)(t.tv_usec); -} - /* * l_wait_event is a flexible sleeping function, permitting simple caller * configuration of interrupt and timeout sensitivity along with actions to diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 58f6b27..ca326d8 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -915,9 +915,6 @@ static int lov_create(struct obd_export *exp, struct obdo *src_oa, if (!lov->desc.ld_active_tgt_count) RETURN(-EIO); - maxage = jiffies - lov->desc.ld_qos_maxage * HZ; - obd_statfs(exp->exp_obd, &osfs, maxage); - /* Recreate a specific object id at the given OST index */ if ((src_oa->o_valid & OBD_MD_FLFLAGS) && (src_oa->o_flags & OBD_FL_RECREATE_OBJS)) { @@ -925,6 +922,9 @@ static int lov_create(struct obd_export *exp, struct obdo *src_oa, RETURN(rc); } + maxage = jiffies - lov->desc.ld_qos_maxage * HZ; + obd_statfs(exp->exp_obd, &osfs, maxage); + rc = lov_prep_create_set(exp, ea, src_oa, oti, &set); if (rc) RETURN(rc); diff --git a/lustre/lov/lov_qos.c b/lustre/lov/lov_qos.c index bebbced..70f68e9 100644 --- a/lustre/lov/lov_qos.c +++ b/lustre/lov/lov_qos.c @@ -84,19 +84,21 @@ int qos_remedy_create(struct lov_request_set *set, struct lov_request *req) int stripe, i, rc = -EIO; ENTRY; - ost_idx = (req->rq_idx + 1) % ost_count; + ost_idx = (req->rq_idx + lsm->lsm_stripe_count) % ost_count; for (i = 0; i < ost_count; i++, ost_idx = (ost_idx + 1) % ost_count) { if (lov->tgts[ost_idx].active == 0) { CDEBUG(D_HA, "lov idx %d inactive\n", ost_idx); continue; } /* check if objects has been created on this ost */ - for (stripe = req->rq_stripe; stripe >= 0; stripe--) { + for (stripe = 0; stripe < lsm->lsm_stripe_count; stripe++) { + if (stripe == req->rq_stripe) + continue; if (ost_idx == lsm->lsm_oinfo[stripe].loi_ost_idx) break; } - if (stripe < 0) { + if (stripe >= lsm->lsm_stripe_count) { req->rq_idx = ost_idx; rc = obd_create(lov->tgts[ost_idx].ltd_exp, req->rq_oa, &req->rq_md, set->set_oti); @@ -119,7 +121,7 @@ static int alloc_rr(struct lov_obd *lov, int *idx_arr, int *stripe_cnt) ENTRY; if (--ost_start_count <= 0) { - ost_start_idx = ll_insecure_random_int(); + ost_start_idx = ll_rand(); ost_start_count = (LOV_CREATE_RESEED_MIN / max(ost_active_count, 1U) + LOV_CREATE_RESEED_MULT) * max(ost_active_count, 1U); @@ -291,10 +293,10 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt) /* search enough OSTs with free space weighted random allocation */ while (nfound < *stripe_cnt) { cur_bavail = 0; - - get_random_bytes(&rand, sizeof(rand)); + + rand = (shift < 32 ? 0ULL : (__u64)ll_rand() << 32) | ll_rand(); if (shift < 64) - rand &= ((1 << shift) - 1); + rand &= ((1ULL << shift) - 1); while (rand > total_bavail) rand -= total_bavail; -- 1.8.3.1