Commit 63dbc260 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Remove stale cluster segments when their refcount goes to zero

When a cluster is marked stale, there is no mechanism to actually remove
it once all its containing segments (which would also be marked stale)
goes away.

Fix this by executing vsm_delseg on the cluster in VSM_Unmap if it is marked
stale.
parent 68a04aec
......@@ -975,8 +975,13 @@ VSM_Unmap(struct vsm *vd, struct vsm_fantom *vf)
assert(vg->s == NULL);
assert(vg->sz == 0);
assert(vg->cluster->refs > 0);
if (--vg->cluster->refs == 0)
if (--vg->cluster->refs == 0) {
vsm_unmapseg(vg->cluster);
if (vg->cluster->flags & VSM_FLAG_STALE) {
AN(vg->flags & VSM_FLAG_STALE);
vsm_delseg(vg->cluster, 0);
}
}
vg->b = vg->e = NULL;
} else {
vsm_unmapseg(vg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment