Skip to content
Snippets Groups Projects
Commit 2011b269 authored by Vladimir Davydov's avatar Vladimir Davydov
Browse files

vinyl: implement vy_quota_wait using vy_quota_use

So that there's a single place where we can wait for quota. It should
make it easier to implement quota throttling.
parent 33a0edde
No related branches found
No related tags found
No related merge requests found
......@@ -227,10 +227,3 @@ vy_quota_adjust(struct vy_quota *q, size_t reserved, size_t used)
if (reserved < used)
vy_quota_force_use(q, used - reserved);
}
void
vy_quota_wait(struct vy_quota *q)
{
while (q->used > q->limit)
fiber_cond_wait(&q->cond);
}
......@@ -196,8 +196,11 @@ vy_quota_adjust(struct vy_quota *q, size_t reserved, size_t used);
/**
* Block the caller until the quota is not exceeded.
*/
void
vy_quota_wait(struct vy_quota *q);
static inline void
vy_quota_wait(struct vy_quota *q)
{
vy_quota_use(q, 0, TIMEOUT_INFINITY);
}
#if defined(__cplusplus)
} /* extern "C" */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment