Whamcloud - gitweb
New tag 2.15.63
[fs/lustre-release.git] / lustre / obdclass / lu_tgt_descs.c
index 57d93c9..0062ded 100644 (file)
@@ -30,7 +30,7 @@
  *
  */
 
-#define DEBUG_SUBSYSTEM S_CLASS
+#define DEBUG_SUBSYSTEM S_LOV
 
 #include <linux/module.h>
 #include <linux/list.h>
@@ -56,21 +56,23 @@ u64 lu_prandom_u64_max(u64 ep_ro)
        u64 rand = 0;
 
        if (ep_ro) {
-#if BITS_PER_LONG == 32
+#ifdef HAVE_GET_RANDOM_U32_AND_U64
+               rand = get_random_u64() % ep_ro;
+#elif BITS_PER_LONG == 32
                /*
                 * If ep_ro > 32-bit, first generate the high
                 * 32 bits of the random number, then add in the low
                 * 32 bits (truncated to the upper limit, if needed)
                 */
                if (ep_ro > 0xffffffffULL)
-                       rand = (u64)prandom_u32_max((u32)(ep_ro >> 32)) << 32;
+                       rand = (u64)get_random_u32_below((u32)(ep_ro >> 32)) << 32;
 
                if (rand == (ep_ro & 0xffffffff00000000ULL))
-                       rand |= prandom_u32_max((u32)ep_ro);
+                       rand |= get_random_u32_below((u32)ep_ro);
                else
-                       rand |= prandom_u32();
+                       rand |= get_random_u32();
 #else
-               rand = ((u64)prandom_u32() << 32 | prandom_u32()) % ep_ro;
+               rand = ((u64)get_random_u32() << 32 | get_random_u32()) % ep_ro;
 #endif
        }
 
@@ -226,6 +228,8 @@ void lu_tgt_qos_weight_calc(struct lu_tgt_desc *tgt, bool is_mdt)
        else
                ltq->ltq_avail = tgt_statfs_bavail(tgt) >> 8;
        penalty = ltq->ltq_penalty + ltq->ltq_svr->lsq_penalty;
+       CDEBUG(D_OTHER, "ltq_penalty: %llu lsq_penalty: %llu tgt_bavail: %llu\n",
+                 ltq->ltq_penalty, ltq->ltq_svr->lsq_penalty, ltq->ltq_avail);
        if (ltq->ltq_avail < penalty)
                ltq->ltq_weight = 0;
        else
@@ -421,7 +425,7 @@ EXPORT_SYMBOL(ltd_del_tgt);
  * Calculate penalties per-tgt and per-server
  *
  * Re-calculate penalties when the configuration changes, active targets
- * change and after statfs refresh (all these are reflected by lq_dirty flag).
+ * change and after statfs refresh (all these are reflected by LQ_DIRTY flag).
  * On every tgt and server: decay the penalty by half for every 8x the update
  * interval that the device has been idle. That gives lots of time for the
  * statfs information to be updated (which the penalty is only a proxy for),
@@ -633,8 +637,15 @@ int ltd_qos_update(struct lu_tgt_descs *ltd, struct lu_tgt_desc *tgt,
        /* Set max penalties for this tgt and server */
        ltq->ltq_penalty += ltq->ltq_penalty_per_obj *
                            ltd->ltd_lov_desc.ld_active_tgt_count;
+       CDEBUG(D_OTHER, "ltq_penalty: %llu per_obj: %llu tgt_count: %d\n",
+              ltq->ltq_penalty, ltq->ltq_penalty_per_obj,
+              ltd->ltd_lov_desc.ld_active_tgt_count);
        svr->lsq_penalty += svr->lsq_penalty_per_obj *
                            qos->lq_active_svr_count;
+       CDEBUG(D_OTHER, "lsq_penalty: %llu per_obj: %llu srv_count: %d\n",
+              svr->lsq_penalty, svr->lsq_penalty_per_obj,
+              qos->lq_active_svr_count);
+
 
        /* Decrease all MDS penalties */
        list_for_each_entry(svr, &qos->lq_svr_list, lsq_svr_list) {