bcache: Improve priority_stats
Break down data into clean data/dirty data/metadata. Signed-off-by: Kent Overstreet <kmo@daterainc.com>
This commit is contained in:
parent
7159b1ad3d
commit
1575402052
|
@ -761,7 +761,9 @@ SHOW(__bch_cache)
|
||||||
int cmp(const void *l, const void *r)
|
int cmp(const void *l, const void *r)
|
||||||
{ return *((uint16_t *) r) - *((uint16_t *) l); }
|
{ return *((uint16_t *) r) - *((uint16_t *) l); }
|
||||||
|
|
||||||
size_t n = ca->sb.nbuckets, i, unused, btree;
|
struct bucket *b;
|
||||||
|
size_t n = ca->sb.nbuckets, i;
|
||||||
|
size_t unused = 0, available = 0, dirty = 0, meta = 0;
|
||||||
uint64_t sum = 0;
|
uint64_t sum = 0;
|
||||||
/* Compute 31 quantiles */
|
/* Compute 31 quantiles */
|
||||||
uint16_t q[31], *p, *cached;
|
uint16_t q[31], *p, *cached;
|
||||||
|
@ -772,6 +774,17 @@ SHOW(__bch_cache)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
mutex_lock(&ca->set->bucket_lock);
|
mutex_lock(&ca->set->bucket_lock);
|
||||||
|
for_each_bucket(b, ca) {
|
||||||
|
if (!GC_SECTORS_USED(b))
|
||||||
|
unused++;
|
||||||
|
if (GC_MARK(b) == GC_MARK_RECLAIMABLE)
|
||||||
|
available++;
|
||||||
|
if (GC_MARK(b) == GC_MARK_DIRTY)
|
||||||
|
dirty++;
|
||||||
|
if (GC_MARK(b) == GC_MARK_METADATA)
|
||||||
|
meta++;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = ca->sb.first_bucket; i < n; i++)
|
for (i = ca->sb.first_bucket; i < n; i++)
|
||||||
p[i] = ca->buckets[i].prio;
|
p[i] = ca->buckets[i].prio;
|
||||||
mutex_unlock(&ca->set->bucket_lock);
|
mutex_unlock(&ca->set->bucket_lock);
|
||||||
|
@ -786,10 +799,7 @@ SHOW(__bch_cache)
|
||||||
|
|
||||||
while (cached < p + n &&
|
while (cached < p + n &&
|
||||||
*cached == BTREE_PRIO)
|
*cached == BTREE_PRIO)
|
||||||
cached++;
|
cached++, n--;
|
||||||
|
|
||||||
btree = cached - p;
|
|
||||||
n -= btree;
|
|
||||||
|
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
sum += INITIAL_PRIO - cached[i];
|
sum += INITIAL_PRIO - cached[i];
|
||||||
|
@ -805,12 +815,16 @@ SHOW(__bch_cache)
|
||||||
|
|
||||||
ret = scnprintf(buf, PAGE_SIZE,
|
ret = scnprintf(buf, PAGE_SIZE,
|
||||||
"Unused: %zu%%\n"
|
"Unused: %zu%%\n"
|
||||||
|
"Clean: %zu%%\n"
|
||||||
|
"Dirty: %zu%%\n"
|
||||||
"Metadata: %zu%%\n"
|
"Metadata: %zu%%\n"
|
||||||
"Average: %llu\n"
|
"Average: %llu\n"
|
||||||
"Sectors per Q: %zu\n"
|
"Sectors per Q: %zu\n"
|
||||||
"Quantiles: [",
|
"Quantiles: [",
|
||||||
unused * 100 / (size_t) ca->sb.nbuckets,
|
unused * 100 / (size_t) ca->sb.nbuckets,
|
||||||
btree * 100 / (size_t) ca->sb.nbuckets, sum,
|
available * 100 / (size_t) ca->sb.nbuckets,
|
||||||
|
dirty * 100 / (size_t) ca->sb.nbuckets,
|
||||||
|
meta * 100 / (size_t) ca->sb.nbuckets, sum,
|
||||||
n * ca->sb.bucket_size / (ARRAY_SIZE(q) + 1));
|
n * ca->sb.bucket_size / (ARRAY_SIZE(q) + 1));
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(q); i++)
|
for (i = 0; i < ARRAY_SIZE(q); i++)
|
||||||
|
|
Loading…
Reference in New Issue