sml: Optimize freebehind (transient) memory usage

Previously, sml_iterator() could not free the last segment while iterating,
because it could have turned out to be over-allocated at any time and be
removed.

With the change from the previous commit, we can now lift this limitation and
take a reference to also the last segment.

This is relevant because, due to of the race between the fetch and iterator site
of a transient operation, the "is last segment" condition can happen at any
point while an object is busy.
parent 563bdd94
......@@ -395,15 +395,14 @@ sml_iterator(struct worker *wrk, struct objcore *oc,
assert(nl > 0);
sl += st->len;
st = VTAILQ_PREV(st, storagehead, list);
if (VTAILQ_PREV(st, storagehead, list) != NULL) {
if (final && checkpoint != NULL) {
VTAILQ_REMOVE(&obj->list,
checkpoint, list);
sml_stv_free(stv, checkpoint);
}
checkpoint = st;
checkpoint_len = sl;
if (final && checkpoint != NULL) {
VTAILQ_REMOVE(&obj->list, checkpoint, list);
if (checkpoint == boc->stevedore_priv)
boc->stevedore_priv = trim_once;
sml_stv_free(stv, checkpoint);
}
checkpoint = st;
checkpoint_len = sl;
}
CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC);
CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC);
......
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