LX_DEBUG("check hot "DFID": H: %Lu/%Lu, P: %Lu/%Lu, L %d, I %d %s\n",
PFID(&ht->ah_fid),
- ht->ah_heat[0], ht->ah_heat[1], ht->ah_pools[ALR_FAST],
+ ht->ah_heat[ALR_READ], ht->ah_heat[ALR_WRITE], ht->ah_pools[ALR_FAST],
ht->ah_pools[ALR_SLOW], ht->ah_livetime, ht->ah_idle,
ht->ah_mark ? "M" : "");
if (ht->ah_mark & ALR_TAG_PROCESSED) {
* try to mirror it to the hot pool and make that
* replica preferred
*/
- if (ht->ah_heat[0] && ht->ah_heat[1] == 0 &&
+ if (ht->ah_heat[ALR_READ] && ht->ah_heat[ALR_WRITE] == 0 &&
ht->ah_pools[ALR_FAST] == 0 && ht->ah_pools[ALR_SLOW]) {
sync = lamigo_is_in_sync(&ht->ah_fid, slow_pools, fast_pools, &mo);
LX_DEBUG("try to replicate RO "DFID": %d\n",
* XXX: we can track OPEN/CLOSE events to skip this
* try if it's still open
*/
- if (ht->ah_idle > 0 && ht->ah_heat[1] &&
+ if (ht->ah_idle > 0 && ht->ah_heat[ALR_WRITE] &&
ht->ah_pools[ALR_FAST] == 0 && ht->ah_pools[ALR_SLOW]) {
sync = lamigo_is_in_sync(&ht->ah_fid, slow_pools, fast_pools, &mo);
LX_DEBUG("try to replicate RW "DFID": %d\n",
/* the file stored on cold pool was hat,
* now it's idling, try to move it to hot pool */
- if (ht->ah_idle > 0 && ht->ah_heat[1] &&
+ if (ht->ah_idle > 0 && ht->ah_heat[ALR_WRITE] &&
ht->ah_pools[ALR_SLOW] == 0 && ht->ah_pools[ALR_FAST]) {
sync = lamigo_is_in_sync(&ht->ah_fid, fast_pools,
slow_pools, &mo);
} else if (lamigo_lookup_ost(slow_pools, idx)) {
pool = ALR_SLOW;
}
- lamigo_alr_update_one(&fid, rw == 'w' ? WRITE : READ,
+ lamigo_alr_update_one(&fid, rw == 'w' ? ALR_WRITE : ALR_READ,
count, iosize, end, pool);
}
{
max = max * (100 - opt.o_alr_hot_fraction) / 100;
- if ((f->ar_heat[READ] + f->ar_heat[WRITE]) < max)
+ if ((f->ar_heat[ALR_READ] + f->ar_heat[ALR_WRITE]) < max)
return false;
/* now filter out using predefined constraints */
/* XXX: add absolut low limit, few IO/sec on idling system
* should not make file hot */
- if (opt.o_alr_ignore_reads && f->ar_heat[WRITE] < max)
+ if (opt.o_alr_ignore_reads && f->ar_heat[ALR_WRITE] < max)
return false;
- if (opt.o_alr_ignore_writes && f->ar_heat[READ] < max)
+ if (opt.o_alr_ignore_writes && f->ar_heat[ALR_READ] < max)
return false;
/* ignore files with large IO size */
__u64 iosize = 0, ios = 0;
if (opt.o_alr_ignore_reads == 0) {
- iosize += f->ar_iosize[READ];
- ios += f->ar_total_ops[READ];
+ iosize += f->ar_iosize[ALR_READ];
+ ios += f->ar_total_ops[ALR_READ];
}
if (opt.o_alr_ignore_writes == 0) {
- iosize += f->ar_iosize[WRITE];
- ios += f->ar_total_ops[WRITE];
+ iosize += f->ar_iosize[ALR_WRITE];
+ ios += f->ar_total_ops[ALR_WRITE];
}
if (ios == 0 || iosize / ios >= opt.o_alr_large_io)
return false;
i = 0;
lipe_list_for_each_entry(f, &p->alp_list, ar_link) {
assert(i < nr);
- sa[i].ase_val = f->ar_heat[0] + f->ar_heat[1];
+ sa[i].ase_val = f->ar_heat[ALR_READ] + f->ar_heat[ALR_WRITE];
sa[i].ase_ptr = f;
i++;
}
}
/* heat of the center */
i = nr / 2;
- p->alp_mid[0] = sa[i].ase_ptr->ar_heat[0];
- p->alp_mid[1] = sa[i].ase_ptr->ar_heat[1];
+ p->alp_mid[0] = sa[i].ase_ptr->ar_heat[ALR_READ];
+ p->alp_mid[1] = sa[i].ase_ptr->ar_heat[ALR_WRITE];
max = sa[0].ase_val;
free(sa);
i = 0;
asum[0] = (__u64)1 << 63;
lipe_list_for_each_entry(f, &p->alp_list, ar_link) {
- unsigned t = f->ar_heat[0] + f->ar_heat[1];
+ unsigned t = f->ar_heat[ALR_READ] + f->ar_heat[ALR_WRITE];
assert(t <= asum[0]);
asum[0] = t;
if (i++ >= 8)
continue;
LX_DEBUG(DFID" H: %d/%d O: %llu IO: %llu/%llu P: %llu/%llu i: %d\n",
- PFID(&f->ar_fh.fh_fid), (int)f->ar_heat[0], (int)f->ar_heat[1],
+ PFID(&f->ar_fh.fh_fid), (int)f->ar_heat[ALR_READ], (int)f->ar_heat[ALR_WRITE],
f->ar_maxoff[0] > f->ar_maxoff[1] ? f->ar_maxoff[0] : f->ar_maxoff[1],
- f->ar_total_ops[0] > 0 ? f->ar_iosize[0] / f->ar_total_ops[0] : 0,
- f->ar_total_ops[1] > 0 ? f->ar_iosize[1] / f->ar_total_ops[1] : 0,
+ f->ar_total_ops[0] > 0 ? f->ar_iosize[ALR_READ] / f->ar_total_ops[0] : 0,
+ f->ar_total_ops[1] > 0 ? f->ar_iosize[ALR_WRITE] / f->ar_total_ops[1] : 0,
f->ar_pools[ALR_FAST], f->ar_pools[ALR_SLOW],
(int)alr_head.alh_lidx - f->ar_idx);
}
static void lamigo_alr_fill_ht(struct alr_heat *ah, struct alr_rec *f)
{
ah->ah_fid = f->ar_fh.fh_fid;
- ah->ah_heat[0] = f->ar_heat[0];
- ah->ah_heat[1] = f->ar_heat[1];
+ ah->ah_heat[ALR_READ] = f->ar_heat[ALR_READ];
+ ah->ah_heat[ALR_WRITE] = f->ar_heat[ALR_WRITE];
ah->ah_pools[ALR_FAST] = f->ar_pools[ALR_FAST];
ah->ah_pools[ALR_SLOW] = f->ar_pools[ALR_SLOW];
ah->ah_maxoff = f->ar_maxoff[0] > f->ar_maxoff[1] ?
f->ar_maxoff[0] : f->ar_maxoff[1];
- ah->ah_iosize[0] = f->ar_iosize[0];
- ah->ah_iosize[1] = f->ar_iosize[1];
+ ah->ah_iosize[ALR_READ] = f->ar_iosize[ALR_READ];
+ ah->ah_iosize[ALR_WRITE] = f->ar_iosize[ALR_WRITE];
/* XXX: position is not calculated yet */
ah->ah_position = 0;
/* can be on the last processed list or on the pending one
fid_hash_unlock(&alr_head.alh_hash, fh);
LX_DEBUG("ALR: "DFID" heat: %d/%d, idle %d, live %d\n",
- PFID(fid), (int)ah->ah_heat[0], (int)ah->ah_heat[1],
+ PFID(fid), (int)ah->ah_heat[ALR_READ], (int)ah->ah_heat[ALR_WRITE],
(int)ah->ah_idle, (int)ah->ah_livetime);
return 1;
__u64 maxoff;
int idle = 0;
- maxoff = f->ar_maxoff[READ];
- if (f->ar_maxoff[WRITE] > maxoff)
- maxoff = f->ar_maxoff[WRITE];
+ maxoff = f->ar_maxoff[ALR_READ];
+ if (f->ar_maxoff[ALR_WRITE] > maxoff)
+ maxoff = f->ar_maxoff[ALR_WRITE];
if (alr_head.alh_lidx != f->ar_idx) {
idle = (int)alr_head.alh_lidx - f->ar_idx - 1;
if (idle < 0)
if (idle)
lamigo_alr_update_heat_one(f);
fprintf(file, DFID" hr=%Lu hw=%Lu off=%Lu ior=%Lu iow=%Lu ops=%Lu",
- PFID(&f->ar_fh.fh_fid), f->ar_heat[READ],
- f->ar_heat[WRITE], maxoff,
- f->ar_total_ops[READ] == 0 ? 0 :
- f->ar_iosize[READ] / f->ar_total_ops[READ],
- f->ar_total_ops[WRITE] == 0 ? 0 :
- f->ar_iosize[WRITE] / f->ar_total_ops[WRITE],
- f->ar_total_ops[READ] + f->ar_total_ops[WRITE]);
+ PFID(&f->ar_fh.fh_fid), f->ar_heat[ALR_READ],
+ f->ar_heat[ALR_WRITE], maxoff,
+ f->ar_total_ops[ALR_READ] == 0 ? 0 :
+ f->ar_iosize[ALR_READ] / f->ar_total_ops[ALR_READ],
+ f->ar_total_ops[ALR_WRITE] == 0 ? 0 :
+ f->ar_iosize[ALR_WRITE] / f->ar_total_ops[ALR_WRITE],
+ f->ar_total_ops[ALR_READ] + f->ar_total_ops[ALR_WRITE]);
if (idle)
fprintf(file, " idle=%d", idle);
if (f->ar_hot)