*
*/
-#define DEBUG_SUBSYSTEM S_CLASS
+#define DEBUG_SUBSYSTEM S_LOV
#include <linux/module.h>
#include <linux/list.h>
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
}
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
* 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),
/* 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) {